Refactor: remove setup wizard and related middleware, update settings management

This commit is contained in:
2026-04-07 13:40:08 +00:00
parent ef37385b3d
commit 80318d33b4
8 changed files with 45 additions and 61 deletions

View File

@@ -37,37 +37,10 @@ upsert_env() {
fi
}
sync_app_code() {
local env_backup="/tmp/termanager2.env.backup"
rm -f "$env_backup"
if [ -f /var/www/html/.env ]; then
cp /var/www/html/.env "$env_backup"
fi
cp -a /app-src/. /var/www/html/
if [ -f "$env_backup" ]; then
mv "$env_backup" /var/www/html/.env
fi
}
# -----------------------------------------------
# 0. Sync application code from image to volume
# 0. Application code is bind-mounted from host
# -----------------------------------------------
IMAGE_BUILD_FILE="/app-src/.image-build-id"
VOLUME_BUILD_FILE="/var/www/html/.image-build-id"
if [ ! -f /var/www/html/artisan ]; then
echo "[*] Syncing application code to volume..."
sync_app_code
elif [ -f "$IMAGE_BUILD_FILE" ] && { [ ! -f "$VOLUME_BUILD_FILE" ] || ! cmp -s "$IMAGE_BUILD_FILE" "$VOLUME_BUILD_FILE"; }; then
echo "[*] New image detected. Syncing updated application code to volume..."
sync_app_code
else
echo "[✓] Application code already in volume."
fi
echo "[✓] Using bind-mounted application code from host."
# -----------------------------------------------
# 0b. Create required directories & fix permissions
@@ -184,6 +157,25 @@ fi
echo "[*] Running database migrations..."
retry 10 3 php artisan migrate --force
# -----------------------------------------------
# 7b. Seed database on first container startup only
# -----------------------------------------------
SEED_MARKER_FILE="/var/www/html/storage/app/.db_seeded"
RUN_DB_SEED_ON_FIRST_START="${RUN_DB_SEED_ON_FIRST_START:-true}"
if [ "$RUN_DB_SEED_ON_FIRST_START" = "true" ]; then
if [ ! -f "$SEED_MARKER_FILE" ]; then
echo "[*] First startup detected. Running database seed..."
retry 5 3 php artisan db:seed --force
touch "$SEED_MARKER_FILE"
echo "[✓] Database seed completed and startup marker saved."
else
echo "[✓] Seed already executed on a previous startup."
fi
else
echo "[i] RUN_DB_SEED_ON_FIRST_START=false, skipping automatic seed."
fi
# -----------------------------------------------
# 8. Cache config/routes/views
# -----------------------------------------------