- Added Dockerfile for multi-stage build including PHP, Node.js, and Nginx. - Created docker-compose.coolify.yaml for service orchestration with app, workers, MariaDB, and Redis. - Introduced entrypoint.sh for initialization tasks like JWT key generation and database migrations. - Configured Nginx with default.conf for handling requests and routing to PHP-FPM. - Added php.ini with production settings and opcache configuration. - Set up supervisord.conf to manage PHP-FPM and Nginx processes. - Created frontend-domains.json for managing allowed frontend domains. - Added gen-cors-env.php script to generate CORS environment variables from frontend domains. - Updated framework.yaml to configure trusted proxies and headers. - Created .dockerignore to exclude unnecessary files from the Docker context. - Added .env.coolify.example for environment variable configuration. - Documented deployment steps and troubleshooting in coolify.md.
23 lines
937 B
Bash
Executable File
23 lines
937 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# Volume-mounted dirs (jwt_keys, uploads) are created/owned by root on first run.
|
|
# Ensure the runtime user can write to them. Runs every start; cheap and idempotent.
|
|
chown -R www-data:www-data var public/uploads config/jwt 2>/dev/null || true
|
|
|
|
# One-time init tasks — only the web service runs these (RUN_INIT=1).
|
|
# Workers set RUN_INIT=0 so DB migrations / JWT generation don't race.
|
|
if [ "${RUN_INIT:-1}" = "1" ]; then
|
|
# Generate JWT keypair if not already persisted on the jwt_keys volume.
|
|
php bin/console lexik:jwt:generate-keypair --skip-if-exists --no-interaction
|
|
|
|
# Rebuild the prod cache (vendor was installed with --no-scripts at build time).
|
|
php bin/console cache:clear --no-warmup
|
|
php bin/console cache:warmup
|
|
|
|
# Apply pending migrations. --all-or-nothing wraps them in a transaction.
|
|
php bin/console doctrine:migrations:migrate --all-or-nothing --no-interaction
|
|
fi
|
|
|
|
exec "$@"
|