From 8bcecb7bfdba664bcb039566e70b0b9f47feabc6 Mon Sep 17 00:00:00 2001 From: Mattias Michaux Date: Sat, 17 Feb 2024 23:02:26 +0100 Subject: [PATCH] Define network to prevent overlap / name collision with other running projects --- examples/basic/.env | 4 +++- examples/basic/docker-compose.yml | 12 ++++++++++++ examples/fpm-nginx/.env | 4 +++- examples/fpm-nginx/docker-compose.yml | 14 ++++++++++++++ examples/rabbitmq-worker/.env | 4 +++- examples/rabbitmq-worker/docker-compose.yml | 14 ++++++++++++++ 6 files changed, 49 insertions(+), 3 deletions(-) diff --git a/examples/basic/.env b/examples/basic/.env index e60515d..2f05cc5 100644 --- a/examples/basic/.env +++ b/examples/basic/.env @@ -1,4 +1,6 @@ -MYSQL_HOST=db +COMPOSE_PROJECT_NAME=basic +COMPOSE_NETWORK=${COMPOSE_PROJECT_NAME}-docker +MYSQL_HOST=db.${COMPOSE_NETWORK} MYSQL_PORT=3306 MYSQL_DATABASE=mautic_db MYSQL_USER=mautic_db_user diff --git a/examples/basic/docker-compose.yml b/examples/basic/docker-compose.yml index d1ae1e3..23c7457 100644 --- a/examples/basic/docker-compose.yml +++ b/examples/basic/docker-compose.yml @@ -24,6 +24,8 @@ services: interval: 5s timeout: 5s retries: 10 + networks: + - default mautic_web: image: mautic/mautic:5-apache @@ -47,6 +49,8 @@ services: depends_on: db: condition: service_healthy + networks: + - default mautic_cron: image: mautic/mautic:5-apache @@ -58,6 +62,8 @@ services: depends_on: mautic_web: condition: service_healthy + networks: + - default mautic_worker: image: mautic/mautic:5-apache @@ -69,6 +75,12 @@ services: depends_on: mautic_web: condition: service_healthy + networks: + - default volumes: mysql-data: + +networks: + default: + name: ${COMPOSE_PROJECT_NAME}-docker diff --git a/examples/fpm-nginx/.env b/examples/fpm-nginx/.env index e60515d..893e0e0 100644 --- a/examples/fpm-nginx/.env +++ b/examples/fpm-nginx/.env @@ -1,4 +1,6 @@ -MYSQL_HOST=db +COMPOSE_PROJECT_NAME=fpm-nginx +COMPOSE_NETWORK=${COMPOSE_PROJECT_NAME}-docker +MYSQL_HOST=db.${COMPOSE_NETWORK} MYSQL_PORT=3306 MYSQL_DATABASE=mautic_db MYSQL_USER=mautic_db_user diff --git a/examples/fpm-nginx/docker-compose.yml b/examples/fpm-nginx/docker-compose.yml index c9af852..e87fb84 100644 --- a/examples/fpm-nginx/docker-compose.yml +++ b/examples/fpm-nginx/docker-compose.yml @@ -25,6 +25,8 @@ services: interval: 5s timeout: 5s retries: 10 + networks: + - default nginx: image: nginx @@ -35,6 +37,8 @@ services: - mautic_web ports: - 8002:80 + networks: + - default mautic_web: image: mautic/mautic:5-fpm @@ -56,6 +60,8 @@ services: depends_on: db: condition: service_healthy + networks: + - default mautic_cron: image: mautic/mautic:5-fpm @@ -67,6 +73,8 @@ services: depends_on: mautic_web: condition: service_healthy + networks: + - default mautic_worker: image: mautic/mautic:5-fpm @@ -78,7 +86,13 @@ services: depends_on: mautic_web: condition: service_healthy + networks: + - default volumes: mysql-data: mautic-docroot: + +networks: + default: + name: ${COMPOSE_PROJECT_NAME}-docker diff --git a/examples/rabbitmq-worker/.env b/examples/rabbitmq-worker/.env index e60515d..8a4a3ab 100644 --- a/examples/rabbitmq-worker/.env +++ b/examples/rabbitmq-worker/.env @@ -1,4 +1,6 @@ -MYSQL_HOST=db +COMPOSE_PROJECT_NAME=rabbitmq-worker +COMPOSE_NETWORK=${COMPOSE_PROJECT_NAME}-docker +MYSQL_HOST=db.${COMPOSE_NETWORK} MYSQL_PORT=3306 MYSQL_DATABASE=mautic_db MYSQL_USER=mautic_db_user diff --git a/examples/rabbitmq-worker/docker-compose.yml b/examples/rabbitmq-worker/docker-compose.yml index ba5f27b..66561fe 100644 --- a/examples/rabbitmq-worker/docker-compose.yml +++ b/examples/rabbitmq-worker/docker-compose.yml @@ -24,11 +24,15 @@ services: interval: 5s timeout: 5s retries: 10 + networks: + - default rabbitmq: image: rabbitmq:3 volumes: - rabbitmq-data:/var/lib/rabbitmq + networks: + - default mautic_web: image: mautic/mautic:5-apache @@ -52,6 +56,8 @@ services: depends_on: db: condition: service_healthy + networks: + - default mautic_cron: image: mautic/mautic:5-apache @@ -63,6 +69,8 @@ services: depends_on: mautic_web: condition: service_healthy + networks: + - default mautic_worker: image: mautic/mautic:5-apache @@ -74,7 +82,13 @@ services: depends_on: mautic_web: condition: service_healthy + networks: + - default volumes: mysql-data: rabbitmq-data: + +networks: + default: + name: ${COMPOSE_PROJECT_NAME}-docker