Compare commits

..

2 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) 2d95033255 Clean up comments and source fallback in fleet.sh
Removed local core checkout comments and fallback source.
2026-08-14 11:25:35 +02:00
push-app-to-main[bot] a5a25c2471 Add fleet (ct) 2026-08-14 06:53:01 +00:00
5 changed files with 166 additions and 12 deletions
+1 -9
View File
@@ -39,15 +39,7 @@ function update_script() {
/opt/ampache/public/play/.htaccess \
/opt/ampache/advanced-config
CURRENT_PHP=$(php -v 2>/dev/null | awk '/^PHP/{print $2}' | cut -d. -f1,2)
if [[ "$CURRENT_PHP" != "8.5" ]]; then
msg_info "Migrating PHP $CURRENT_PHP to 8.5"
$STD apt remove -y php"${CURRENT_PHP//./}"*
PHP_VERSION="8.5" PHP_APACHE="YES" setup_php
msg_ok "Migrated PHP $CURRENT_PHP to 8.5"
fi
fetch_and_deploy_gh_release "Ampache" "ampache/ampache" "prebuild" "latest" "/opt/ampache" "ampache-*_all_php8.5.zip"
fetch_and_deploy_gh_release "Ampache" "ampache/ampache" "prebuild" "latest" "/opt/ampache" "ampache-*_all_php8.4.zip"
restore_backup
chmod 664 /opt/ampache/public/rest/.htaccess /opt/ampache/public/play/.htaccess
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/fleetdm/fleet
APP="Fleet"
var_tags="${var_tags:-monitoring;device-management;security}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
var_os="${var_os:-ubuntu}"
var_version="${var_version:-24.04}"
#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /opt/fleet/fleet ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "fleet" "fleetdm/fleet"; then
msg_info "Stopping Service"
systemctl stop fleet
msg_ok "Stopped Service"
fetch_and_deploy_gh_release "fleet" "fleetdm/fleet" "prebuild" "latest" "/opt/fleet" "fleet_v*_linux.tar.gz"
chmod +x /opt/fleet/fleet
msg_info "Running Database Migrations"
set -a && source /opt/fleet/.env && set +a
$STD /opt/fleet/fleet prepare db --no-prompt
msg_ok "Ran Database Migrations"
msg_info "Starting Service"
systemctl start fleet
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:8080${CL}"
echo -e "${INFO}${YW} Admin Email:${CL} ${BGN}admin@fleet.local${CL}"
echo -e "${INFO}${YW} Admin Password:${CL} ${BGN}Check inside the container: cat /opt/fleet/.env${CL}"
+6
View File
@@ -0,0 +1,6 @@
________ __
/ ____/ /__ ___ / /_
/ /_ / / _ \/ _ \/ __/
/ __/ / / __/ __/ /_
/_/ /_/\___/\___/\__/
+3 -3
View File
@@ -27,11 +27,11 @@ $STD apt install -y \
libvpx-dev
msg_ok "Installed dependencies"
PHP_VERSION="8.5" PHP_APACHE="YES" setup_php
PHP_VERSION="8.4" PHP_APACHE="YES" setup_php
setup_mariadb
MARIADB_DB_USER="ampache" MARIADB_DB_NAME="ampache" setup_mariadb_db
fetch_and_deploy_gh_release "ampache" "ampache/ampache" "prebuild" "latest" "/opt/ampache" "ampache-*_all_php8.5.zip"
fetch_and_deploy_gh_release "ampache" "ampache/ampache" "prebuild" "latest" "/opt/ampache" "ampache-*_all_php8.4.zip"
msg_info "Setting up Ampache"
rm -rf /var/www/html
@@ -58,7 +58,7 @@ msg_info "Configuring PHP"
sed -i -e 's/upload_max_filesize = .*/upload_max_filesize = 100M/' \
-e 's/post_max_size = .*/post_max_size = 100M/' \
-e 's/max_execution_time = .*/max_execution_time = 600/' \
-e 's/memory_limit = .*/memory_limit = 512M/' /etc/php/8.5/apache2/php.ini
-e 's/memory_limit = .*/memory_limit = 512M/' /etc/php/8.4/apache2/php.ini
$STD a2enmod rewrite
$STD systemctl restart apache2
msg_ok "Configured PHP"
+93
View File
@@ -0,0 +1,93 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/fleetdm/fleet
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y redis-server mysql-server
msg_ok "Installed Dependencies"
MYSQL_DB_NAME="fleet" MYSQL_DB_USER="fleet" setup_mysql_db
fetch_and_deploy_gh_release "fleet" "fleetdm/fleet" "prebuild" "latest" "/opt/fleet" "fleet_v*_linux.tar.gz"
msg_info "Configuring Application"
chmod +x /opt/fleet/fleet
PRIVATE_KEY=$(openssl rand -hex 32)
cat <<EOF >/opt/fleet/.env
FLEET_MYSQL_ADDRESS=127.0.0.1:3306
FLEET_MYSQL_DATABASE=fleet
FLEET_MYSQL_USERNAME=fleet
FLEET_MYSQL_PASSWORD=${MYSQL_DB_PASS}
FLEET_SERVER_ADDRESS=0.0.0.0:8080
FLEET_SERVER_TLS=false
FLEET_SERVER_PRIVATE_KEY=${PRIVATE_KEY}
FLEET_REDIS_ADDRESS=127.0.0.1:6379
FLEET_LOGGING_JSON=true
EOF
msg_ok "Configured Application"
msg_info "Running Database Migrations"
set -a && source /opt/fleet/.env && set +a
$STD /opt/fleet/fleet prepare db --no-prompt
msg_ok "Ran Database Migrations"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/fleet.service
[Unit]
Description=Fleet
After=network.target mysql.service redis-server.service
Requires=mysql.service redis-server.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/fleet
EnvironmentFile=/opt/fleet/.env
ExecStart=/opt/fleet/fleet serve
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now fleet redis-server
msg_ok "Created Service"
msg_info "Initializing Fleet"
FLEET_ADMIN_EMAIL="admin@fleet.local"
FLEET_ADMIN_PASS="$(openssl rand -hex 8)1!"
ELAPSED=0
until curl -sf "http://127.0.0.1:8080/healthz" >/dev/null 2>&1; do
sleep 2
ELAPSED=$((ELAPSED + 2))
[[ $ELAPSED -ge 60 ]] && break
done
SETUP_RESPONSE=$(curl -s -X POST "http://127.0.0.1:8080/api/v1/setup" \
-H "Content-Type: application/json" \
-d "{\"admin\":{\"admin\":true,\"email\":\"${FLEET_ADMIN_EMAIL}\",\"name\":\"Admin\",\"password\":\"${FLEET_ADMIN_PASS}\"},\"org_info\":{\"org_name\":\"Fleet\",\"org_logo_url\":\"\"},\"server_url\":\"http://127.0.0.1:8080\"}")
FLEET_TOKEN=$(echo "${SETUP_RESPONSE}" | grep -o '"token":"[^"]*"' | cut -d'"' -f4) || true
if [[ -n "${FLEET_TOKEN}" ]]; then
curl -s -X PATCH "http://127.0.0.1:8080/api/latest/fleet/config" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${FLEET_TOKEN}" \
-d "{\"server_settings\":{\"server_url\":\"http://${LOCAL_IP}:8080\"}}" >/dev/null
fi
cat <<EOF >>/opt/fleet/.env
FLEET_ADMIN_EMAIL=${FLEET_ADMIN_EMAIL}
FLEET_ADMIN_PASSWORD=${FLEET_ADMIN_PASS}
EOF
msg_ok "Initialized Fleet"
motd_ssh
customize
cleanup_lxc