fix: harden workshop availability
This commit is contained in:
28 files changed
+671
-279
No files matched your search
+20
-11
@@ -5,17 +5,21 @@ mkdir -p /appdata/db
|
||||
mkdir -p /appdata/redis
|
||||
mkdir -p /appdata/trusted-certificates
|
||||
|
||||
# Run migrations
|
||||
if [ "$DB_MIGRATIONS_DISABLED" = "true" ]; then
|
||||
echo "DB migrations are disabled, skipping"
|
||||
else
|
||||
echo "Running DB migrations"
|
||||
DISABLE_REDIS_LOGS=true node ./db/migrations/$DB_DIALECT/migrate.cjs ./db/migrations/$DB_DIALECT
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: DB migrations failed, aborting startup"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
run_migrations() {
|
||||
if [ "${DB_MIGRATIONS_DISABLED:-false}" = "true" ]; then
|
||||
echo "DB migrations are disabled, skipping"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Running DB migrations"
|
||||
DISABLE_REDIS_LOGS=true node ./db/migrations/$DB_DIALECT/migrate.cjs ./db/migrations/$DB_DIALECT
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: DB migrations failed, aborting startup"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_migrations
|
||||
|
||||
# Auth secret is generated every time the container starts as it is required, but not used because we don't need JWTs or Mail hashing
|
||||
export AUTH_SECRET=$(openssl rand -base64 32)
|
||||
@@ -69,6 +73,11 @@ while true; do
|
||||
break
|
||||
fi
|
||||
|
||||
if [ "$EXIT_CODE" -eq 101 ]; then
|
||||
echo "Database was restored, applying migrations before restart"
|
||||
run_migrations
|
||||
fi
|
||||
|
||||
echo "Next.js exited with code $EXIT_CODE, restarting in 1s..."
|
||||
sleep 1
|
||||
node apps/nextjs/server.js &
|
||||
|
||||
Reference in new issue
Block a user