From fc83048b0247e222dd94bbf0430f99d58c5be418 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Sun, 23 Jun 2024 22:29:14 +0200 Subject: staging: move bottin and guichet to docker, sync with prod config --- .../staging/app/core/config/bottin/config.json.tpl | 26 ++++ cluster/staging/app/core/deploy/bottin.hcl | 100 ++++++++++++++++ cluster/staging/app/core/secrets.toml | 5 + .../app/directory/config/bottin/config.json.tpl | 26 ---- .../app/directory/config/guichet/config.json.tpl | 37 ------ cluster/staging/app/directory/deploy/directory.hcl | 133 --------------------- cluster/staging/app/directory/secrets.toml | 51 -------- .../app/guichet/config/guichet/config.json.tpl | 40 +++++++ cluster/staging/app/guichet/deploy/guichet.hcl | 58 +++++++++ cluster/staging/app/guichet/secrets.toml | 51 ++++++++ 10 files changed, 280 insertions(+), 247 deletions(-) create mode 100644 cluster/staging/app/core/config/bottin/config.json.tpl create mode 100644 cluster/staging/app/core/deploy/bottin.hcl delete mode 100644 cluster/staging/app/directory/config/bottin/config.json.tpl delete mode 100644 cluster/staging/app/directory/config/guichet/config.json.tpl delete mode 100644 cluster/staging/app/directory/deploy/directory.hcl delete mode 100644 cluster/staging/app/directory/secrets.toml create mode 100644 cluster/staging/app/guichet/config/guichet/config.json.tpl create mode 100644 cluster/staging/app/guichet/deploy/guichet.hcl create mode 100644 cluster/staging/app/guichet/secrets.toml (limited to 'cluster/staging') diff --git a/cluster/staging/app/core/config/bottin/config.json.tpl b/cluster/staging/app/core/config/bottin/config.json.tpl new file mode 100644 index 0000000..844f7b7 --- /dev/null +++ b/cluster/staging/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/staging/app/core/deploy/bottin.hcl b/cluster/staging/app/core/deploy/bottin.hcl new file mode 100644 index 0000000..1481fa8 --- /dev/null +++ b/cluster/staging/app/core/deploy/bottin.hcl @@ -0,0 +1,100 @@ +job "core-bottin" { + datacenters = ["neptune", "jupiter", "corrin", "bespin"] + type = "system" + priority = 90 + + update { + max_parallel = 1 + stagger = "1m" + } + + group "bottin" { + constraint { + distinct_property = "${meta.site}" + value = "1" + } + + network { + port "ldap_port" { + static = 389 + to = 389 + } + } + + task "bottin" { + driver = "docker" + config { + image = "dxflrs/bottin:7h18i30cckckaahv87d3c86pn4a7q41z" + network_mode = "host" + readonly_rootfs = true + ports = [ "ldap_port" ] + volumes = [ + "secrets/config.json:/config.json", + "secrets:/etc/bottin", + ] + } + + restart { + interval = "5m" + attempts = 10 + delay = "15s" + mode = "delay" + } + + resources { + memory = 100 + memory_max = 200 + } + + template { + data = file("../config/bottin/config.json.tpl") + destination = "secrets/config.json" + } + + template { + data = "{{ key \"secrets/consul/consul.crt\" }}" + destination = "secrets/consul.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 = <