split config and services

This commit is contained in:
dcore94 2022-01-13 15:09:39 +01:00
parent 01611a7ff7
commit 546c594109
3 changed files with 55 additions and 27 deletions

View File

@ -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 }}'

20
swarm-config.yaml Normal file
View File

@ -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

View File

@ -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