Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38d134bbac | ||
|
|
25664bbc4f | ||
|
|
4dfc8e7b15 | ||
|
|
bf7d1ee379 | ||
|
|
5188b6e697 | ||
|
|
812dc06988 | ||
|
|
376ed3f592 | ||
|
|
0543ed43b9 | ||
|
|
b486ca64d3 | ||
|
|
50b7300649 | ||
|
|
c9294d6df8 | ||
|
|
93f162b306 | ||
|
|
55a46a42b2 | ||
|
|
9cf04be857 | ||
|
|
654b4036b4 | ||
|
|
b58da74967 | ||
|
|
18821e2463 | ||
|
|
3b071eec9b |
@@ -1,63 +0,0 @@
|
|||||||
# In all environments, the following files are loaded if they exist,
|
|
||||||
# the latter taking precedence over the former:
|
|
||||||
#
|
|
||||||
# * .env contains default values for the environment variables needed by the app
|
|
||||||
# * .env.local uncommitted file with local overrides
|
|
||||||
# * .env.$APP_ENV committed environment-specific defaults
|
|
||||||
# * .env.$APP_ENV.local uncommitted environment-specific overrides
|
|
||||||
#
|
|
||||||
# Real environment variables win over .env files.
|
|
||||||
#
|
|
||||||
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
|
|
||||||
# https://symfony.com/doc/current/configuration/secrets.html
|
|
||||||
#
|
|
||||||
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
|
|
||||||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
|
||||||
|
|
||||||
###> symfony/framework-bundle ###
|
|
||||||
APP_ENV=dev
|
|
||||||
APP_SECRET=
|
|
||||||
###< symfony/framework-bundle ###
|
|
||||||
|
|
||||||
###> doctrine/doctrine-bundle ###
|
|
||||||
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
|
||||||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
|
||||||
#
|
|
||||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
|
|
||||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
|
||||||
DATABASE_URL="mysql://escapepage:b.0nqrxJ%%2FD%%2ALuf9N@localhost:3306/escapepage?serverVersion=8.0.32&charset=utf8mb4"
|
|
||||||
###< doctrine/doctrine-bundle ###
|
|
||||||
|
|
||||||
###> symfony/messenger ###
|
|
||||||
# Choose one of the transports below
|
|
||||||
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
|
|
||||||
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
|
|
||||||
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
|
||||||
###< symfony/messenger ###
|
|
||||||
|
|
||||||
###> symfony/mailer ###
|
|
||||||
# Development: use Mailpit (docker compose override provides service `mailer` on port 1025)
|
|
||||||
MAILER_DSN=smtp://mailer:1025
|
|
||||||
# Production/Stage (uncomment and set SENDGRID_API_KEY in real env or secrets):
|
|
||||||
# MAILER_DSN=sendgrid+api://%env(SENDGRID_API_KEY)%
|
|
||||||
# Alternatively, via SMTP (no extra package needed):
|
|
||||||
# MAILER_DSN="smtp://apikey:%env(SENDGRID_API_KEY)%@smtp.sendgrid.net:587?encryption=tls"
|
|
||||||
# Optional default sender (used by test command if --from not passed):
|
|
||||||
# MAILER_FROM=no-reply@your-domain.tld
|
|
||||||
# SENDGRID_API_KEY=your_real_key_goes_here # Do NOT commit this; set in .env.local or deployment env
|
|
||||||
###< symfony/mailer ###
|
|
||||||
|
|
||||||
###> symfony/sendgrid-mailer ###
|
|
||||||
# MAILER_DSN=sendgrid://KEY@default
|
|
||||||
###< symfony/sendgrid-mailer ###
|
|
||||||
|
|
||||||
###> mercure ###
|
|
||||||
# Internal hub URL used by the PHP app (reachable from the php container)
|
|
||||||
MERCURE_URL=http://mercure/.well-known/mercure
|
|
||||||
# Public hub URL used by browsers
|
|
||||||
MERCURE_PUBLIC_URL=http://localhost:8090/.well-known/mercure
|
|
||||||
# Shared secret for signing JWTs (dev only). In prod, set via real env/secrets.
|
|
||||||
MERCURE_JWT_SECRET=!ChangeThisMercureJWT!
|
|
||||||
# Base URL for Mercure topics. Use .dev in development; override to .com in prod via .env.prod or real env.
|
|
||||||
MERCURE_TOPIC_BASE=https://escapepage.dev
|
|
||||||
###< mercure ###
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
###> symfony/framework-bundle ###
|
|
||||||
APP_SECRET=620e9ce5f88a714b636179eb39d5be4f
|
|
||||||
###< symfony/framework-bundle ###
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
### Compiled or real environment variables should be used in production.
|
|
||||||
### Configure MAILER_DSN to use SendGrid API transport.
|
|
||||||
### Prefer storing SENDGRID_API_KEY using Symfony Secrets or real env vars.
|
|
||||||
|
|
||||||
###> symfony/mailer ###
|
|
||||||
# Example using SendGrid API key (replace with real secret via vault/secrets):
|
|
||||||
# SENDGRID_API_KEY=SG.xxxxx
|
|
||||||
MAILER_DSN=sendgrid+api://%env(resolve:SENDGRID_API_KEY)%@default
|
|
||||||
###< symfony/mailer ###
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# define your env variables for the test env here
|
|
||||||
KERNEL_CLASS='App\Kernel'
|
|
||||||
APP_SECRET='$ecretf0rt3st'
|
|
||||||
+18
-1
@@ -5,7 +5,7 @@ services:
|
|||||||
php:
|
php:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: php/Dockerfile
|
dockerfile: docker/php/Dockerfile
|
||||||
container_name: escapepage-php
|
container_name: escapepage-php
|
||||||
volumes:
|
volumes:
|
||||||
- ../:/var/www/html:delegated
|
- ../:/var/www/html:delegated
|
||||||
@@ -18,6 +18,23 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
php-worker:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: docker/php/Dockerfile
|
||||||
|
container_name: escapepage-php-worker
|
||||||
|
volumes:
|
||||||
|
- ../:/var/www/html:delegated
|
||||||
|
environment:
|
||||||
|
APP_ENV: dev
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
- mercure
|
||||||
|
command: ["php", "bin/console", "messenger:consume", "async", "-vv"]
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:1.29.4-alpine
|
image: nginx:1.29.4-alpine
|
||||||
container_name: escapepage-nginx
|
container_name: escapepage-nginx
|
||||||
|
|||||||
+13
-4
@@ -1,11 +1,20 @@
|
|||||||
FROM php:8.5.1-fpm-alpine3.23
|
FROM php:8.3-fpm-alpine
|
||||||
|
|
||||||
# Install system deps
|
# Install system deps
|
||||||
RUN apk add --no-cache bash git icu-dev libzip-dev oniguruma-dev
|
RUN apk add --no-cache \
|
||||||
|
bash \
|
||||||
|
git \
|
||||||
|
icu-dev \
|
||||||
|
libzip-dev \
|
||||||
|
oniguruma-dev \
|
||||||
|
g++ \
|
||||||
|
make \
|
||||||
|
nodejs \
|
||||||
|
npm
|
||||||
|
|
||||||
# Install PHP extensions
|
# Install PHP extensions
|
||||||
RUN docker-php-ext-configure intl \
|
RUN docker-php-ext-configure intl \
|
||||||
&& docker-php-ext-install -j$(nproc) intl pdo pdo_mysql opcache
|
&& docker-php-ext-install -j$(nproc) intl pdo pdo_mysql opcache zip
|
||||||
|
|
||||||
# Install composer
|
# Install composer
|
||||||
ENV COMPOSER_ALLOW_SUPERUSER=1 \
|
ENV COMPOSER_ALLOW_SUPERUSER=1 \
|
||||||
@@ -13,7 +22,7 @@ ENV COMPOSER_ALLOW_SUPERUSER=1 \
|
|||||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
# Configure PHP
|
# Configure PHP
|
||||||
COPY php.ini $PHP_INI_DIR/conf.d/zz-custom.ini
|
COPY docker/php/php.ini $PHP_INI_DIR/conf.d/zz-custom.ini
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
|||||||
+26
-9
@@ -66,12 +66,15 @@ dc up "${BUILD_ARGS[@]}"
|
|||||||
# Helper to run commands in php container
|
# Helper to run commands in php container
|
||||||
pexec() { dc exec -T php "$@"; }
|
pexec() { dc exec -T php "$@"; }
|
||||||
|
|
||||||
# Wait for database to be healthy (mariadb)
|
# Wait for database to be healthy (mariadb/mysql)
|
||||||
printf "Waiting for database to be healthy..."
|
printf "Waiting for database to be healthy..."
|
||||||
# Use docker inspect health status
|
# Use docker inspect health status
|
||||||
DB_HEALTH=""
|
DB_HEALTH=""
|
||||||
for i in {1..60}; do
|
for i in {1..60}; do
|
||||||
DB_HEALTH=$(docker inspect -f '{{.State.Health.Status}}' "$(docker ps --filter name=_database_ --format '{{.ID}}' | head -n1)" 2>/dev/null || true)
|
DB_ID=$(dc ps -q database 2>/dev/null || true)
|
||||||
|
if [ -n "$DB_ID" ]; then
|
||||||
|
DB_HEALTH=$(docker inspect -f '{{.State.Health.Status}}' "$DB_ID" 2>/dev/null || true)
|
||||||
|
fi
|
||||||
if [ "$DB_HEALTH" = "healthy" ]; then
|
if [ "$DB_HEALTH" = "healthy" ]; then
|
||||||
echo " OK"
|
echo " OK"
|
||||||
break
|
break
|
||||||
@@ -79,7 +82,7 @@ for i in {1..60}; do
|
|||||||
printf "."
|
printf "."
|
||||||
sleep 2
|
sleep 2
|
||||||
if [ "$i" -eq 60 ]; then
|
if [ "$i" -eq 60 ]; then
|
||||||
echo "\nWarning: database health check not healthy yet, continuing anyway."
|
echo -e "\nWarning: database health check not healthy yet, continuing anyway."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -100,11 +103,23 @@ if grep -q '^APP_SECRET=$' "$ROOT_DIR/.env" 2>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Prepare DB
|
# Prepare DB
|
||||||
pexec php bin/console doctrine:database:create --if-not-exists || true
|
echo "Creating database if it doesn't exist..."
|
||||||
pexec php bin/console doctrine:migrations:migrate -n || true
|
pexec php bin/console doctrine:database:create --if-not-exists
|
||||||
|
echo "Running migrations..."
|
||||||
|
pexec php bin/console doctrine:migrations:migrate -n
|
||||||
|
|
||||||
# Import JS deps (Importmap/Asset Mapper)
|
# Import JS deps (Importmap/Asset Mapper)
|
||||||
|
if [ -f "$ROOT_DIR/importmap.php" ]; then
|
||||||
pexec php bin/console importmap:install || true
|
pexec php bin/console importmap:install || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build assets if using Webpack Encore
|
||||||
|
if [ -f "$ROOT_DIR/package.json" ]; then
|
||||||
|
echo "Installing npm dependencies..."
|
||||||
|
pexec npm install
|
||||||
|
echo "Building assets..."
|
||||||
|
pexec npm run build
|
||||||
|
fi
|
||||||
|
|
||||||
APP_URL=http://localhost:8080
|
APP_URL=http://localhost:8080
|
||||||
MAILPIT_URL=http://localhost:8025
|
MAILPIT_URL=http://localhost:8025
|
||||||
@@ -117,10 +132,12 @@ Open the app: $APP_URL
|
|||||||
Mailpit (dev): $MAILPIT_URL
|
Mailpit (dev): $MAILPIT_URL
|
||||||
|
|
||||||
Common commands:
|
Common commands:
|
||||||
(cd docker && $DOCKER_COMPOSE logs -f nginx)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f nginx)
|
||||||
(cd docker && $DOCKER_COMPOSE logs -f php)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php)
|
||||||
(cd docker && $DOCKER_COMPOSE exec php bash)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php-worker)
|
||||||
(cd docker && $DOCKER_COMPOSE down)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php bash)
|
||||||
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php npm run watch)
|
||||||
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE down)
|
||||||
|
|
||||||
You can re-run this script any time. Use --no-build to skip rebuilding images.
|
You can re-run this script any time. Use --no-build to skip rebuilding images.
|
||||||
EOT
|
EOT
|
||||||
|
|||||||
Reference in New Issue
Block a user