From 3be2659aa19abfb7e676d33e9e7e1357c790a383 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 24 Aug 2022 21:06:48 +0200 Subject: [PATCH] Make service addressable by zones --- .../config/bottin/config.json.tpl | 0 cluster/prod/app/core/deploy/core.hcl | 173 +++++++++++++++++- .../secrets/directory/ldap_base_dn | 0 .../prod/app/directory/deploy/directory.hcl | 140 -------------- .../app/frontend/deploy/frontend-tricot.hcl | 90 --------- .../config/guichet/config.json.tpl | 2 +- cluster/prod/app/guichet/deploy/directory.hcl | 56 ++++++ .../secrets/directory/guichet/mail_domain | 0 .../secrets/directory/guichet/mail_from | 0 .../secrets/directory/guichet/s3_access_key | 0 .../secrets/directory/guichet/s3_bucket | 0 .../secrets/directory/guichet/s3_endpoint | 0 .../secrets/directory/guichet/s3_region | 0 .../secrets/directory/guichet/s3_secret_key | 0 .../secrets/directory/guichet/smtp_pass | 0 .../secrets/directory/guichet/smtp_server | 0 .../secrets/directory/guichet/smtp_user | 0 .../secrets/directory/guichet/web_hostname | 0 cluster/prod/app/plume/deploy/plume.hcl | 2 +- cluster/prod/ssh_config | 12 +- ssh_known_hosts | 3 + 21 files changed, 234 insertions(+), 244 deletions(-) rename cluster/prod/app/{directory => core}/config/bottin/config.json.tpl (100%) rename cluster/prod/app/{directory => core}/secrets/directory/ldap_base_dn (100%) delete mode 100644 cluster/prod/app/directory/deploy/directory.hcl delete mode 100644 cluster/prod/app/frontend/deploy/frontend-tricot.hcl rename cluster/prod/app/{directory => guichet}/config/guichet/config.json.tpl (95%) create mode 100644 cluster/prod/app/guichet/deploy/directory.hcl rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/mail_domain (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/mail_from (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/s3_access_key (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/s3_bucket (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/s3_endpoint (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/s3_region (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/s3_secret_key (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/smtp_pass (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/smtp_server (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/smtp_user (100%) rename cluster/prod/app/{directory => guichet}/secrets/directory/guichet/web_hostname (100%) diff --git a/cluster/prod/app/directory/config/bottin/config.json.tpl b/cluster/prod/app/core/config/bottin/config.json.tpl similarity index 100% rename from cluster/prod/app/directory/config/bottin/config.json.tpl rename to cluster/prod/app/core/config/bottin/config.json.tpl diff --git a/cluster/prod/app/core/deploy/core.hcl b/cluster/prod/app/core/deploy/core.hcl index 274cb5b..3625993 100644 --- a/cluster/prod/app/core/deploy/core.hcl +++ b/cluster/prod/app/core/deploy/core.hcl @@ -3,13 +3,8 @@ job "core" { type = "system" priority = 90 - constraint { - attribute = "${attr.cpu.arch}" - value = "amd64" - } - update { - max_parallel = 1 + max_parallel = 1 stagger = "1m" } @@ -69,4 +64,170 @@ EOH } } } + + group "tricot" { + constraint { + distinct_property = "${meta.site}" + value = "1" + } + + network { + port "http_port" { static = 80 } + port "https_port" { static = 443 } + } + + task "server" { + driver = "docker" + + config { + image = "lxpz/amd64_tricot:42" + network_mode = "host" + readonly_rootfs = true + ports = [ "http_port", "https_port" ] + volumes = [ + "secrets:/etc/tricot", + ] + } + + resources { + cpu = 2000 + memory = 200 + } + + restart { + interval = "30m" + attempts = 2 + delay = "15s" + mode = "delay" + } + + template { + data = "{{ key \"secrets/consul/consul-ca.crt\" }}" + destination = "secrets/consul-ca.crt" + } + + template { + data = "{{ key \"secrets/consul/consul-client.crt\" }}" + destination = "secrets/consul-client.crt" + } + + template { + data = "{{ key \"secrets/consul/consul-client.key\" }}" + destination = "secrets/consul-client.key" + } + + template { + data = <