diff --git a/roles/docker-akaunting/templates/docker-compose.yml.j2 b/roles/docker-akaunting/templates/docker-compose.yml.j2 index fad87f5e..3a4c36db 100644 --- a/roles/docker-akaunting/templates/docker-compose.yml.j2 +++ b/roles/docker-akaunting/templates/docker-compose.yml.j2 @@ -18,7 +18,7 @@ services: environment: - AKAUNTING_SETUP {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-attendize/templates/docker-compose.yml.j2 b/roles/docker-attendize/templates/docker-compose.yml.j2 index 310aa3d9..c3ad7b47 100644 --- a/roles/docker-attendize/templates/docker-compose.yml.j2 +++ b/roles/docker-attendize/templates/docker-compose.yml.j2 @@ -1,5 +1,10 @@ version: '3.2' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + web: image: attendize_web:latest ports: @@ -7,9 +12,8 @@ services: volumes: - .:/usr/share/nginx/html - .:/var/www -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} maildev: - redis: worker: env_file: - ./.env @@ -17,24 +21,19 @@ services: worker: image: attendize_worker:latest -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} maildev: - redis: {% include 'templates/docker-container-networks.yml.j2' %} volumes: - .:/usr/share/nginx/html - .:/var/www -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - maildev: image: maildev/maildev ports: - "{{ mail_interface_http_port }}:1080" {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} - -{% include 'templates/docker-service-redis.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} redis: diff --git a/roles/docker-baserow/templates/docker-compose.yml.j2 b/roles/docker-baserow/templates/docker-compose.yml.j2 index 580b1864..d96a88a3 100644 --- a/roles/docker-baserow/templates/docker-compose.yml.j2 +++ b/roles/docker-baserow/templates/docker-compose.yml.j2 @@ -1,6 +1,11 @@ version: '2' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + baserow: image: baserow/baserow:1.19.1 restart: always @@ -13,11 +18,7 @@ services: ports: - "{{http_port}}:80" {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} - -{% include 'templates/docker-service-redis.yml.j2' %} - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index e29cb1ba..e0996d77 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -4,45 +4,38 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} - env_file: .env - celeryworker: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - - redis env_file: .env command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0} environment: - C_FORCE_ROOT=true volumes: - "data:${MEDIA_ROOT}" +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %} celerybeat: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - - redis env_file: .env command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %} api: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - - redis env_file: .env volumes: - "data:${MEDIA_ROOT}" #- "${STATIC_ROOT}:${STATIC_ROOT}" ports: - "5000" +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %} front: @@ -63,8 +56,6 @@ services: - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - {% include 'templates/docker-compose-volumes.yml.j2' %} data: redis: diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index 5d9604fb..c3259eda 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -28,7 +31,7 @@ services: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index f208127f..83cfac93 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -1,5 +1,10 @@ version: '3.6' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + web: image: 'gitlab/gitlab-ee:latest' restart: always @@ -32,16 +37,10 @@ services: - 'logs:/var/log/gitlab' - 'data:/var/opt/gitlab' shm_size: '256m' - depends_on: -{% if not enable_central_database %} - database: - condition: service_healthy -{% endif %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-redis.yml.j2' %} - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-compose-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} redis: diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index 4ef8ffcb..5c575d55 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: image: joomla logging: @@ -11,17 +14,12 @@ services: JOOMLA_DB_PASSWORD: "{{database_password}}" JOOMLA_DB_NAME: "{{database_databasename}}" restart: always -{% include 'templates/docker-container-depends-on.yml.j2' %} volumes: - data:/var/www/html ports: - "127.0.0.1:{{http_port}}:80" {% include 'templates/docker-container-networks.yml.j2' %} -{% if enable_central_database %} - depends_on: - database: - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index 9b62d378..f8914575 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -2,6 +2,8 @@ version: "3.7" services: +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: restart: unless-stopped image: listmonk/listmonk:latest @@ -12,8 +14,6 @@ services: volumes: - ./config.toml:/listmonk/config.toml {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-mailu/templates/docker-compose.yml.j2 b/roles/docker-mailu/templates/docker-compose.yml.j2 index 1a2caa38..102d9acd 100644 --- a/roles/docker-mailu/templates/docker-compose.yml.j2 +++ b/roles/docker-mailu/templates/docker-compose.yml.j2 @@ -11,13 +11,9 @@ services: image: ghcr.io/mailu/unbound:{{version_mailu}} env_file: mailu.env restart: always - networks: +{% include 'templates/docker-container-networks.yml.j2' %} default: ipv4_address: 192.168.203.254 - {{docker_compose_project_name}}_network: -{% if enable_central_database %} - central_{{ database_type }}_network: -{% endif %} logging: driver: journald @@ -39,13 +35,9 @@ services: volumes: - "/etc/mailu/overrides/nginx:/overrides:ro" - "/etc/mailu/certs:/certs" - depends_on: +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} resolver: condition: service_started -{% if not enable_central_database %} - database: - condition: service_healthy -{% endif %} {% include 'templates/docker-container-networks.yml.j2' %} default: webmail: @@ -60,11 +52,9 @@ services: volumes: - "admin_data:/data" - "dkim:/dkim" - depends_on: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} resolver: front: - redis: -{% include 'templates/docker-container-depends-on.yml.j2' %} logging: driver: journald dns: @@ -202,7 +192,6 @@ services: {% include 'templates/docker-container-networks.yml.j2' %} webmail: -volumes: {% include 'templates/docker-compose-volumes.yml.j2' %} smtp_queue: admin_data: diff --git a/roles/docker-mastodon/templates/docker-compose.yml.j2 b/roles/docker-mastodon/templates/docker-compose.yml.j2 index 8b714a50..a24f0bc8 100644 --- a/roles/docker-mastodon/templates/docker-compose.yml.j2 +++ b/roles/docker-mastodon/templates/docker-compose.yml.j2 @@ -14,10 +14,7 @@ services: test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] ports: - "127.0.0.1:{{http_port}}:3000" - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: - condition: service_healthy +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} volumes: - data:/mastodon/public/system logging: @@ -33,9 +30,7 @@ services: test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1'] ports: - "127.0.0.1:{{stream_port}}:4000" -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: - condition: service_healthy +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} logging: driver: journald {% include 'templates/docker-container-networks.yml.j2' %} @@ -45,10 +40,7 @@ services: restart: always env_file: .env.production command: bundle exec sidekiq - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: - condition: service_healthy +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} volumes: - data:/mastodon/public/system healthcheck: diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index 5b48e0f9..e2c398e1 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -16,12 +19,10 @@ services: MATOMO_DATABASE_DBNAME: "{{database_databasename}}" volumes: - data:/var/www/html -{% if not enable_central_database %} - depends_on: - - database -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: + +{% include 'templates/docker-compose-networks.yml.j2' %} diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 55fe6e8a..3708f2b3 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -1,7 +1,9 @@ version: '3.1' services: - + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + synapse: image: matrixdotorg/synapse:latest restart: always @@ -16,11 +18,8 @@ services: - SYNAPSE_REPORT_STATS=no ports: - "127.0.0.1:{{synapse_http_port}}:8008" -{% if not enable_central_database %} - depends_on: - - database -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} element: image: vectorim/element-web:latest @@ -29,6 +28,7 @@ services: - ./element-config.json:/app/config.json ports: - "127.0.0.1:{{element_http_port}}:80" +{% include 'templates/docker-container-networks.yml.j2' %} # bridges #mautrix-telegram: @@ -64,4 +64,6 @@ services: #telegram_bridge_data: #whatsapp_bridge_data: #facebook_bridge_data: - #instagram_bridge_data: \ No newline at end of file + #instagram_bridge_data: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index b8942f35..b228dd1b 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -1,5 +1,8 @@ version: '3.8' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -9,10 +12,9 @@ services: restart: always volumes: - data:/var/www/html -{% if not enable_central_database %} - depends_on: - - database -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} + server: logging: driver: journald @@ -25,8 +27,9 @@ services: volumes: - "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro" - "data:/var/www/html:ro" - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} - data: \ No newline at end of file + data: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index b8327bab..cbac24e7 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -1,6 +1,11 @@ version: '3' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: image: "nextcloud:{{version_nextcloud}}-fpm-alpine" restart: always @@ -13,12 +18,8 @@ services: MYSQL_USER: "{{database_username}}" MYSQL_PASSWORD: "{{database_password}}" MYSQL_HOST: {{database_host}}:3306 -{% if not enable_central_database %} - depends_on: - - database - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} web: image: nginx:alpine @@ -27,14 +28,11 @@ services: restart: always ports: - "127.0.0.1:{{http_port}}:80" - depends_on: - - application volumes: - "{{path_docker_volumes}}nextcloud/nginx.conf:/etc/nginx/nginx.conf:ro" volumes_from: - application - -{% include 'templates/docker-service-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} cron: image: "nextcloud:{{version_nextcloud}}-fpm-alpine" @@ -44,9 +42,11 @@ services: volumes: - data:/var/www/html entrypoint: /cron.sh -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: redis: + +{% include 'templates/docker-compose-networks.yml.j2' %} diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index 00db4d24..5cd95a59 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -1,18 +1,8 @@ version: "3.7" - -networks: - frontend: - backend: - -{% include 'templates/docker-compose-volumes.yml.j2' %} - data: - -x-op-restart-policy: &restart_policy - restart: unless-stopped -x-op-image: &image - image: openproject/community:${TAG:-13} + x-op-app: &app - <<: [*image, *restart_policy] + restart: unless-stopped + image: openproject/community:${TAG:-13} environment: OPENPROJECT_HTTPS: "${OPENPROJECT_HTTPS}" OPENPROJECT_HOST__NAME: "${OPENPROJECT_HOST__NAME}" @@ -27,24 +17,20 @@ x-op-app: &app IMAP_ENABLED: "${IMAP_ENABLED:-false}" volumes: - "data:/var/openproject/assets" -{% if not enable_central_database %} - - "database:/var/openproject/pgdata" -{% endif %} + # - "database:/var/openproject/pgdata" services: {% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - networks: - - backend cache: image: memcached - <<: *restart_policy - networks: - - backend + restart: unless-stopped +{% include 'templates/docker-container-networks.yml.j2' %} proxy: - <<: [*image, *restart_policy] + restart: unless-stopped + image: openproject/community:${TAG:-13} command: "./docker/prod/proxy" ports: - "${PORT}:80" @@ -53,21 +39,16 @@ services: OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}" depends_on: - web - networks: - - frontend +{% include 'templates/docker-container-networks.yml.j2' %} volumes: - "data:/var/openproject/assets" -{% if not enable_central_database %} - - "database:/var/openproject/pgdata" -{% endif %} + # - "database:/var/openproject/pgdata" Should definetly not be necessary here web: <<: *app command: "./docker/prod/web" - networks: - - frontend - - backend -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: seeder: labels: @@ -91,18 +72,16 @@ services: worker: <<: *app command: "./docker/prod/worker" - networks: - - backend -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: seeder: cron: <<: *app command: "./docker/prod/cron" - networks: - - backend -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: seeder: @@ -110,5 +89,9 @@ services: <<: *app command: "./docker/prod/seeder" restart: on-failure - networks: - - backend \ No newline at end of file +{% include 'templates/docker-container-networks.yml.j2' %} + +{% include 'templates/docker-compose-networks.yml.j2' %} + +{% include 'templates/docker-compose-volumes.yml.j2' %} + data: \ No newline at end of file diff --git a/roles/docker-peertube/templates/docker-compose.yml.j2 b/roles/docker-peertube/templates/docker-compose.yml.j2 index b505b593..fcce3a41 100644 --- a/roles/docker-peertube/templates/docker-compose.yml.j2 +++ b/roles/docker-peertube/templates/docker-compose.yml.j2 @@ -1,6 +1,11 @@ version: "3.3" services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: image: chocobozzz/peertube:production-bullseye env_file: @@ -13,21 +18,13 @@ services: - data:/data - config:/config restart: "always" - depends_on: - - redis -{% if not enable_central_database %} - - database - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} - -{% include 'templates/docker-service-redis.yml.j2' %} - - env_file: - - .env +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} assets: data: redis: - config: \ No newline at end of file + config: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index 50b69427..18ed9f77 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -14,13 +14,13 @@ services: env_file: - ./env volumes: - - "application_data:/var/www/storage" + - "data:/var/www/storage" - "bootstrap:/var/www/bootstrap" - "./env:/var/www/.env" ports: - "{{http_port}}:80" -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} worker: image: zknt/pixelfed restart: always @@ -29,7 +29,7 @@ services: env_file: - ./env volumes: - - "application_data:/var/www/storage" + - "data:/var/www/storage" - "bootstrap:/var/www/bootstrap" - "./env:/var/www/.env" entrypoint: /worker-entrypoint.sh @@ -38,11 +38,13 @@ services: interval: 60s timeout: 5s retries: 1 -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} application: +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} redis: - application_data: - bootstrap: \ No newline at end of file + data: + bootstrap: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index b05a95e0..cff1f1b2 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -17,12 +17,10 @@ services: WORDPRESS_DB_NAME: "{{database_databasename}}" volumes: - data:/var/www/html -{% if not enable_central_database %} - depends_on: - - database +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} +{% include 'templates/docker-compose-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index 90c64662..0e154c81 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -16,12 +19,8 @@ services: YOURLS_SITE: "https://{{domain}}" YOURLS_USER: "{{yourls_user}}" YOURLS_PASS: "{{yourls_user_password}}" -{% if not enable_central_database %} - depends_on: - - database +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - -volumes: - database: -{% endif %} +{% include 'templates/docker-compose-volumes-just-database.yml.j2' %} +{% include 'templates/docker-compose-networks.yml.j2' %} diff --git a/templates/docker-compose-networks.yml.j2 b/templates/docker-compose-networks.yml.j2 index b2a00705..adeb34f1 100644 --- a/templates/docker-compose-networks.yml.j2 +++ b/templates/docker-compose-networks.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml networks: {% if enable_central_database %} central_{{ database_type }}_network: diff --git a/templates/docker-compose-volumes-just-database.yml.j2 b/templates/docker-compose-volumes-just-database.yml.j2 new file mode 100644 index 00000000..23aa6977 --- /dev/null +++ b/templates/docker-compose-volumes-just-database.yml.j2 @@ -0,0 +1,5 @@ +# This needs to be included in docker-compose.yml which just contain a database volume +{% if not enable_central_database %} +volumes: + database: +{% endif %} \ No newline at end of file diff --git a/templates/docker-compose-volumes.yml.j2 b/templates/docker-compose-volumes.yml.j2 index a6055f38..4b4c3f3a 100644 --- a/templates/docker-compose-volumes.yml.j2 +++ b/templates/docker-compose-volumes.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml which contain a database and additional volumes volumes: {% if not enable_central_database %} database: diff --git a/templates/docker-container-depends-on-also-database.yml.j2 b/templates/docker-container-depends-on-also-database.yml.j2 new file mode 100644 index 00000000..809268e7 --- /dev/null +++ b/templates/docker-container-depends-on-also-database.yml.j2 @@ -0,0 +1,6 @@ +# This template needs to be included in docker-compose.yml containers which depend on a database and additional containers + depends_on: +{% if enable_central_database %} + database: + condition: service_healthy +{% endif %} \ No newline at end of file diff --git a/templates/docker-container-depends-on-database-redis.yml.j2 b/templates/docker-container-depends-on-database-redis.yml.j2 new file mode 100644 index 00000000..c73f8f77 --- /dev/null +++ b/templates/docker-container-depends-on-database-redis.yml.j2 @@ -0,0 +1,8 @@ +# This template needs to be included in docker-compose.yml contaienrs, which depend on a database, redis and optional additional volumes + depends_on: +{% if enable_central_database %} + database: + condition: service_healthy +{% endif %} + redis: + condition: service_healthy \ No newline at end of file diff --git a/templates/docker-container-depends-on.yml.j2 b/templates/docker-container-depends-on-just-database.yml.j2 similarity index 51% rename from templates/docker-container-depends-on.yml.j2 rename to templates/docker-container-depends-on-just-database.yml.j2 index d1b446a8..0b000dbf 100644 --- a/templates/docker-container-depends-on.yml.j2 +++ b/templates/docker-container-depends-on-just-database.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml contaienrs, which just depend on a database {% if enable_central_database %} depends_on: database: diff --git a/templates/docker-container-networks.yml.j2 b/templates/docker-container-networks.yml.j2 index 3596e57b..d99c2747 100644 --- a/templates/docker-container-networks.yml.j2 +++ b/templates/docker-container-networks.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml containers networks: - {{docker_compose_project_name}}_network {% if enable_central_database %} diff --git a/templates/docker-service-mariadb.yml.j2 b/templates/docker-service-mariadb.yml.j2 index 5c4fb462..9e87dcf3 100644 --- a/templates/docker-service-mariadb.yml.j2 +++ b/templates/docker-service-mariadb.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml, which depend on a mariadb database {% if not enable_central_database %} database: logging: diff --git a/templates/docker-service-postgres.yml.j2 b/templates/docker-service-postgres.yml.j2 index ebc4018b..54acbbb4 100644 --- a/templates/docker-service-postgres.yml.j2 +++ b/templates/docker-service-postgres.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml, which depend on a postgres database {% if not enable_central_database %} database: image: postgres:{{database_version}}-alpine diff --git a/templates/docker-service-redis.yml.j2 b/templates/docker-service-redis.yml.j2 index 6d951751..25aee6b8 100644 --- a/templates/docker-service-redis.yml.j2 +++ b/templates/docker-service-redis.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml, which depend on redis redis: image: redis:alpine restart: always