109 lines
2.3 KiB
HCL
109 lines
2.3 KiB
HCL
job "garage-webui" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
group "webui" {
|
|
count = 1
|
|
|
|
network {
|
|
port "webui" {
|
|
static = 3909
|
|
}
|
|
}
|
|
|
|
task "webui" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "khairul169/garage-webui:latest"
|
|
ports = ["webui"]
|
|
|
|
volumes = [
|
|
"local/garage.toml:/etc/garage.toml:ro"
|
|
]
|
|
}
|
|
|
|
# Copy the garage.toml for read-only access
|
|
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_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 - using Consul service discovery
|
|
env {
|
|
API_BASE_URL = "http://garage-admin.service.dc1.consul:3904"
|
|
S3_ENDPOINT_URL = "http://garage-s3.service.dc1.consul:3900"
|
|
}
|
|
|
|
# Resources
|
|
resources {
|
|
cpu = 200
|
|
memory = 128
|
|
}
|
|
|
|
# Service registration
|
|
service {
|
|
name = "garage-webui"
|
|
port = "webui"
|
|
|
|
tags = [
|
|
"webui",
|
|
"http",
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.garage-webui.rule=Host(`garage.example.com`)"
|
|
]
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
|
|
# Kill timeout
|
|
kill_timeout = "30s"
|
|
}
|
|
}
|
|
|
|
# Update strategy
|
|
update {
|
|
max_parallel = 1
|
|
health_check = "checks"
|
|
min_healthy_time = "10s"
|
|
healthy_deadline = "3m"
|
|
auto_revert = true
|
|
}
|
|
}
|