From 2ef6ab18818e059581cf5744311be223bc5bad96 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 28 Oct 2020 12:08:23 +0100 Subject: Simplify configuration --- app/config/configuration/.gitignore | 33 --------------- app/config/configuration/garage/garage.toml | 21 ++++++++++ app/deployment/garage.hcl | 65 +++++++++++++---------------- app/deployment/traefik.hcl | 24 +++-------- 4 files changed, 55 insertions(+), 88 deletions(-) delete mode 100644 app/config/configuration/.gitignore create mode 100644 app/config/configuration/garage/garage.toml diff --git a/app/config/configuration/.gitignore b/app/config/configuration/.gitignore deleted file mode 100644 index 86bd34a..0000000 --- a/app/config/configuration/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -# Blacklist everything cleverly -* -!*/ - -# Whitelist some patterns -!*.sample -!*.gen -!*.tpl -!.gitignore - -# Whitelist specific files -!seafile/conf/seafdav.conf -!seafile/ccnet/seafile.ini - -!email/dkim/keytable -!email/dkim/signingtable -!email/dkim/trusted -!email/postfix/dynamicmaps.cf -!email/postfix/header_checks -!email/postfix/main.cf -!email/postfix/master.cf -!email/postfix/transport -!email/postfix/transport.db - -!email/sogo/sogo.conf.tpl - -!chat/**/* -!plume/**/* -!directory/*/* - -!traefik/traefik.toml - -!garage/config.toml diff --git a/app/config/configuration/garage/garage.toml b/app/config/configuration/garage/garage.toml new file mode 100644 index 0000000..51ae81f --- /dev/null +++ b/app/config/configuration/garage/garage.toml @@ -0,0 +1,21 @@ +block_size = 1048576 + +metadata_dir = "/garage/meta" +data_dir = "/garage/data" + +rpc_bind_addr = "[::]:3901" + +consul_host = "consul.service.2.cluster.deuxfleurs.fr:8500" +consul_service_name = "garage-rpc" + +bootstrap_peers = [ ] + +[rpc_tls] +ca_cert = "/garage/garage-ca.crt" +node_cert = "/garage/garage.crt" +node_key = "/garage/garage.key" + +[s3_api] +s3_region = "garage" +api_bind_addr = "[::]:3900" + diff --git a/app/deployment/garage.hcl b/app/deployment/garage.hcl index 3478706..8189ff3 100644 --- a/app/deployment/garage.hcl +++ b/app/deployment/garage.hcl @@ -12,10 +12,7 @@ job "garage" { driver = "docker" config { image = "lxpz/garage_amd64:4" - port_map { - rpc_port = 3901 - api_port = 3900 - } + network_mode = "host" volumes = [ "/mnt/storage/garage/data:/garage/data", "/mnt/ssd/garage/meta:/garage/meta", @@ -26,32 +23,26 @@ job "garage" { ] } - template { - data = "{{ key \"configuration/garage/garage.toml\" }}" - destination = "secrets/garage.toml" - } - template { - data = "{{ key \"secrets/garage/garage-ca.crt\" }}" - destination = "secrets/garage-ca.crt" - } - template { - data = "{{ key \"secrets/garage/garage.crt\" }}" - destination = "secrets/garage.crt" - } - template { - data = "{{ key \"secrets/garage/garage.key\" }}" - destination = "secrets/garage.key" - } + template { + data = "{{ key \"configuration/garage/garage.toml\" }}" + destination = "secrets/garage.toml" + } + template { + data = "{{ key \"secrets/garage/garage-ca.crt\" }}" + destination = "secrets/garage-ca.crt" + } + template { + data = "{{ key \"secrets/garage/garage.crt\" }}" + destination = "secrets/garage.crt" + } + template { + data = "{{ key \"secrets/garage/garage.key\" }}" + destination = "secrets/garage.key" + } resources { memory = 500 cpu = 1000 - network { - port "rpc_port" { - static = "3901" - } - port "api_port" {} - } } service { @@ -61,12 +52,13 @@ job "garage" { "traefik.frontend.entryPoints=https,http", "traefik.frontend.rule=Host:garage.deuxfleurs.fr" ] - port = "api_port" - address_mode = "host" + port = 3900 + address_mode = "driver" name = "garage-api" check { type = "tcp" - port = "api_port" + port = 3900 + address_mode = "driver" interval = "60s" timeout = "5s" check_restart { @@ -77,14 +69,15 @@ job "garage" { } } - service { - tags = ["garage-rpc"] - port = "rpc_port" - address_mode = "host" - name = "garage-rpc" + service { + tags = ["garage-rpc"] + port = 3901 + address_mode = "driver" + name = "garage-rpc" check { type = "tcp" - port = "rpc_port" + port = 3901 + address_mode = "driver" interval = "60s" timeout = "5s" check_restart { @@ -93,7 +86,7 @@ job "garage" { ignore_warnings = false } } - } + } } } } diff --git a/app/deployment/traefik.hcl b/app/deployment/traefik.hcl index a0803e4..bb724df 100644 --- a/app/deployment/traefik.hcl +++ b/app/deployment/traefik.hcl @@ -9,11 +9,7 @@ job "frontend" { config { image = "amd64/traefik:1.7.20" readonly_rootfs = true - port_map { - https_port = 443 - http_port = 80 - adm_port = 8082 - } + network_mode = "host" volumes = [ "secrets/traefik.toml:/etc/traefik/traefik.toml", ] @@ -21,17 +17,6 @@ job "frontend" { resources { memory = 265 - network { - port "https_port" { - static = "443" - } - port "http_port" { - static = "80" - } - port "adm_port" { - static = "8082" - } - } } service { @@ -40,13 +25,14 @@ job "frontend" { "frontend", "(diplonat (tcp_port 80 443))" ] - port = "https_port" - address_mode = "host" + port = 443 + address_mode = "driver" name = "traefik" check { type = "http" protocol = "http" - port = "adm_port" + port = 8082 + address_mode = "driver" path = "/ping" interval = "60s" timeout = "5s" -- cgit v1.2.3