169 lines
3.2 KiB
HCL
169 lines
3.2 KiB
HCL
job "garage" {
|
|
datacenters = ["dc1"]
|
|
type = "system"
|
|
|
|
group "garage" {
|
|
# Network configuration for Garage
|
|
network {
|
|
port "s3_api" {
|
|
static = 3900
|
|
}
|
|
port "k2v_api" {
|
|
static = 3902
|
|
}
|
|
port "web_api" {
|
|
static = 3903
|
|
}
|
|
port "admin" {
|
|
static = 3904
|
|
}
|
|
port "rpc" {
|
|
static = 3901
|
|
}
|
|
}
|
|
|
|
task "garage" {
|
|
driver = "docker"
|
|
|
|
# Multi-architecture image selection
|
|
config {
|
|
image = "dxflrs/garage:v2.1.0"
|
|
ports = ["s3_api", "k2v_api", "web_api", "admin", "rpc"]
|
|
|
|
volumes = [
|
|
"/mnt/configs/garage_data:/var/lib/garage/data",
|
|
"/mnt/configs/garage_meta:/var/lib/garage/meta",
|
|
"local/garage.toml:/etc/garage.toml"
|
|
]
|
|
}
|
|
|
|
# Configuration template
|
|
template {
|
|
data = <<EOF
|
|
metadata_dir = "/var/lib/garage/meta"
|
|
data_dir = "/var/lib/garage/data"
|
|
db_engine = "lmdb"
|
|
|
|
replication_factor = 3
|
|
consistency_mode = "consistent"
|
|
|
|
compression_level = 1
|
|
rpc_bind_addr = "[::]:3901"
|
|
rpc_public_addr = "{{ env "NOMAD_IP_rpc" }}:{{ env "NOMAD_PORT_rpc" }}"
|
|
rpc_secret = "{{ key "garage/rpc_secret" }}"
|
|
|
|
[consul_discovery]
|
|
consul_http_addr = "http://consul.service.dc1.consul:8500"
|
|
service_name = "garage-admin"
|
|
|
|
[s3_api]
|
|
s3_region = "garage"
|
|
api_bind_addr = "[::]:3900"
|
|
root_domain = ".s3.garage.dc1.consul"
|
|
|
|
[s3_web]
|
|
bind_addr = "[::]:3903"
|
|
root_domain = ".web.garage.dc1.consul"
|
|
|
|
[k2v_api]
|
|
api_bind_addr = "[::]:3902"
|
|
|
|
[admin]
|
|
api_bind_addr = "[::]:3904"
|
|
admin_token = "{{ key "garage/admin_token" }}"
|
|
metrics_token = "{{ key "garage/metrics_token" }}"
|
|
EOF
|
|
destination = "local/garage.toml"
|
|
change_mode = "restart"
|
|
}
|
|
|
|
# Environment variables
|
|
env {
|
|
RUST_LOG = "garage=info"
|
|
}
|
|
|
|
# Resources
|
|
resources {
|
|
cpu = 500
|
|
memory = 128
|
|
}
|
|
|
|
# Service registration
|
|
service {
|
|
name = "garage-s3"
|
|
port = "s3_api"
|
|
|
|
tags = [
|
|
"s3",
|
|
"storage"
|
|
]
|
|
|
|
check {
|
|
type = "tcp"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "garage-admin"
|
|
port = "admin"
|
|
|
|
tags = [
|
|
"admin",
|
|
"metrics"
|
|
]
|
|
|
|
check {
|
|
type = "tcp"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "garage-web"
|
|
port = "web_api"
|
|
|
|
tags = [
|
|
"web",
|
|
"http"
|
|
]
|
|
|
|
check {
|
|
type = "tcp"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "garage-k2v"
|
|
port = "k2v_api"
|
|
|
|
tags = [
|
|
"k2v",
|
|
"storage"
|
|
]
|
|
|
|
check {
|
|
type = "tcp"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
|
|
# Kill timeout
|
|
kill_timeout = "30s"
|
|
}
|
|
}
|
|
|
|
# Update strategy for system jobs
|
|
update {
|
|
max_parallel = 1
|
|
health_check = "checks"
|
|
min_healthy_time = "10s"
|
|
healthy_deadline = "5m"
|
|
auto_revert = true
|
|
}
|
|
} |