config/ is not writable for www-data, so the schema dump failed with a permission warning on every start. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
18 lines
624 B
Bash
18 lines
624 B
Bash
#!/bin/sh
|
|
# Idempotent start: prepare writable dirs, migrate the database, then run the built-in server.
|
|
set -eu
|
|
|
|
cd /app
|
|
mkdir -p tmp/cache tmp/sessions tmp/mails tmp/dompdf logs
|
|
|
|
if [ -z "${SECURITY_SALT:-}" ] || [ "${SECURITY_SALT}" = "__SALT__" ]; then
|
|
echo "SECURITY_SALT is not set. Generate one with: php -r \"echo bin2hex(random_bytes(32));\"" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# --no-lock: skip the schema dump lock file; config/ is read-only for www-data and the file is only a dev aid
|
|
php bin/cake.php migrations migrate --no-lock
|
|
php bin/cake.php cache clear_all
|
|
|
|
exec php bin/cake.php server -H 0.0.0.0 -p "${PORT:-8765}"
|