Automatic garage node discover on staging through consul

This commit is contained in:
Alex 2022-10-18 22:09:55 +02:00
parent 4584b39639
commit 859813440c
Signed by: lx
GPG Key ID: 0E496D15096376BE
3 changed files with 38 additions and 2 deletions

View File

@ -6,7 +6,8 @@ db_engine = "lmdb"
replication_mode = "3"
rpc_bind_addr = "0.0.0.0:3991"
rpc_bind_addr = "[{{ env "meta.public_ipv6" }}]:3991"
rpc_public_addr = "[{{ env "meta.public_ipv6" }}]:3991"
rpc_secret = "{{ key "secrets/garage-staging/rpc_secret" | trimSpace }}"
#consul_host = "localhost:8500"
@ -14,6 +15,14 @@ rpc_secret = "{{ key "secrets/garage-staging/rpc_secret" | trimSpace }}"
bootstrap_peers = []
[consul_discovery]
consul_http_addr = "https://consul.service.staging.consul:8501"
service_name = "garage-staging-discovery"
ca_cert = "/etc/garage/consul-ca.crt"
client_cert = "/etc/garage/consul-client.crt"
client_key = "/etc/garage/consul-client.key"
tls_skip_verify = true
[s3_api]
s3_region = "garage-staging"
api_bind_addr = "0.0.0.0:3990"

View File

@ -60,7 +60,7 @@ job "garage-staging" {
driver = "docker"
config {
image = "dxflrs/amd64_garage:e89f8806949f4b389f8848454e293b7b5ba6d91a"
image = "dxflrs/amd64_garage:8bc5caf7aa9bc0e27b741c68113cb7fdde2d54e6"
command = "/garage"
args = [ "server" ]
network_mode = "host"
@ -68,6 +68,7 @@ job "garage-staging" {
"/mnt/storage/garage-staging/data:/data",
"/mnt/ssd/garage-staging/meta:/meta",
"secrets/garage.toml:/etc/garage.toml",
"secrets:/etc/garage",
]
}
@ -76,6 +77,29 @@ job "garage-staging" {
destination = "secrets/garage.toml"
}
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
RUST_LOG=garage=debug
EOH
destination = "secrets/env"
env = true
}
resources {
memory = 2000
memory_max = 3000

View File

@ -62,4 +62,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPTsEgcOtb2bij+Ih8eg8ZqO7d3IMiWykv6deMzlSSS kokakiwi@kira"
];
};
# For Garage ipv6 communication
networking.firewall.allowedTCPPorts = [ 3991 ];
}