From fc83048b0247e222dd94bbf0430f99d58c5be418 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Sun, 23 Jun 2024 22:29:14 +0200 Subject: [PATCH] staging: move bottin and guichet to docker, sync with prod config --- cluster/prod/app/core/secrets.toml | 4 + .../deploy/{directory.hcl => guichet.hcl} | 2 +- .../config/bottin/config.json.tpl | 0 cluster/staging/app/core/deploy/bottin.hcl | 100 +++++++++++++ cluster/staging/app/core/secrets.toml | 5 + .../app/directory/deploy/directory.hcl | 133 ------------------ .../config/guichet/config.json.tpl | 5 +- .../staging/app/guichet/deploy/guichet.hcl | 58 ++++++++ .../app/{directory => guichet}/secrets.toml | 60 ++++---- 9 files changed, 202 insertions(+), 165 deletions(-) rename cluster/prod/app/guichet/deploy/{directory.hcl => guichet.hcl} (95%) rename cluster/staging/app/{directory => core}/config/bottin/config.json.tpl (100%) create mode 100644 cluster/staging/app/core/deploy/bottin.hcl delete mode 100644 cluster/staging/app/directory/deploy/directory.hcl rename cluster/staging/app/{directory => guichet}/config/guichet/config.json.tpl (84%) create mode 100644 cluster/staging/app/guichet/deploy/guichet.hcl rename cluster/staging/app/{directory => guichet}/secrets.toml (83%) diff --git a/cluster/prod/app/core/secrets.toml b/cluster/prod/app/core/secrets.toml index 736c9dd..8a6a7f2 100644 --- a/cluster/prod/app/core/secrets.toml +++ b/cluster/prod/app/core/secrets.toml @@ -3,3 +3,7 @@ type = 'user' description = 'LDAP base DN for everything' example = 'dc=example,dc=com' +[secrets."d53/gandi_api_key"] +type = 'user' +description = 'Gandi API key' + diff --git a/cluster/prod/app/guichet/deploy/directory.hcl b/cluster/prod/app/guichet/deploy/guichet.hcl similarity index 95% rename from cluster/prod/app/guichet/deploy/directory.hcl rename to cluster/prod/app/guichet/deploy/guichet.hcl index 397602f..4b2ff28 100644 --- a/cluster/prod/app/guichet/deploy/directory.hcl +++ b/cluster/prod/app/guichet/deploy/guichet.hcl @@ -14,7 +14,7 @@ job "guichet" { driver = "docker" config { image = "dxflrs/guichet:m1gzk1r00xp0kz566fwbpc87z7haq7xj" - args = [ "server", "-config", "/etc/config.json" ] + args = [ "server", "-config", "/etc/config.json" ] readonly_rootfs = true ports = [ "web_port" ] volumes = [ diff --git a/cluster/staging/app/directory/config/bottin/config.json.tpl b/cluster/staging/app/core/config/bottin/config.json.tpl similarity index 100% rename from cluster/staging/app/directory/config/bottin/config.json.tpl rename to cluster/staging/app/core/config/bottin/config.json.tpl 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 = <