Quellcode durchsuchen

configure docker network and fix main ips

Olivier Massot vor 2 Jahren
Ursprung
Commit
40541324a1
1 geänderte Dateien mit 63 neuen und 5 gelöschten Zeilen
  1. 63 5
      docker-compose.yml

+ 63 - 5
docker-compose.yml

@@ -11,6 +11,8 @@ services:
     ports:
       - 80:80
       - 443:443
+    networks:
+      - network
     volumes:
       - /var/run/docker.sock:/tmp/docker.sock:ro
       - /etc/nginx/vhost.d
@@ -34,20 +36,22 @@ services:
       - ./apps/metabase:/usr/metabase:cached
     environment:
       MYSQL_ROOT_PASSWORD: ${MYSQL_PASS}
+    networks:
+      - network
 
   nginx:
     hostname: nginx
     container_name: nginx
     image: nginx:alpine
-    networks:
-      default:
-        aliases:
-          - docker.nginx.opentalent.fr
     volumes:
       - ./apps/opentalent-platform/web:/var/www/html/web:cached
       - ./docker/nginx/site_php70.conf:/etc/nginx/conf.d/default.conf:cached
     environment:
       - VIRTUAL_HOST=${API_VIRTUAL_HOST}
+    networks:
+      network:
+        aliases:
+          - docker.nginx.opentalent.fr
     depends_on:
       - php70
 
@@ -69,6 +73,9 @@ services:
       - ./apps/opentalent-platform:/var/www/html:rw,cached
       - appcache:/var/www/html/var/cache
       - applog:/var/www/html/var/logs
+    networks:
+      network:
+        ipv4_address: 172.20.1.1
     depends_on:
       - db
       - es
@@ -84,6 +91,8 @@ services:
       - ./docker/nginx/site_ap2i.conf:/etc/nginx/conf.d/default.conf:cached
     environment:
       - VIRTUAL_HOST=${AP2I_VIRTUAL_HOST}
+    networks:
+      - network
     depends_on:
       - ap2i
 
@@ -107,6 +116,9 @@ services:
       - ./apps/ap2i:/var/www/html:rw,cached
       - appcache5:/var/www/html/var/cache
       - applog5:/var/www/html/var/logs
+    networks:
+      network:
+        ipv4_address: 172.20.2.1
     depends_on:
       - db
       - es
@@ -129,6 +141,9 @@ services:
       - mercure_data:/data
       - mercure_config:/config
       - ./docker/mercure/caddy:/etc/caddy:cached
+    networks:
+      network:
+        ipv4_address: 172.20.4.0
 
   python39:
     hostname: python39
@@ -141,6 +156,9 @@ services:
     restart: always
     volumes:
       - ./apps/python-scripts:/root/scripts:cached
+    networks:
+      network:
+        ipv4_address: 172.20.4.1
     depends_on:
       - db
       - nginx-proxy
@@ -162,6 +180,9 @@ services:
       - VIRTUAL_PORT=${ADMIN_PORT}
       - NODE_ENV=docker
       - HTTPS_METHOD=noredirect
+    networks:
+      network:
+        ipv4_address: 172.20.1.2
     depends_on:
       - nginx
 
@@ -183,6 +204,9 @@ services:
       - VIRTUAL_PORT=${APP_PORT}
       - NODE_ENV=docker
       - HTTPS_METHOD=noredirect
+    networks:
+      network:
+        ipv4_address: 172.20.2.2
     depends_on:
       - nginx_new
 
@@ -203,6 +227,9 @@ services:
       - VIRTUAL_PORT=${APP_V3_PORT}
       - NODE_ENV=development
       - HTTPS_METHOD=noredirect
+    networks:
+      network:
+        ipv4_address: 172.20.2.3
     depends_on:
       - nginx_new
 
@@ -223,6 +250,9 @@ services:
       - VIRTUAL_PORT=${FRAMES_PORT}
       - NODE_ENV=docker
       - HTTPS_METHOD=noredirect
+    networks:
+      network:
+        ipv4_address: 172.20.2.4
     depends_on:
       - nginx_new
 
@@ -251,6 +281,8 @@ services:
     environment:
       - VIRTUAL_HOST=${PORTAIL_VIRTUAL_HOST}
       - HTTPS_METHOD=noredirect
+    networks:
+      - network
     depends_on:
       - nginx
 
@@ -264,7 +296,8 @@ services:
         - COMPOSER_HASH=${COMPOSER_HASH}
     restart: always
     networks:
-      default:
+      network:
+        ipv4_address: 172.20.3.1
         aliases:
           - docker.sub.opentalent.fr
           - docker.sub.customdomain.fr
@@ -299,6 +332,8 @@ services:
       - ./apps/opentalent-config:/var/source/config:cached
     environment:
       - VIRTUAL_HOST=${V59_VIRTUAL_HOST}
+    networks:
+      - network
     depends_on:
       - nginx
 
@@ -312,6 +347,8 @@ services:
 #      - MB_DB_FILE=./metabase-data/metabase.db
       - VIRTUAL_HOST=${METABASE_VIRTUAL_HOST}
       - VIRTUAL_PORT=${METABASE_PORT}
+    networks:
+      - network
     depends_on:
       - db
 
@@ -333,6 +370,8 @@ services:
       memlock:
         soft: -1
         hard: -1
+    networks:
+      - network
 
   thumbor:
     hostname: thumbor
@@ -342,6 +381,8 @@ services:
     environment:
       - VIRTUAL_HOST=${THUMBOR_VIRTUAL_HOST}
       - LOADER=thumbor.loaders.file_loader
+    networks:
+      - network
     #    volumes:
     #      - ./apps/opentalent-platform/web/files:/data/loader:cached
 
@@ -352,6 +393,8 @@ services:
     environment:
       - VIRTUAL_HOST=${PHPMYADMIN_VIRTUAL_HOST}
     restart: always
+    networks:
+      - network
     depends_on:
       - db
 
@@ -372,6 +415,8 @@ services:
       - VIRTUAL_HOST=${MAILCATCHER_VIRTUAL_HOST}
       - VIRTUAL_PORT=${MAILCATCHER_PORT}
       - HTTPS_METHOD=noredirect
+    networks:
+      - network
     depends_on:
       - nginx-proxy
 
@@ -387,6 +432,8 @@ services:
       - BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}
       - VIRTUAL_HOST=${BLACK_FIRE_VIRTUAL_HOST}
       - VIRTUAL_PORT=${BLACK_FIRE_PORT}
+    networks:
+      - network
     depends_on:
       - php70
       - ap2i
@@ -397,6 +444,8 @@ services:
     image: nginx:alpine
     volumes:
       - ./apps/api-doc:/usr/share/nginx/html
+    networks:
+      - network
     environment:
       - VIRTUAL_HOST=${PHPDOC_VIRTUAL_HOST}
     #docker run --rm -v /opt/opentalent/apps/api/src/:/data -v /opt/opentalent/apps/api-doc:/output phpdoc/phpdoc -d /data -t /output
@@ -409,6 +458,15 @@ services:
       - ./apps/admin-doc:/usr/share/nginx/html
     environment:
       - VIRTUAL_HOST=${JSDOC_VIRTUAL_HOST}
+    networks:
+      - network
+
+
+networks:
+  network:
+    ipam:
+      config:
+        - subnet: 172.20.0.0/16
 
 volumes:
   mysqldata: ~