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" 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 }}" rpc_secret = "{{ key "secrets/garage-staging/rpc_secret" | trimSpace }}"
#consul_host = "localhost:8500" #consul_host = "localhost:8500"
@ -14,6 +15,14 @@ rpc_secret = "{{ key "secrets/garage-staging/rpc_secret" | trimSpace }}"
bootstrap_peers = [] 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_api]
s3_region = "garage-staging" s3_region = "garage-staging"
api_bind_addr = "0.0.0.0:3990" api_bind_addr = "0.0.0.0:3990"

View file

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

View file

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