chore: backup infrastructure configurations [skip ci]
This commit is contained in:
108
nomad_backup/garage-webui.hcl
Normal file
108
nomad_backup/garage-webui.hcl
Normal file
@@ -0,0 +1,108 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
job "garage" {
|
||||
datacenters = ["dc1"]
|
||||
type = "system"
|
||||
|
||||
|
||||
group "garage" {
|
||||
# Network configuration for Garage
|
||||
network {
|
||||
@@ -21,53 +21,43 @@ job "garage" {
|
||||
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" }}"
|
||||
@@ -76,88 +66,76 @@ 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
|
||||
@@ -166,4 +144,4 @@ EOF
|
||||
healthy_deadline = "5m"
|
||||
auto_revert = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
147
nomad_backup/garage_backup.hcl
Normal file
147
nomad_backup/garage_backup.hcl
Normal file
@@ -0,0 +1,147 @@
|
||||
job "garage_backup" {
|
||||
datacenters = ["dc1"]
|
||||
type = "system"
|
||||
node_pool = "backup"
|
||||
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/Shares/configs/garage_data:/var/lib/garage/data",
|
||||
"/mnt/Shares/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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user