From 546c59410939e09e2be0148d5aa1c7d5c887fe33 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Thu, 13 Jan 2022 15:09:39 +0100 Subject: [PATCH] split config and services --- site.yaml | 8 +++++++ swarm-config.yaml | 20 ++++++++++++++++++ swarm.yaml | 54 +++++++++++++++++++++++------------------------ 3 files changed, 55 insertions(+), 27 deletions(-) create mode 100644 swarm-config.yaml diff --git a/site.yaml b/site.yaml index 71a1525..07e9604 100644 --- a/site.yaml +++ b/site.yaml @@ -16,6 +16,14 @@ src: "conf/service/auth.json.j2" dest: "conf/service/auth.json" + - name: Start config swarm + docker_stack: + name: 'cdn-{{ infrastructure }}' + state: present + compose: + - "swarm-config.yaml" + when: dry is not defined or not dry|bool + - name: Start swarm docker_stack: name: 'cdn-{{ infrastructure }}' diff --git a/swarm-config.yaml b/swarm-config.yaml new file mode 100644 index 0000000..50fa2ef --- /dev/null +++ b/swarm-config.yaml @@ -0,0 +1,20 @@ +version: '3.6' + +configs: + router_conf: + file: ./conf/router/default.conf + + cdn_pep_conf: + file: ./conf/pep/default.conf + cdn_pep_baseconf: + file: ./conf/pep/nginx.conf + cdn_pep: + file: ./conf/pep/pep.js + cdn_pepconfig: + file: ./conf/pep/config.js + + cdn_conf: + file: ./conf/service/d4s-cdn.json + cdn_auth_conf: + file: ./conf/service/auth.json + diff --git a/swarm.yaml b/swarm.yaml index 7d29ff9..bad6d74 100644 --- a/swarm.yaml +++ b/swarm.yaml @@ -5,7 +5,7 @@ services: cdn-router-dev: image: nginx:stable-alpine networks: - - cdn-network + - cdn-local_cdn-network ports: - "80:80" deploy: @@ -16,13 +16,13 @@ services: delay: 10s window: 120s configs: - - source: nginx_router_conf + - source: cdn-local_router_conf target: /etc/nginx/templates/default.conf.template cdn-pep: image: nginx:stable-alpine networks: - - cdn-network + - cdn-local_cdn-network deploy: mode: replicated replicas: 2 @@ -31,20 +31,20 @@ services: delay: 10s window: 120s configs: - - source: cdn_pep_conf + - source: cdn-local_cdn_pep_conf target: /etc/nginx/templates/default.conf.template - - source: cdn_pep_baseconf + - source: cdn-local_cdn_pep_baseconf target: /etc/nginx/nginx.conf - - source: cdn_pep + - source: cdn-local_cdn_pep target: /etc/nginx/pep.js - - source: cdn_pepconfig + - source: cdn-local_cdn_pepconfig target: /etc/nginx/config.js d4s-cdn: image: nubisware/d4s-cdn networks: - - cdn-network + - cdn-local_cdn-network deploy: mode: replicated replicas: 2 @@ -53,29 +53,29 @@ services: delay: 10s window: 200s configs: - - source: cdn_conf - target: /opt/app/cdn/conf/d4s-cdn.json - - source: cdn_auth_conf - target: /opt/app/cdn/conf/auth.json + - source: cdn-local_cdn_conf + target: /opt/app/cdn/conf/d4s-cdn.json + - source: cdn-local_cdn_auth_conf + target: /opt/app/cdn/conf/auth.json networks: - cdn-network: + cdn-local_cdn-network: configs: - nginx_router_conf: - file: ./conf/router/default.conf + cdn-local_router_conf: + external: true - cdn_pep_conf: - file: ./conf/pep/default.conf - cdn_pep_baseconf: - file: ./conf/pep/nginx.conf - cdn_pep: - file: ./conf/pep/pep.js - cdn_pepconfig: - file: ./conf/pep/config.js + cdn-local_cdn_pep_conf: + external: true + cdn-local_cdn_pep_baseconf: + external: true + cdn-local_cdn_pep: + external: true + cdn-local_cdn_pepconfig: + external: true - cdn_conf: - file: ./conf/service/d4s-cdn.json - cdn_auth_conf: - file: ./conf/service/auth.json + cdn-local_cdn_conf: + external: true + cdn-local_cdn_auth_conf: + external: true