merged support for cluster replacement with postgres persistence

This commit is contained in:
Marco Lettere 2020-11-04 18:04:23 +01:00
parent a4e7a98692
commit b3648e608c
4 changed files with 19 additions and 9 deletions

View File

@ -21,7 +21,7 @@ haproxy_docker_swarm_additional_networks: []
haproxy_docker_swarm_haproxy_constraints:
- 'node.role == manager'
haproxy_docker_swarm_additional_services: [{ acl_name: 'conductor-server', acl_rule: 'hdr_dom(host) -i conductor-server.int.d4science.net', stack_name: 'conductor', service_name: 'conductor-server', service_replica_num: '2', service_port: '8080', service_overlay_network: 'conductor-network', stick_sessions: False, stick_on_cookie: True, stick_cookie: 'JSESSIONID', stick_table: 'type ip size 2m expire 180m', balance_type: 'roundrobin', backend_options: '', http_check_enabled: True, http_check: 'meth GET uri /api/health ver HTTP/1.1 hdr Host localhost', http_check_expect: 'rstatus (2|3)[0-9][0-9]' }, { acl_name: 'conductor-ui', acl_rule: 'hdr_dom(host) -i conductor-ui.int.d4science.net', stack_name: 'conductor', service_name: 'conductor-ui', service_replica_num: '2', service_port: '5000', service_overlay_network: 'conductor-network', stick_sessions: False, stick_on_cookie: True, stick_cookie: 'JSESSIONID', stick_table: 'type ip size 2m expire 180m', balance_type: 'roundrobin', backend_options: '', http_check_enabled: True, http_check: 'meth GET uri / ver HTTP/1.1 hdr Host localhost', http_check_expect: 'rstatus (2|3)[0-9][0-9]' }]
haproxy_docker_swarm_additional_services: [{ acl_name: 'conductor-server', acl_rule: 'hdr_dom(host) -i conductor-dev.int.d4science.net', stack_name: 'conductor', service_name: 'conductor-server', service_replica_num: '2', service_port: '8080', service_overlay_network: 'conductor-network', stick_sessions: False, stick_on_cookie: True, stick_cookie: 'JSESSIONID', stick_table: 'type ip size 2m expire 180m', balance_type: 'roundrobin', backend_options: '', http_check_enabled: True, http_check: 'meth GET uri /api/health ver HTTP/1.1 hdr Host localhost', http_check_expect: 'rstatus (2|3)[0-9][0-9]' }, { acl_name: 'conductor-ui', acl_rule: 'hdr_dom(host) -i conductorui-dev.int.d4science.net', stack_name: 'conductor', service_name: 'conductor-ui', service_replica_num: '2', service_port: '5000', service_overlay_network: 'conductor-network', stick_sessions: False, stick_on_cookie: True, stick_cookie: 'JSESSIONID', stick_table: 'type ip size 2m expire 180m', balance_type: 'roundrobin', backend_options: '', http_check_enabled: True, http_check: 'meth GET uri / ver HTTP/1.1 hdr Host localhost', http_check_expect: 'rstatus (2|3)[0-9][0-9]' }]
# - { acl_name: 'service', acl_rule: 'hdr_dom(host) -i service.example.com', stack_name: 'stack', service_name: 'service', service_replica_num: '1', service_port: '9999', service_overlay_network: 'service-network', stick_sessions: False, stick_on_cookie: True, stick_cookie: 'JSESSIONID', stick_table: 'type ip size 2m expire 180m', balance_type: 'roundrobin', backend_options: '', http_check_enabled: True, http_check: 'meth HEAD uri / ver HTTP/1.1 hdr Host localhost', http_check_expect: 'rstatus (2|3)[0-9][0-9]', allowed_networks: '192.168.1.0/24 192.168.2.0/24' }
haproxy_default_port: 80

View File

@ -1,4 +1,4 @@
---
target_path: /tmp/conductor_stack_postgres
target_path: /tmp/conductor_stack_postgres_cluster_replacement
conductor_network: conductor-network
init_db: True

View File

@ -1,4 +1,12 @@
---
#- name: Display switches
# debug:
# msg: "Cluster replacement {{ cluster_replacement }}"
#- name: Display switches
# debug:
# msg: "Negative condition {{(cluster_replacement is not defined or not cluster_replacement) or (cluster_check is not defined or not cluster_check)}}"
- name: Generate conductor-swarm
template:
src: templates/conductor-swarm.yaml.j2

View File

@ -1,5 +1,7 @@
version: '3.6'
{% set clustered = (cluster_replacement is defined and cluster_replacement) or (cluster_check is defined and cluster_check) %}
services:
conductor-server:
environment:
@ -7,17 +9,17 @@ services:
image: nubisware/conductor-server
networks:
- {{ conductor_network }}
{% if (cluster_replacement is defined and cluster_replacement) or (cluster_check is defined and cluster_check) %}
{% if clustered %}
- {{ haproxy_docker_overlay_network }}
{% endif %}
{% if (cluster_replacement is not defined or not cluster_replacement) or (cluster_check is not defined or not cluster_check) %}
{% if not clustered %}
ports:
- "8080:8080"
{% endif %}
deploy:
mode: replicated
replicas: {{ conductor_replicas }}
{% if (cluster_replacement is defined and cluster_replacement) or (cluster_check is defined and cluster_check) %}
{% if clustered %}
endpoint_mode: dnsrr
{% endif %}
placement:
@ -40,17 +42,17 @@ services:
image: nubisware/conductor-ui
networks:
- {{ conductor_network }}
{% if (cluster_replacement is defined and cluster_replacement) or (cluster_check is defined and cluster_check) %}
{% if clustered %}
- {{ haproxy_docker_overlay_network }}
{% endif %}
{% if (cluster_replacement is not defined or not cluster_replacement) or (cluster_check is not defined or not cluster_check) %}
{% if not clustered %}
ports:
- "5000:5000"
{% endif %}
deploy:
mode: replicated
replicas: {{ conductor_replicas }}
{% if (cluster_replacement is defined and cluster_replacement) or (cluster_check is defined and cluster_check) %}
{% if clustered %}
endpoint_mode: dnsrr
{% endif %}
placement:
@ -63,7 +65,7 @@ services:
networks:
{{ conductor_network }}:
{% if (cluster_replacement is defined and cluster_replacement) or (cluster_check is defined and cluster_check) %}
{% if clustered %}
{{ haproxy_docker_overlay_network }}:
external: True
{% endif %}