From 3be2659aa19abfb7e676d33e9e7e1357c790a383 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 24 Aug 2022 21:06:48 +0200 Subject: Make service addressable by zones --- .../prod/app/core/config/bottin/config.json.tpl | 26 ++++ cluster/prod/app/core/deploy/core.hcl | 173 ++++++++++++++++++++- .../prod/app/core/secrets/directory/ldap_base_dn | 1 + .../app/directory/config/bottin/config.json.tpl | 26 ---- .../app/directory/config/guichet/config.json.tpl | 34 ---- cluster/prod/app/directory/deploy/directory.hcl | 140 ----------------- .../secrets/directory/guichet/mail_domain | 1 - .../directory/secrets/directory/guichet/mail_from | 1 - .../secrets/directory/guichet/s3_access_key | 1 - .../directory/secrets/directory/guichet/s3_bucket | 1 - .../secrets/directory/guichet/s3_endpoint | 1 - .../directory/secrets/directory/guichet/s3_region | 1 - .../secrets/directory/guichet/s3_secret_key | 1 - .../directory/secrets/directory/guichet/smtp_pass | 1 - .../secrets/directory/guichet/smtp_server | 1 - .../directory/secrets/directory/guichet/smtp_user | 1 - .../secrets/directory/guichet/web_hostname | 1 - .../app/directory/secrets/directory/ldap_base_dn | 1 - .../prod/app/frontend/deploy/frontend-tricot.hcl | 90 ----------- .../app/guichet/config/guichet/config.json.tpl | 34 ++++ cluster/prod/app/guichet/deploy/directory.hcl | 56 +++++++ .../guichet/secrets/directory/guichet/mail_domain | 1 + .../guichet/secrets/directory/guichet/mail_from | 1 + .../secrets/directory/guichet/s3_access_key | 1 + .../guichet/secrets/directory/guichet/s3_bucket | 1 + .../guichet/secrets/directory/guichet/s3_endpoint | 1 + .../guichet/secrets/directory/guichet/s3_region | 1 + .../secrets/directory/guichet/s3_secret_key | 1 + .../guichet/secrets/directory/guichet/smtp_pass | 1 + .../guichet/secrets/directory/guichet/smtp_server | 1 + .../guichet/secrets/directory/guichet/smtp_user | 1 + .../guichet/secrets/directory/guichet/web_hostname | 1 + cluster/prod/app/plume/deploy/plume.hcl | 2 +- cluster/prod/ssh_config | 12 +- 34 files changed, 302 insertions(+), 315 deletions(-) create mode 100644 cluster/prod/app/core/config/bottin/config.json.tpl create mode 100644 cluster/prod/app/core/secrets/directory/ldap_base_dn delete mode 100644 cluster/prod/app/directory/config/bottin/config.json.tpl delete mode 100644 cluster/prod/app/directory/config/guichet/config.json.tpl delete mode 100644 cluster/prod/app/directory/deploy/directory.hcl delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/mail_domain delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/mail_from delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/s3_access_key delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/s3_bucket delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/s3_endpoint delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/s3_region delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/s3_secret_key delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/smtp_pass delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/smtp_server delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/smtp_user delete mode 100644 cluster/prod/app/directory/secrets/directory/guichet/web_hostname delete mode 100644 cluster/prod/app/directory/secrets/directory/ldap_base_dn delete mode 100644 cluster/prod/app/frontend/deploy/frontend-tricot.hcl create mode 100644 cluster/prod/app/guichet/config/guichet/config.json.tpl create mode 100644 cluster/prod/app/guichet/deploy/directory.hcl create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/mail_domain create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/mail_from create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/s3_access_key create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/s3_bucket create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/s3_endpoint create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/s3_region create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/s3_secret_key create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/smtp_pass create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/smtp_server create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/smtp_user create mode 100644 cluster/prod/app/guichet/secrets/directory/guichet/web_hostname (limited to 'cluster') diff --git a/cluster/prod/app/core/config/bottin/config.json.tpl b/cluster/prod/app/core/config/bottin/config.json.tpl new file mode 100644 index 0000000..844f7b7 --- /dev/null +++ b/cluster/prod/app/core/config/bottin/config.json.tpl @@ -0,0 +1,26 @@ +{ + "suffix": "{{ key "secrets/directory/ldap_base_dn" }}", + "bind": "0.0.0.0:389", + "log_level": "debug", + "acl": [ + "*,{{ key "secrets/directory/ldap_base_dn" }}::read:*:* !userpassword !user_secret !alternate_user_secrets !garage_s3_secret_key", + "*::read modify:SELF:*", + "ANONYMOUS::bind:*,ou=users,{{ key "secrets/directory/ldap_base_dn" }}:", + "ANONYMOUS::bind:cn=admin,{{ key "secrets/directory/ldap_base_dn" }}:", + "*,ou=services,ou=users,{{ key "secrets/directory/ldap_base_dn" }}::bind:*,ou=users,{{ key "secrets/directory/ldap_base_dn" }}:*", + "*,ou=services,ou=users,{{ key "secrets/directory/ldap_base_dn" }}::read:*:*", + + "*:cn=asso_deuxfleurs,ou=groups,{{ key "secrets/directory/ldap_base_dn" }}:add:*,ou=invitations,{{ key "secrets/directory/ldap_base_dn" }}:*", + "ANONYMOUS::bind:*,ou=invitations,{{ key "secrets/directory/ldap_base_dn" }}:", + "*,ou=invitations,{{ key "secrets/directory/ldap_base_dn" }}::delete:SELF:*", + + "*:cn=asso_deuxfleurs,ou=groups,{{ key "secrets/directory/ldap_base_dn" }}:add:*,ou=users,{{ key "secrets/directory/ldap_base_dn" }}:*", + "*,ou=invitations,{{ key "secrets/directory/ldap_base_dn" }}::add:*,ou=users,{{ key "secrets/directory/ldap_base_dn" }}:*", + + "*:cn=asso_deuxfleurs,ou=groups,{{ key "secrets/directory/ldap_base_dn" }}:modifyAdd:cn=email,ou=groups,{{ key "secrets/directory/ldap_base_dn" }}:*", + "*,ou=invitations,{{ key "secrets/directory/ldap_base_dn" }}::modifyAdd:cn=email,ou=groups,{{ key "secrets/directory/ldap_base_dn" }}:*", + + "cn=admin,{{ key "secrets/directory/ldap_base_dn" }}::read add modify delete:*:*", + "*:cn=admin,ou=groups,{{ key "secrets/directory/ldap_base_dn" }}:read add modify delete:*:*" + ] +} 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 = <