Skip to content

Commit

Permalink
✨ Improve docker, compose and VSCode debug (#56)
Browse files Browse the repository at this point in the history
Signed-off-by: mathieu.brunot <[email protected]>
  • Loading branch information
madmath03 authored Dec 4, 2021
1 parent b1755d6 commit f38b799
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 188 deletions.
11 changes: 9 additions & 2 deletions .env_template
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ APP_SMTP_PASSWD=
[email protected]

# 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`
Expand Down Expand Up @@ -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=
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 13 additions & 13 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -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= \
Expand All @@ -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 \
Expand Down
26 changes: 13 additions & 13 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -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= \
Expand All @@ -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 \
Expand Down
28 changes: 14 additions & 14 deletions Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -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= \
Expand All @@ -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
Expand Down
91 changes: 48 additions & 43 deletions docker-compose.apache.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -381,7 +387,6 @@ services:
memswap_limit: 1024M
expose:
- '5672'
- '15692'
networks:
app_internal_network:
aliases:
Expand Down
Loading

0 comments on commit f38b799

Please sign in to comment.