aboutsummaryrefslogtreecommitdiff
path: root/cluster/prod/app
diff options
context:
space:
mode:
Diffstat (limited to 'cluster/prod/app')
-rw-r--r--cluster/prod/app/core/deploy/bottin.hcl100
-rw-r--r--cluster/prod/app/core/deploy/core-system.hcl257
-rw-r--r--cluster/prod/app/core/deploy/d53.hcl (renamed from cluster/prod/app/core/deploy/core-service.hcl)2
-rw-r--r--cluster/prod/app/core/deploy/diplonat.hcl71
-rw-r--r--cluster/prod/app/core/deploy/tricot.hcl109
-rw-r--r--cluster/prod/app/garage/config/garage.toml6
6 files changed, 285 insertions, 260 deletions
diff --git a/cluster/prod/app/core/deploy/bottin.hcl b/cluster/prod/app/core/deploy/bottin.hcl
new file mode 100644
index 0000000..40bb5af
--- /dev/null
+++ b/cluster/prod/app/core/deploy/bottin.hcl
@@ -0,0 +1,100 @@
+job "core:bottin" {
+ datacenters = ["orion", "neptune", "scorpio"]
+ 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 = <<EOH
+CONSUL_HTTP_ADDR=https://consul.service.prod.consul:8501
+CONSUL_HTTP_SSL=true
+CONSUL_CACERT=/etc/bottin/consul.crt
+CONSUL_CLIENT_CERT=/etc/bottin/consul-client.crt
+CONSUL_CLIENT_KEY=/etc/bottin/consul-client.key
+EOH
+ destination = "secrets/env"
+ env = true
+ }
+
+ service {
+ tags = [ "${meta.site}" ]
+ port = "ldap_port"
+ address_mode = "host"
+ name = "bottin"
+ check {
+ type = "tcp"
+ port = "ldap_port"
+ interval = "60s"
+ timeout = "5s"
+ check_restart {
+ limit = 3
+ grace = "90s"
+ ignore_warnings = false
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/cluster/prod/app/core/deploy/core-system.hcl b/cluster/prod/app/core/deploy/core-system.hcl
deleted file mode 100644
index 004a2ef..0000000
--- a/cluster/prod/app/core/deploy/core-system.hcl
+++ /dev/null
@@ -1,257 +0,0 @@
-job "core" {
- datacenters = ["orion", "neptune", "scorpio"]
- type = "system"
- priority = 90
-
- update {
- max_parallel = 1
- stagger = "5m"
- }
-
- group "diplonat" {
- task "diplonat" {
- driver = "docker"
-
- config {
- image = "lxpz/amd64_diplonat:5"
- network_mode = "host"
- readonly_rootfs = true
- privileged = true
- volumes = [
- "secrets:/etc/diplonat",
- ]
- }
-
- restart {
- interval = "5m"
- attempts = 10
- delay = "15s"
- mode = "delay"
- }
-
- 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 = <<EOH
-DIPLONAT_REFRESH_TIME=60
-DIPLONAT_EXPIRATION_TIME=300
-DIPLONAT_CONSUL_NODE_NAME={{ env "attr.unique.hostname" }}
-DIPLONAT_CONSUL_URL=https://consul.service.prod.consul:8501
-DIPLONAT_CONSUL_TLS_SKIP_VERIFY=true
-DIPLONAT_CONSUL_CLIENT_CERT=/etc/diplonat/consul-client.crt
-DIPLONAT_CONSUL_CLIENT_KEY=/etc/diplonat/consul-client.key
-RUST_LOG=debug
-EOH
- destination = "secrets/env"
- env = true
- }
-
- resources {
- memory = 100
- memory_max = 200
- }
- }
- }
-
- group "tricot" {
- constraint {
- distinct_property = "${meta.site}"
- value = "1"
- }
-
- network {
- port "http_port" { static = 80 }
- port "https_port" { static = 443 }
- port "metrics_port" { static = 9334 }
- }
-
- task "server" {
- driver = "docker"
-
- config {
- image = "lxpz/amd64_tricot:47"
- network_mode = "host"
- readonly_rootfs = true
- ports = [ "http_port", "https_port" ]
- volumes = [
- "secrets:/etc/tricot",
- ]
- }
-
- resources {
- cpu = 1000
- memory = 200
- memory_max = 500
- }
-
- restart {
- interval = "5m"
- attempts = 10
- 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 = <<EOH
-TRICOT_NODE_NAME={{ env "attr.unique.hostname" }}
-TRICOT_LETSENCRYPT_EMAIL=prod-sysadmin@deuxfleurs.fr
-TRICOT_ENABLE_COMPRESSION=true
-TRICOT_CONSUL_HOST=https://consul.service.prod.consul:8501
-TRICOT_CONSUL_TLS_SKIP_VERIFY=true
-TRICOT_CONSUL_CLIENT_CERT=/etc/tricot/consul-client.crt
-TRICOT_CONSUL_CLIENT_KEY=/etc/tricot/consul-client.key
-TRICOT_HTTP_BIND_ADDR=[::]:80
-TRICOT_HTTPS_BIND_ADDR=[::]:443
-TRICOT_METRICS_BIND_ADDR=[::]:9334
-RUST_LOG=tricot=debug
-EOH
- destination = "secrets/env"
- env = true
- }
-
- service {
- name = "tricot-http"
- port = "http_port"
- tags = [ "(diplonat (tcp_port 80))", "${meta.site}" ]
- address_mode = "host"
- }
-
- service {
- name = "tricot-https"
- port = "https_port"
- tags = [
- "(diplonat (tcp_port 443))",
- "${meta.site}",
- "d53-aaaa ${meta.site}.site.deuxfleurs.fr",
- "d53-a global.site.deuxfleurs.fr",
- "d53-aaaa global.site.deuxfleurs.fr",
- ]
- address_mode = "host"
- }
-
- service {
- name = "tricot-metrics"
- port = "metrics_port"
- address_mode = "host"
- }
- }
- }
-
- 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 = <<EOH
-CONSUL_HTTP_ADDR=https://consul.service.prod.consul:8501
-CONSUL_HTTP_SSL=true
-CONSUL_CACERT=/etc/bottin/consul.crt
-CONSUL_CLIENT_CERT=/etc/bottin/consul-client.crt
-CONSUL_CLIENT_KEY=/etc/bottin/consul-client.key
-EOH
- destination = "secrets/env"
- env = true
- }
-
- service {
- tags = [ "${meta.site}" ]
- port = "ldap_port"
- address_mode = "host"
- name = "bottin"
- check {
- type = "tcp"
- port = "ldap_port"
- interval = "60s"
- timeout = "5s"
- check_restart {
- limit = 3
- grace = "90s"
- ignore_warnings = false
- }
- }
- }
- }
- }
-}
diff --git a/cluster/prod/app/core/deploy/core-service.hcl b/cluster/prod/app/core/deploy/d53.hcl
index c2fe3c9..58cda1e 100644
--- a/cluster/prod/app/core/deploy/core-service.hcl
+++ b/cluster/prod/app/core/deploy/d53.hcl
@@ -1,4 +1,4 @@
-job "core-service" {
+job "core:d53" {
datacenters = ["neptune", "orion", "bespin"]
type = "service"
priority = 90
diff --git a/cluster/prod/app/core/deploy/diplonat.hcl b/cluster/prod/app/core/deploy/diplonat.hcl
new file mode 100644
index 0000000..d6f8423
--- /dev/null
+++ b/cluster/prod/app/core/deploy/diplonat.hcl
@@ -0,0 +1,71 @@
+job "core:diplonat" {
+ datacenters = ["orion", "neptune", "scorpio", "bespin"]
+ type = "system"
+ priority = 90
+
+ update {
+ max_parallel = 2
+ stagger = "1m"
+ }
+
+ group "diplonat" {
+ task "diplonat" {
+ driver = "docker"
+
+ config {
+ image = "lxpz/amd64_diplonat:6"
+ network_mode = "host"
+ readonly_rootfs = true
+ privileged = true
+ volumes = [
+ "secrets:/etc/diplonat",
+ ]
+ }
+
+ restart {
+ interval = "5m"
+ attempts = 10
+ delay = "15s"
+ mode = "delay"
+ }
+
+ 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 = <<EOH
+DIPLONAT_REFRESH_TIME=60
+DIPLONAT_EXPIRATION_TIME=300
+DIPLONAT_CONSUL_NODE_NAME={{ env "attr.unique.hostname" }}
+DIPLONAT_CONSUL_URL=https://consul.service.prod.consul:8501
+DIPLONAT_CONSUL_TLS_SKIP_VERIFY=true
+DIPLONAT_CONSUL_CLIENT_CERT=/etc/diplonat/consul-client.crt
+DIPLONAT_CONSUL_CLIENT_KEY=/etc/diplonat/consul-client.key
+{{ if env "meta.site" | eq "bespin" }}
+DIPLONAT_IPV6_ONLY=true
+{{ end }}
+RUST_LOG=debug
+EOH
+ destination = "secrets/env"
+ env = true
+ }
+
+ resources {
+ memory = 100
+ memory_max = 200
+ }
+ }
+ }
+}
diff --git a/cluster/prod/app/core/deploy/tricot.hcl b/cluster/prod/app/core/deploy/tricot.hcl
new file mode 100644
index 0000000..7c3bada
--- /dev/null
+++ b/cluster/prod/app/core/deploy/tricot.hcl
@@ -0,0 +1,109 @@
+job "core:tricot" {
+ datacenters = ["orion", "neptune", "scorpio", "bespin"]
+ type = "system"
+ priority = 90
+
+ update {
+ max_parallel = 1
+ stagger = "5m"
+ }
+
+ group "tricot" {
+ constraint {
+ distinct_property = "${meta.site}"
+ value = "1"
+ }
+
+ network {
+ port "http_port" { static = 80 }
+ port "https_port" { static = 443 }
+ port "metrics_port" { static = 9334 }
+ }
+
+ task "server" {
+ driver = "docker"
+
+ config {
+ image = "lxpz/amd64_tricot:47"
+ network_mode = "host"
+ readonly_rootfs = true
+ ports = [ "http_port", "https_port" ]
+ volumes = [
+ "secrets:/etc/tricot",
+ ]
+ }
+
+ resources {
+ cpu = 1000
+ memory = 200
+ memory_max = 500
+ }
+
+ restart {
+ interval = "5m"
+ attempts = 10
+ 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 = <<EOH
+TRICOT_NODE_NAME={{ env "attr.unique.hostname" }}
+TRICOT_LETSENCRYPT_EMAIL=prod-sysadmin@deuxfleurs.fr
+TRICOT_ENABLE_COMPRESSION=true
+TRICOT_CONSUL_HOST=https://consul.service.prod.consul:8501
+TRICOT_CONSUL_TLS_SKIP_VERIFY=true
+TRICOT_CONSUL_CLIENT_CERT=/etc/tricot/consul-client.crt
+TRICOT_CONSUL_CLIENT_KEY=/etc/tricot/consul-client.key
+TRICOT_HTTP_BIND_ADDR=[::]:80
+TRICOT_HTTPS_BIND_ADDR=[::]:443
+TRICOT_METRICS_BIND_ADDR=[::]:9334
+RUST_LOG=tricot=debug
+EOH
+ destination = "secrets/env"
+ env = true
+ }
+
+ service {
+ name = "tricot-http"
+ port = "http_port"
+ tags = [ "(diplonat (tcp_port 80))", "${meta.site}" ]
+ address_mode = "host"
+ }
+
+ service {
+ name = "tricot-https"
+ port = "https_port"
+ tags = [
+ "(diplonat (tcp_port 443))",
+ "${meta.site}",
+ "d53-aaaa ${meta.site}.site.deuxfleurs.fr",
+ "d53-a global.site.deuxfleurs.fr",
+ "d53-aaaa global.site.deuxfleurs.fr",
+ ]
+ address_mode = "host"
+ }
+
+ service {
+ name = "tricot-metrics"
+ port = "metrics_port"
+ address_mode = "host"
+ }
+ }
+ }
+}
diff --git a/cluster/prod/app/garage/config/garage.toml b/cluster/prod/app/garage/config/garage.toml
index 36daa5d..5b10707 100644
--- a/cluster/prod/app/garage/config/garage.toml
+++ b/cluster/prod/app/garage/config/garage.toml
@@ -6,8 +6,10 @@ db_engine = "lmdb"
replication_mode = "3"
-rpc_bind_addr = "[{{ env "meta.public_ipv6" }}]:3901"
-rpc_public_addr = "[{{ env "meta.public_ipv6" }}]:3901"
+{{ with $a := env "attr.unique.hostname" | printf "diplonat/autodiscovery/ipv6/%s" | key | parseJSON }}
+rpc_bind_addr = "[{{ $a.address }}]:3901"
+rpc_public_addr = "[{{ $a.address }}]:3901"
+{{ end }}
rpc_secret = "{{ key "secrets/garage/rpc_secret" | trimSpace }}"
[consul_discovery]