Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
20 changes: 20 additions & 0 deletions compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ services:
- host.docker.internal:host-gateway
tty: true

php-worker:
profiles:
- donotstart

php-worker-events:
extends:
file: compose.yaml
service: php-worker
image: ${IMAGES_PREFIX:-}app-php-worker-events
build:
context: .
target: frankenphp_dev
command: ['/app/bin/console', 'messenger:consume', 'events', '-vvv', '--time-limit=60', '--limit=10', '--memory-limit=128M']
volumes:
- ./:/app
- /app/var/
depends_on:
php:
condition: service_healthy

###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###

Expand Down
7 changes: 7 additions & 0 deletions compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ services:
APP_SECRET: ${APP_SECRET}
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}

php-worker:
build:
context: .
target: frankenphp_prod
environment:
APP_SECRET: ${APP_SECRET}
15 changes: 15 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ services:
- target: 443
published: ${HTTP3_PORT:-443}
protocol: udp
depends_on:
- database
- amqp

php-worker:
image: ${IMAGES_PREFIX:-}app-php-worker
restart: unless-stopped
environment:
- RUN_MIGRATIONS=false
healthcheck:
disable: true
depends_on:
- php

# Mercure is installed as a Caddy module, prevent the Flex recipe from installing another service
###> symfony/mercure-bundle ###
Expand Down Expand Up @@ -64,6 +77,8 @@ services:
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# It might not work if `pgadmin` user with `uid=5050` which is used in contaner can't write in that directory on host file system.
# - ./docker/db_mng:/var/lib/pgadmin:rw
depends_on:
- database

amqp:
image: rabbitmq:${RABBITMQ_VERSION:-4.0.2-management}
Expand Down
3 changes: 2 additions & 1 deletion etc/frankenphp/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
composer install --prefer-dist --no-progress --no-interaction
fi

if grep -q ^DATABASE_URL= .env; then
run_migrations=${RUN_MIGRATIONS:-true}
if grep -q ^DATABASE_URL= .env && [ "$run_migrations" = "true" ]; then
echo "Waiting for database to be ready..."
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(php bin/console dbal:run-sql -q "SELECT 1" 2>&1); do
Expand Down

0 comments on commit ca09b09

Please sign in to comment.