forked from gCubeSystem/conductor-setup
added support for cluster_replacement and worker nodes
This commit is contained in:
parent
b3648e608c
commit
a01fb2bbb6
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
conductor_workers_server: http://conductor-dev.int.d4science.net/api
|
||||||
|
|
||||||
|
conductor_workers: [{service: 'base', image: 'nubisware/nubisware-conductor-worker-py-base', replicas: 2}, {service: 'provisioning', image: 'nubisware/nubisware-conductor-worker-py-provisioning', replicas: 2 } ]
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
- name: Generate conductor-workers-swarm
|
||||||
|
template:
|
||||||
|
src: templates/conductor-workers-swarm.yaml.j2
|
||||||
|
dest: "{{ target_path }}/conductor-workers-swarm.yaml"
|
||||||
|
- name: Generate configs
|
||||||
|
template:
|
||||||
|
src: templates/config.cfg.j2
|
||||||
|
dest: "{{ target_path }}/{{ item.service }}-config.cfg"
|
||||||
|
loop: "{{ conductor_workers }}"
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
version: '3.6'
|
||||||
|
|
||||||
|
services:
|
||||||
|
{% for workers in conductor_workers %}
|
||||||
|
{{ workers.service }}:
|
||||||
|
environment:
|
||||||
|
CONDUCTOR_SERVER: {{ conductor_workers_server }}
|
||||||
|
configs:
|
||||||
|
- source: {{workers.service}}-config
|
||||||
|
target: /app/config.cfg
|
||||||
|
image: '{{ workers.image }}'
|
||||||
|
networks:
|
||||||
|
- {{ conductor_network }}
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: {{ workers.replicas }}
|
||||||
|
placement:
|
||||||
|
constraints: [node.role == worker]
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
delay: 5s
|
||||||
|
max_attempts: 3
|
||||||
|
window: 120s
|
||||||
|
logging:
|
||||||
|
driver: "journald"
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
networks:
|
||||||
|
{{ conductor_network }}:
|
||||||
|
|
||||||
|
configs:
|
||||||
|
{% for workers in conductor_workers %}
|
||||||
|
{{workers.service}}-config:
|
||||||
|
file: {{workers.service}}-config.cfg
|
||||||
|
{% endfor %}
|
|
@ -0,0 +1,9 @@
|
||||||
|
[common]
|
||||||
|
loglevel = {{ item.get('loglevel', 'info') }}
|
||||||
|
#server =
|
||||||
|
threads = 3
|
||||||
|
pollrate = .1
|
||||||
|
{% if "domain" in item.keys() %}
|
||||||
|
domain={{ item.domain }}
|
||||||
|
{% endif %}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- common
|
||||||
|
- cluster-replacement
|
||||||
|
- postgres
|
||||||
|
- elasticsearch
|
||||||
|
- conductor
|
||||||
|
tasks:
|
||||||
|
- name: Start postgres and es
|
||||||
|
docker_stack:
|
||||||
|
name: conductor
|
||||||
|
state: present
|
||||||
|
compose:
|
||||||
|
- "{{ target_path }}/postgres-swarm.yaml"
|
||||||
|
- "{{ target_path }}/elasticsearch-swarm.yaml"
|
||||||
|
- name: Waiting for postgres and ES DBs
|
||||||
|
pause:
|
||||||
|
seconds: 10
|
||||||
|
|
||||||
|
- name: Start conductor
|
||||||
|
docker_stack:
|
||||||
|
name: conductor
|
||||||
|
state: present
|
||||||
|
compose:
|
||||||
|
- "{{ target_path }}/conductor-swarm.yaml"
|
||||||
|
|
||||||
|
- name: Start haproxy
|
||||||
|
docker_stack:
|
||||||
|
name: haproxy
|
||||||
|
state: present
|
||||||
|
compose:
|
||||||
|
- "{{ target_path }}/haproxy-swarm.yaml"
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- common
|
||||||
|
- workers
|
||||||
|
#tasks:
|
||||||
|
#- name: Start postgres and es
|
||||||
|
#docker_stack:
|
||||||
|
# name: conductor
|
||||||
|
# state: present
|
||||||
|
# compose:
|
||||||
|
# - "{{ target_path }}/postgres-swarm.yaml"
|
||||||
|
# - "{{ target_path }}/elasticsearch-swarm.yaml"
|
||||||
|
#- name: Waiting for postgres and ES DBs
|
||||||
|
#pause:
|
||||||
|
# seconds: 10
|
||||||
|
|
||||||
|
#- name: Start conductor
|
||||||
|
#docker_stack:
|
||||||
|
# name: conductor
|
||||||
|
# state: present
|
||||||
|
# compose:
|
||||||
|
# - "{{ target_path }}/conductor-swarm.yaml"
|
Loading…
Reference in New Issue