diff --git a/.env_template b/.env_template index bf05fd3..c977478 100644 --- a/.env_template +++ b/.env_template @@ -25,8 +25,8 @@ APP_SMTP_PASSWD= APP_MAILER_FROM=test@test.com # Rabbit configuration -APP_RABBIT_USER=app -APP_RABBIT_PASSWD=Somethingv3rysecure +APP_RABBITMQ_USERNAME=app +APP_RABBITMQ_PASSWORD=Somethingv3rysecure # Authentication configuration # Generate one with `openssl rand -hex 32` @@ -67,3 +67,10 @@ APP_GRAFANA_ADMIN_PASSWD=admin # Debug settings APP_XDEBUG_IDE_KEY= + +# Blackfire settings +# https://blackfire.io/docs/up-and-running/docker +APP_BLACKFIRE_CLIENT_ID= +APP_BLACKFIRE_CLIENT_TOKEN= +APP_BLACKFIRE_SERVER_ID= +APP_BLACKFIRE_SERVER_TOKEN= diff --git a/.vscode/launch.json b/.vscode/launch.json index f601d9c..61582f6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,20 @@ // For more information visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "name": "Listen for XDebug", + "type": "php", + "request": "launch", + "port": 9003 + }, + { + "name": "Launch currently open script", + "type": "php", + "request": "launch", + "program": "${file}", + "cwd": "${fileDirname}", + "port": 9003 + }, { "name": "Listen for Xdebug on Docker App", "type": "php", diff --git a/Dockerfile.alpine b/Dockerfile.alpine index ffa731e..3fd8ab7 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -244,18 +244,19 @@ RUN set -ex; \ chmod -R g=u /var/www/html; \ mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" -ENV SF_DB_TYPE=postgresql \ - SF_DB_VERSION=10 \ - SF_DB_OPTIONS= \ - SF_DB_HOST= \ - SF_DB_PORT= \ - SF_DB_NAME=app_db \ - SF_DB_USER=root \ - SF_DB_PASSWORD= \ - SF_MAIL_TRANSPORT=smtp \ - SF_MAIL_HOST= \ - SF_MAIL_USER= \ - SF_MAIL_PASSWORD= \ +ENV DATABASE_DRIVER=postgresql \ + DATABASE_VERSION=10 \ + DATABASE_OPTIONS= \ + DATABASE_HOST= \ + DATABASE_PORT= \ + DATABASE_NAME=app_db \ + DATABASE_USERNAME=root \ + DATABASE_PASSWORD= \ + MAILER_TRANSPORT=smtp \ + MAILER_HOST= \ + MAILER_USER= \ + MAILER_PASSWORD= \ + SF_PROD=true \ SF_ADMIN_LOGIN= \ SF_ADMIN_EMAIL= \ SF_ADMIN_PASSWD= \ @@ -265,7 +266,6 @@ ENV SF_DB_TYPE=postgresql \ SF_TWITTER_URL=# \ SF_LINKEDIN_URL=# \ SF_YOUTUBE_URL=# \ - SF_PROD=true \ SF_CLEAR_CACHE= \ APP_ENV=prod \ WWW_USER_ID=82 \ diff --git a/Dockerfile.debian b/Dockerfile.debian index 01cf0af..52a2357 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -251,18 +251,19 @@ RUN set -ex; \ chmod -R g=u /var/www/html; \ mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" -ENV SF_DB_TYPE=postgresql \ - SF_DB_VERSION=10 \ - SF_DB_OPTIONS= \ - SF_DB_HOST= \ - SF_DB_PORT= \ - SF_DB_NAME=app_db \ - SF_DB_USER=root \ - SF_DB_PASSWORD= \ - SF_MAIL_TRANSPORT=smtp \ - SF_MAIL_HOST= \ - SF_MAIL_USER= \ - SF_MAIL_PASSWORD= \ +ENV DATABASE_DRIVER=postgresql \ + DATABASE_VERSION=10 \ + DATABASE_OPTIONS= \ + DATABASE_HOST= \ + DATABASE_PORT= \ + DATABASE_NAME=app_db \ + DATABASE_USERNAME=root \ + DATABASE_PASSWORD= \ + MAILER_TRANSPORT=smtp \ + MAILER_HOST= \ + MAILER_USER= \ + MAILER_PASSWORD= \ + SF_PROD=true \ SF_ADMIN_LOGIN= \ SF_ADMIN_EMAIL= \ SF_ADMIN_PASSWD= \ @@ -272,7 +273,6 @@ ENV SF_DB_TYPE=postgresql \ SF_TWITTER_URL=# \ SF_LINKEDIN_URL=# \ SF_YOUTUBE_URL=# \ - SF_PROD=true \ SF_CLEAR_CACHE= \ APP_ENV=prod \ WWW_USER_ID=33 \ diff --git a/Dockerfile.develop b/Dockerfile.develop index 5bed7f3..00e9a39 100644 --- a/Dockerfile.develop +++ b/Dockerfile.develop @@ -89,18 +89,19 @@ RUN set -ex; \ mv /root/.symfony/bin/symfony /usr/local/bin/symfony; \ symfony -V -ENV SF_DB_TYPE=sqlite \ - SF_DB_VERSION= \ - SF_DB_OPTIONS= \ - SF_DB_HOST= \ - SF_DB_PORT= \ - SF_DB_NAME=app_db_dev \ - SF_DB_USER= \ - SF_DB_PASSWORD= \ - SF_MAIL_TRANSPORT=smtp \ - SF_MAIL_HOST=127.0.0.1 \ - SF_MAIL_USER= \ - SF_MAIL_PASSWORD= \ +ENV DATABASE_DRIVER=sqlite \ + DATABASE_VERSION= \ + DATABASE_OPTIONS= \ + DATABASE_HOST= \ + DATABASE_PORT= \ + DATABASE_NAME=app_db_dev \ + DATABASE_USERNAME= \ + DATABASE_PASSWORD= \ + MAILER_TRANSPORT=smtp \ + MAILER_HOST=127.0.0.1 \ + MAILER_USER= \ + MAILER_PASSWORD= \ + SF_PROD='false' \ SF_ADMIN_LOGIN= \ SF_ADMIN_EMAIL= \ SF_ADMIN_PASSWD= \ @@ -109,8 +110,7 @@ ENV SF_DB_TYPE=sqlite \ SF_FACEBOOK_URL=# \ SF_TWITTER_URL=# \ SF_LINKEDIN_URL=# \ - SF_YOUTUBE_URL=# \ - SF_PROD='false' + SF_YOUTUBE_URL=# COPY ./cron/15min /etc/periodic/15min COPY ./cron/hourly /etc/periodic/hourly diff --git a/docker-compose.apache.test.yml b/docker-compose.apache.test.yml index 950c979..87ce1a9 100644 --- a/docker-compose.apache.test.yml +++ b/docker-compose.apache.test.yml @@ -68,14 +68,14 @@ services: - SF_ADMIN_EMAIL=${APP_ADMIN_EMAIL} - SF_ADMIN_PASSWD=${APP_ADMIN_PASSWD} # Database configuration - - SF_DB_TYPE=postgresql - - SF_DB_VERSION=${APP_DB_VERSION} - - SF_DB_OPTIONS=&charset=utf8 - - SF_DB_HOST=database - - SF_DB_PORT=5432 - - SF_DB_NAME=${APP_DB_NAME} - - SF_DB_USER=${APP_DB_USER} - - SF_DB_PASSWORD=${APP_DB_PASSWD} + - DATABASE_DRIVER=postgresql + - DATABASE_VERSION=${APP_DB_VERSION} + - DATABASE_OPTIONS=&charset=utf8 + - DATABASE_HOST=database + - DATABASE_PORT=5432 + - DATABASE_NAME=${APP_DB_NAME} + - DATABASE_USERNAME=${APP_DB_USER} + - DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION} # Mailer configuration @@ -89,12 +89,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration - MESSENGER_TRANSPORT=amqp - - SF_RABBITMQ_HOST=rabbitmq - - SF_RABBITMQ_PORT=5672 - - SF_RABBITMQ_USER=${APP_RABBIT_USER} - - SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + - MESSENGER_HOST=rabbitmq + - MESSENGER_PORT=5672 + - MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + - MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # Custom encryptor configuration @@ -109,7 +109,7 @@ services: - LDAP_AUTH_BASE_DN=${APP_LDAP_AUTH_BASE_DN} - LDAP_AUTH_USER_QUERY=(objectClass=inetOrgPerson) - LDAP_AUTH_USERNAME_ATTRIBUTE=uid - - LDAP_AUTH_EMAIL_ATTRIBUTE=mailer + - LDAP_AUTH_EMAIL_ATTRIBUTE=mail - LDAP_BIND_DN=${APP_LDAP_BIND_DN} - LDAP_BIND_SECRET=${APP_LDAP_BIND_SECRET} # LDAP Group configuration @@ -155,6 +155,12 @@ services: condition: service_healthy app_rabbitmq: condition: service_started + links: + - app_backend:backend + - app_db:database + - app_rabbitmq:rabbitmq + - app_mailer:mail + - app_ldap:ldap networks: - app_external_network - app_internal_network @@ -177,14 +183,14 @@ services: - SF_ADMIN_EMAIL=${APP_ADMIN_EMAIL} - SF_ADMIN_PASSWD=${APP_ADMIN_PASSWD} # Database configuration - - SF_DB_TYPE=postgresql - - SF_DB_VERSION=${APP_DB_VERSION} - - SF_DB_OPTIONS=&charset=utf8 - - SF_DB_HOST=database - - SF_DB_PORT=5432 - - SF_DB_NAME=${APP_DB_NAME} - - SF_DB_USER=${APP_DB_USER} - - SF_DB_PASSWORD=${APP_DB_PASSWD} + - DATABASE_DRIVER=postgresql + - DATABASE_VERSION=${APP_DB_VERSION} + - DATABASE_OPTIONS=&charset=utf8 + - DATABASE_HOST=database + - DATABASE_PORT=5432 + - DATABASE_NAME=${APP_DB_NAME} + - DATABASE_USERNAME=${APP_DB_USER} + - DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION} # Mailer configuration @@ -198,12 +204,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration - MESSENGER_TRANSPORT=amqp - - SF_RABBITMQ_HOST=rabbitmq - - SF_RABBITMQ_PORT=5672 - - SF_RABBITMQ_USER=${APP_RABBIT_USER} - - SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + - MESSENGER_HOST=rabbitmq + - MESSENGER_PORT=5672 + - MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + - MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # Custom encryptor configuration @@ -218,7 +224,7 @@ services: - LDAP_AUTH_BASE_DN=${APP_LDAP_AUTH_BASE_DN} - LDAP_AUTH_USER_QUERY=(objectClass=inetOrgPerson) - LDAP_AUTH_USERNAME_ATTRIBUTE=uid - - LDAP_AUTH_EMAIL_ATTRIBUTE=mailer + - LDAP_AUTH_EMAIL_ATTRIBUTE=mail - LDAP_BIND_DN=${APP_LDAP_BIND_DN} - LDAP_BIND_SECRET=${APP_LDAP_BIND_SECRET} # LDAP Group configuration @@ -277,14 +283,14 @@ services: - SF_ADMIN_EMAIL=${APP_ADMIN_EMAIL} - SF_ADMIN_PASSWD=${APP_ADMIN_PASSWD} # Database configuration - - SF_DB_TYPE=postgresql - - SF_DB_VERSION=${APP_DB_VERSION} - - SF_DB_OPTIONS=&charset=utf8 - - SF_DB_HOST=database - - SF_DB_PORT=5432 - - SF_DB_NAME=${APP_DB_NAME} - - SF_DB_USER=${APP_DB_USER} - - SF_DB_PASSWORD=${APP_DB_PASSWD} + - DATABASE_DRIVER=postgresql + - DATABASE_VERSION=${APP_DB_VERSION} + - DATABASE_OPTIONS=&charset=utf8 + - DATABASE_HOST=database + - DATABASE_PORT=5432 + - DATABASE_NAME=${APP_DB_NAME} + - DATABASE_USERNAME=${APP_DB_USER} + - DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION} # Mailer configuration @@ -298,12 +304,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration - MESSENGER_TRANSPORT=amqp - - SF_RABBITMQ_HOST=rabbitmq - - SF_RABBITMQ_PORT=5672 - - SF_RABBITMQ_USER=${APP_RABBIT_USER} - - SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + - MESSENGER_HOST=rabbitmq + - MESSENGER_PORT=5672 + - MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + - MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # Custom encryptor configuration @@ -318,7 +324,7 @@ services: - LDAP_AUTH_BASE_DN=${APP_LDAP_AUTH_BASE_DN} - LDAP_AUTH_USER_QUERY=(objectClass=inetOrgPerson) - LDAP_AUTH_USERNAME_ATTRIBUTE=uid - - LDAP_AUTH_EMAIL_ATTRIBUTE=mailer + - LDAP_AUTH_EMAIL_ATTRIBUTE=mail - LDAP_BIND_DN=${APP_LDAP_BIND_DN} - LDAP_BIND_SECRET=${APP_LDAP_BIND_SECRET} # LDAP Group configuration @@ -381,7 +387,6 @@ services: memswap_limit: 1024M expose: - '5672' - - '15692' networks: app_internal_network: aliases: diff --git a/docker-compose.fpm.test.yml b/docker-compose.fpm.test.yml index 7d5325e..5934ca1 100644 --- a/docker-compose.fpm.test.yml +++ b/docker-compose.fpm.test.yml @@ -67,14 +67,14 @@ services: - SF_ADMIN_EMAIL=${APP_ADMIN_EMAIL} - SF_ADMIN_PASSWD=${APP_ADMIN_PASSWD} # Database configuration - - SF_DB_TYPE=postgresql - - SF_DB_VERSION=${APP_DB_VERSION} - - SF_DB_OPTIONS=&charset=utf8 - - SF_DB_HOST=database - - SF_DB_PORT=5432 - - SF_DB_NAME=${APP_DB_NAME} - - SF_DB_USER=${APP_DB_USER} - - SF_DB_PASSWORD=${APP_DB_PASSWD} + - DATABASE_DRIVER=postgresql + - DATABASE_VERSION=${APP_DB_VERSION} + - DATABASE_OPTIONS=&charset=utf8 + - DATABASE_HOST=database + - DATABASE_PORT=5432 + - DATABASE_NAME=${APP_DB_NAME} + - DATABASE_USERNAME=${APP_DB_USER} + - DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION} # Mailer configuration @@ -88,12 +88,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration - MESSENGER_TRANSPORT=amqp - - SF_RABBITMQ_HOST=rabbitmq - - SF_RABBITMQ_PORT=5672 - - SF_RABBITMQ_USER=${APP_RABBIT_USER} - - SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + - MESSENGER_HOST=rabbitmq + - MESSENGER_PORT=5672 + - MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + - MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # Custom encryptor configuration @@ -108,7 +108,7 @@ services: - LDAP_AUTH_BASE_DN=${APP_LDAP_AUTH_BASE_DN} - LDAP_AUTH_USER_QUERY=(objectClass=inetOrgPerson) - LDAP_AUTH_USERNAME_ATTRIBUTE=uid - - LDAP_AUTH_EMAIL_ATTRIBUTE=mailer + - LDAP_AUTH_EMAIL_ATTRIBUTE=mail - LDAP_BIND_DN=${APP_LDAP_BIND_DN} - LDAP_BIND_SECRET=${APP_LDAP_BIND_SECRET} # LDAP Group configuration @@ -175,14 +175,14 @@ services: - SF_ADMIN_EMAIL=${APP_ADMIN_EMAIL} - SF_ADMIN_PASSWD=${APP_ADMIN_PASSWD} # Database configuration - - SF_DB_TYPE=postgresql - - SF_DB_VERSION=${APP_DB_VERSION} - - SF_DB_OPTIONS=&charset=utf8 - - SF_DB_HOST=database - - SF_DB_PORT=5432 - - SF_DB_NAME=${APP_DB_NAME} - - SF_DB_USER=${APP_DB_USER} - - SF_DB_PASSWORD=${APP_DB_PASSWD} + - DATABASE_DRIVER=postgresql + - DATABASE_VERSION=${APP_DB_VERSION} + - DATABASE_OPTIONS=&charset=utf8 + - DATABASE_HOST=database + - DATABASE_PORT=5432 + - DATABASE_NAME=${APP_DB_NAME} + - DATABASE_USERNAME=${APP_DB_USER} + - DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION} # Mailer configuration @@ -196,12 +196,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration - MESSENGER_TRANSPORT=amqp - - SF_RABBITMQ_HOST=rabbitmq - - SF_RABBITMQ_PORT=5672 - - SF_RABBITMQ_USER=${APP_RABBIT_USER} - - SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + - MESSENGER_HOST=rabbitmq + - MESSENGER_PORT=5672 + - MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + - MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # Custom encryptor configuration @@ -216,7 +216,7 @@ services: - LDAP_AUTH_BASE_DN=${APP_LDAP_AUTH_BASE_DN} - LDAP_AUTH_USER_QUERY=(objectClass=inetOrgPerson) - LDAP_AUTH_USERNAME_ATTRIBUTE=uid - - LDAP_AUTH_EMAIL_ATTRIBUTE=mailer + - LDAP_AUTH_EMAIL_ATTRIBUTE=mail - LDAP_BIND_DN=${APP_LDAP_BIND_DN} - LDAP_BIND_SECRET=${APP_LDAP_BIND_SECRET} # LDAP Group configuration @@ -275,14 +275,14 @@ services: - SF_ADMIN_EMAIL=${APP_ADMIN_EMAIL} - SF_ADMIN_PASSWD=${APP_ADMIN_PASSWD} # Database configuration - - SF_DB_TYPE=postgresql - - SF_DB_VERSION=${APP_DB_VERSION} - - SF_DB_OPTIONS=&charset=utf8 - - SF_DB_HOST=database - - SF_DB_PORT=5432 - - SF_DB_NAME=${APP_DB_NAME} - - SF_DB_USER=${APP_DB_USER} - - SF_DB_PASSWORD=${APP_DB_PASSWD} + - DATABASE_DRIVER=postgresql + - DATABASE_VERSION=${APP_DB_VERSION} + - DATABASE_OPTIONS=&charset=utf8 + - DATABASE_HOST=database + - DATABASE_PORT=5432 + - DATABASE_NAME=${APP_DB_NAME} + - DATABASE_USERNAME=${APP_DB_USER} + - DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION} # Mailer configuration @@ -296,12 +296,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration - MESSENGER_TRANSPORT=amqp - - SF_RABBITMQ_HOST=rabbitmq - - SF_RABBITMQ_PORT=5672 - - SF_RABBITMQ_USER=${APP_RABBIT_USER} - - SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + - MESSENGER_HOST=rabbitmq + - MESSENGER_PORT=5672 + - MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + - MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # Custom encryptor configuration @@ -316,7 +316,7 @@ services: - LDAP_AUTH_BASE_DN=${APP_LDAP_AUTH_BASE_DN} - LDAP_AUTH_USER_QUERY=(objectClass=inetOrgPerson) - LDAP_AUTH_USERNAME_ATTRIBUTE=uid - - LDAP_AUTH_EMAIL_ATTRIBUTE=mailer + - LDAP_AUTH_EMAIL_ATTRIBUTE=mail - LDAP_BIND_DN=${APP_LDAP_BIND_DN} - LDAP_BIND_SECRET=${APP_LDAP_BIND_SECRET} # LDAP Group configuration @@ -379,7 +379,6 @@ services: memswap_limit: 1024M expose: - '5672' - - '15692' networks: app_internal_network: aliases: diff --git a/docker-compose.yml b/docker-compose.yml index d59df4a..424435c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -64,14 +64,14 @@ services: - SF_ADMIN_EMAIL=${APP_ADMIN_EMAIL} - SF_ADMIN_PASSWD=${APP_ADMIN_PASSWD} # Database configuration - #- SF_DB_TYPE=postgresql - #- SF_DB_VERSION=${APP_DB_VERSION} - #- SF_DB_OPTIONS=&charset=utf8 - #- SF_DB_HOST=database - #- SF_DB_PORT=5432 - #- SF_DB_NAME=${APP_DB_NAME} - #- SF_DB_USER=${APP_DB_USER} - #- SF_DB_PASSWORD=${APP_DB_PASSWD} + #- DATABASE_DRIVER=postgresql + #- DATABASE_VERSION=${APP_DB_VERSION} + #- DATABASE_OPTIONS=&charset=utf8 + #- DATABASE_HOST=database + #- DATABASE_PORT=5432 + #- DATABASE_NAME=${APP_DB_NAME} + #- DATABASE_USERNAME=${APP_DB_USER} + #- DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION}&charset=utf8 # Mailer configuration @@ -85,12 +85,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration #- MESSENGER_TRANSPORT=amqp - #- SF_RABBITMQ_HOST=rabbitmq - #- SF_RABBITMQ_PORT=5672 - #- SF_RABBITMQ_USER=${APP_RABBIT_USER} - #- SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + #- MESSENGER_HOST=rabbitmq + #- MESSENGER_PORT=5672 + #- MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + #- MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # Custom encryptor configuration @@ -174,14 +174,14 @@ services: - APP_DEBUG=true - ENCRYPTOR_KEY=${APP_ENCRYPTOR_KEY} # Database configuration - #- SF_DB_TYPE=postgresql - #- SF_DB_VERSION=${APP_DB_VERSION} - #- SF_DB_OPTIONS=&charset=utf8 - #- SF_DB_HOST=database - #- SF_DB_PORT=5432 - #- SF_DB_NAME=${APP_DB_NAME} - #- SF_DB_USER=${APP_DB_USER} - #- SF_DB_PASSWORD=${APP_DB_PASSWD} + #- DATABASE_DRIVER=postgresql + #- DATABASE_VERSION=${APP_DB_VERSION} + #- DATABASE_OPTIONS=&charset=utf8 + #- DATABASE_HOST=database + #- DATABASE_PORT=5432 + #- DATABASE_NAME=${APP_DB_NAME} + #- DATABASE_USERNAME=${APP_DB_USER} + #- DATABASE_PASSWORD=${APP_DB_PASSWD} # Normally generated by entrypoint at runtime - DATABASE_URL=postgresql://${APP_DB_USER}:${APP_DB_PASSWD}@database:5432/${APP_DB_NAME}?serverVersion=${APP_DB_VERSION}&charset=utf8 # Mailer configuration @@ -194,12 +194,12 @@ services: - MAILER_DSN=smtp://mailer:1025 # RabbitMQ configuration #- MESSENGER_TRANSPORT=amqp - #- SF_RABBITMQ_HOST=rabbitmq - #- SF_RABBITMQ_PORT=5672 - #- SF_RABBITMQ_USER=${APP_RABBIT_USER} - #- SF_RABBITMQ_PASSWORD=${APP_RABBIT_PASSWD} + #- MESSENGER_HOST=rabbitmq + #- MESSENGER_PORT=5672 + #- MESSENGER_USERNAME=${APP_RABBITMQ_USERNAME} + #- MESSENGER_PASSWORD=${APP_RABBITMQ_PASSWORD} # Normally generated by entrypoint at runtime - - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBIT_USER}:${APP_RABBIT_PASSWD}@rabbitmq:5672/%2f/messages + - MESSENGER_TRANSPORT_DSN=amqp://${APP_RABBITMQ_USERNAME}:${APP_RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages # JWT passphrase. If not defined, container will generate passphrase and keys on startup - JWT_PASSPHRASE=${APP_JWT_PASSPHRASE} # LDAP Authentication configuration @@ -259,7 +259,7 @@ services: - APP_ENV=dev - APP_DEBUG=true # Disable database configuration - - SF_DB_TYPE= + - DATABASE_DRIVER= # Wait for it... - WAIT_FILE=app,db-migrations - WAIT_FOR=rabbitmq:5672,mailer:1025 @@ -282,7 +282,7 @@ services: - APP_ENV=dev - APP_DEBUG=true # Disable database configuration - - SF_DB_TYPE= + - DATABASE_DRIVER= # Wait for it... - WAIT_FILE=app,db-migrations - WAIT_FOR=rabbitmq:5672,mailer:1025 @@ -363,6 +363,7 @@ services: - '5672' - '15672' ports: + - "5672:5672" - "15672:15672" labels: com.symfony.server.service-prefix: "RABBITMQ" @@ -539,6 +540,28 @@ services: # - /var/lib/docker/:/var/lib/docker:ro # #- /cgroup:/cgroup:ro #doesn't work on MacOS only for Linux + app_dev_blackfire: + image: blackfire/blackfire:latest + hostname: app_dev_blackfire + container_name: app_dev_blackfire + restart: always + expose: + - '8707' + ports: + - "8707:8707" + labels: + com.symfony.server.service-prefix: "BLACKFIRE" + networks: + app_dev_external_network: + app_dev_internal_network: + aliases: + - blackfire + environment: + - BLACKFIRE_SERVER_ID=${APP_BLACKFIRE_SERVER_ID} + - BLACKFIRE_SERVER_TOKEN=${APP_BLACKFIRE_SERVER_TOKEN} + - BLACKFIRE_CLIENT_ID=${APP_BLACKFIRE_CLIENT_ID} + - BLACKFIRE_CLIENT_TOKEN=${APP_BLACKFIRE_CLIENT_TOKEN} + app_dev_mailer: image: sj26/mailcatcher:latest hostname: app_dev_mailer @@ -547,6 +570,7 @@ services: expose: - '1025' ports: + - "1025:1025" - "1080:1080" labels: com.symfony.server.service-prefix: "MAILER" @@ -569,6 +593,8 @@ services: ports: - "10389:10389" - "10636:10636" + labels: + com.symfony.server.service-prefix: "LDAP" networks: app_dev_internal_network: aliases: diff --git a/entrypoint.sh b/entrypoint.sh index d3c40aa..a259e23 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -242,41 +242,23 @@ fi # Update default parameters -if [ -f /var/www/html/app/parameters.yml ]; then - log "Updating Symfony application parameters..." - - sed -i \ - -e "s|database_host:.*|database_host: '${SF_DB_HOST}'|g" \ - -e "s|database_port:.*|database_port: '${SF_DB_PORT}'|g" \ - -e "s|database_name:.*|database_name: '${SF_DB_NAME}'|g" \ - -e "s|database_user:.*|database_user: '${SF_DB_USER}'|g" \ - -e "s|database_password:.*|database_password: '${SF_DB_PASSWORD}'|g" \ - -e "s|mailer_transport:.*|mailer_transport: '${MAILER_TRANSPORT}'|g" \ - -e "s|mailer_host:.*|mailer_host: '${MAILER_HOST}'|g" \ - -e "s|mailer_user:.*|mailer_user: '${MAILER_USER}'|g" \ - -e "s|mailer_password:.*|mailer_password: '${MAILER_PASSWORD}'|g" \ - /var/www/html/app/parameters.yml - - log "Symfony application parameters updated" -fi - if [ -z "${DATABASE_URL}" ]; then log "Initializing Symfony database URL..." - if [ "${SF_DB_TYPE}" = "sqlite" ]; then - export DATABASE_URL="sqlite://%kernel.project_dir%/var/${SF_DB_NAME:-app_db}" - elif [ -z "${SF_DB_HOST}" ] || [ -z "${SF_DB_PORT}" ] || [ -z "${SF_DB_VERSION}" ]; then - log "Cannot generate Symfony database URL without SF_DB_HOST, SF_DB_PORT and SF_DB_VERSION" - elif [ -n "${SF_DB_USER}" ] && [ -n "${SF_DB_PASSWORD}" ]; then - export DATABASE_URL="${SF_DB_TYPE}://${SF_DB_USER}:${SF_DB_PASSWORD}@${SF_DB_HOST}:${SF_DB_PORT}/${SF_DB_NAME:-app_db}?serverVersion=${SF_DB_VERSION}${SF_DB_OPTIONS}" + if [ "${DATABASE_DRIVER}" = "sqlite" ]; then + export DATABASE_URL="sqlite://%kernel.project_dir%/var/${DATABASE_NAME:-${DATABASE_DATABASE:-app_db}}" + elif [ -z "${DATABASE_HOST}" ] || [ -z "${DATABASE_PORT}" ] || [ -z "${DATABASE_VERSION}" ]; then + log "Cannot generate Symfony database URL without DATABASE_HOST, DATABASE_PORT and DATABASE_VERSION" + elif [ -n "${DATABASE_USERNAME}" ] && [ -n "${DATABASE_PASSWORD}" ]; then + export DATABASE_URL="${DATABASE_DRIVER}://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME:-${DATABASE_DATABASE:-app_db}}?serverVersion=${DATABASE_VERSION}${DATABASE_OPTIONS}" else - export DATABASE_URL="${SF_DB_TYPE}://${SF_DB_HOST}:${SF_DB_PORT}/${SF_DB_NAME:-app_db}?serverVersion=${SF_DB_VERSION}${SF_DB_OPTIONS}" + export DATABASE_URL="${DATABASE_DRIVER}://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME:-${DATABASE_DATABASE:-app_db}}?serverVersion=${DATABASE_VERSION}${DATABASE_OPTIONS}" fi log "Symfony database URL initialized" fi -if [ -z "${MAILER_DSN}" ]; then +if [ -z "${MAILER_DSN}" ] && [ -z "${MAILER_URL}" ]; then # https://symfony.com/doc/current/mailer.html log "Initializing Symfony mailer DSN..." @@ -285,23 +267,24 @@ if [ -z "${MAILER_DSN}" ]; then else export MAILER_DSN="${MAILER_TRANSPORT:-smtp}://${MAILER_HOST:-mailer}:${MAILER_PORT:-465}" fi + export MAILER_URL="${MAILER_DSN}" log "Symfony mailer DSN initialized" fi -if [ -z "${MESSENGER_TRANSPORT_DSN}" ]; then +if [ -z "${MESSENGER_TRANSPORT_DSN}" ] && [ -z "${MAILER_URL}" ]; then if [ "${MESSENGER_TRANSPORT}" = "amqp" ]; then # https://symfony.com/doc/current/messenger.html#amqp-transport log "Initializing Symfony Messenger AMQP transport..." - export MESSENGER_TRANSPORT_DSN="amqp://${SF_RABBITMQ_USER:-guest}:${SF_RABBITMQ_PASSWORD:-guest}@${SF_RABBITMQ_HOST:-rabbitmq}:${SF_RABBITMQ_PORT:-5672}/%2f/messages" + export MESSENGER_TRANSPORT_DSN="amqp://${MESSENGER_USER:-${MESSENGER_USERNAME:-guest}}:${MESSENGER_PASSWORD:-guest}@${MESSENGER_HOST:-rabbitmq}:${MESSENGER_PORT:-5672}/%2f/messages" elif [ "${MESSENGER_TRANSPORT}" = "redis" ]; then # https://symfony.com/doc/current/messenger.html#redis-transport log "Initializing Symfony Messenger Redis transport..." - export MESSENGER_TRANSPORT_DSN="redis://${SF_REDIS_HOST:-redis}:${SF_REDIS_PORT:-6379}/messages" + export MESSENGER_TRANSPORT_DSN="redis://${MESSENGER_HOST:-${MESSENGER_USERNAME:-redis}}:${MESSENGER_PORT:-6379}/messages" else # https://symfony.com/doc/current/messenger.html#doctrine-transport - log "Initializing Symfony Messenger Doctrine transport..." - export MESSENGER_TRANSPORT_DSN=doctrine://default + log "Initializing Symfony Messenger transport..." + export MESSENGER_TRANSPORT_DSN="${MESSENGER_TRANSPORT:-doctrine}://${MESSENGER_HOST:-default}" fi # XXX Call console messenger:setup-transports? @@ -315,7 +298,6 @@ if [ ! -e "config/jwt/public.pem" ] && [ -n "${JWT_PASSPHRASE}" ]; then mkdir -p config/jwt rm -f config/jwt/*.pem - export JWT_PASSPHRASE=${JWT_PASSPHRASE} openssl genpkey -out config/jwt/private.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096 -pass "pass:${JWT_PASSPHRASE}" openssl pkey -in config/jwt/private.pem -passin "pass:${JWT_PASSPHRASE}" -out config/jwt/public.pem -pubout