feat: initial homelab-gitops declarative structure (Terraform & ArgoCD)
This commit is contained in:
173
terraform/shipyard-swarm/stacks.tf
Normal file
173
terraform/shipyard-swarm/stacks.tf
Normal file
@@ -0,0 +1,173 @@
|
||||
# Swarm Overlay Network
|
||||
resource "docker_network" "homelab_public" {
|
||||
name = "homelab_public"
|
||||
driver = "overlay"
|
||||
attachable = true
|
||||
}
|
||||
|
||||
# 1. Gotify Notification Service
|
||||
resource "docker_service" "gotify" {
|
||||
name = "gotify"
|
||||
|
||||
task_spec {
|
||||
container_spec {
|
||||
image = "gotify/server:latest"
|
||||
env = {
|
||||
GOTIFY_SERVER_PORT = "80"
|
||||
TZ = "America/New_York"
|
||||
}
|
||||
mounts {
|
||||
target = "/app/data"
|
||||
source = "${var.swarm_storage_base}/gotify"
|
||||
type = "bind"
|
||||
}
|
||||
}
|
||||
restart_policy {
|
||||
condition = "any"
|
||||
}
|
||||
}
|
||||
|
||||
mode {
|
||||
replicated {
|
||||
replicas = 1
|
||||
}
|
||||
}
|
||||
|
||||
endpoint_spec {
|
||||
ports {
|
||||
target_port = 80
|
||||
published_port = 8090
|
||||
publish_mode = "ingress"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 2. Peanut UPS Service
|
||||
resource "docker_service" "peanut" {
|
||||
name = "peanut"
|
||||
|
||||
task_spec {
|
||||
container_spec {
|
||||
image = "brandawg93/peanut:latest"
|
||||
env = {
|
||||
TZ = "America/New_York"
|
||||
}
|
||||
mounts {
|
||||
target = "/config"
|
||||
source = "${var.swarm_storage_base}/peanut"
|
||||
type = "bind"
|
||||
}
|
||||
}
|
||||
restart_policy {
|
||||
condition = "any"
|
||||
}
|
||||
}
|
||||
|
||||
mode {
|
||||
replicated {
|
||||
replicas = 1
|
||||
}
|
||||
}
|
||||
|
||||
endpoint_spec {
|
||||
ports {
|
||||
target_port = 8080
|
||||
published_port = 8050
|
||||
publish_mode = "ingress"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 3. Homebox Inventory Service
|
||||
resource "docker_service" "homebox" {
|
||||
name = "homebox"
|
||||
|
||||
task_spec {
|
||||
container_spec {
|
||||
image = "ghcr.io/sysadminsmedia/homebox:latest"
|
||||
env = {
|
||||
HBOX_MODE = "production"
|
||||
HBOX_STORAGE_DATA = "/data"
|
||||
TZ = "America/New_York"
|
||||
}
|
||||
mounts {
|
||||
target = "/data"
|
||||
source = "${var.swarm_storage_base}/homebox"
|
||||
type = "bind"
|
||||
}
|
||||
}
|
||||
restart_policy {
|
||||
condition = "any"
|
||||
}
|
||||
}
|
||||
|
||||
mode {
|
||||
replicated {
|
||||
replicas = 1
|
||||
}
|
||||
}
|
||||
|
||||
endpoint_spec {
|
||||
ports {
|
||||
target_port = 7745
|
||||
published_port = 7745
|
||||
publish_mode = "ingress"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 4. Nginx Proxy Manager Service (Node-pinned to snshpd4lnxswm04)
|
||||
resource "docker_service" "nginx_proxy_manager" {
|
||||
name = "nginx-proxy-manager"
|
||||
|
||||
task_spec {
|
||||
container_spec {
|
||||
image = "jc21/nginx-proxy-manager:latest"
|
||||
env = {
|
||||
TZ = "America/New_York"
|
||||
PUID = "1000"
|
||||
PGID = "1000"
|
||||
}
|
||||
mounts {
|
||||
target = "/data"
|
||||
source = "${var.swarm_storage_base}/nginx-proxy-manager_nginx-data/_data"
|
||||
type = "bind"
|
||||
}
|
||||
mounts {
|
||||
target = "/etc/letsencrypt"
|
||||
source = "${var.swarm_storage_base}/nginx-proxy-manager_nginx-letsencrypt/_data"
|
||||
type = "bind"
|
||||
}
|
||||
}
|
||||
placement {
|
||||
constraints = ["node.hostname == snshpd4lnxswm04"]
|
||||
}
|
||||
restart_policy {
|
||||
condition = "any"
|
||||
}
|
||||
}
|
||||
|
||||
mode {
|
||||
replicated {
|
||||
replicas = 1
|
||||
}
|
||||
}
|
||||
|
||||
endpoint_spec {
|
||||
ports {
|
||||
target_port = 80
|
||||
published_port = 80
|
||||
publish_mode = "host"
|
||||
}
|
||||
ports {
|
||||
target_port = 443
|
||||
published_port = 443
|
||||
publish_mode = "host"
|
||||
}
|
||||
ports {
|
||||
target_port = 81
|
||||
published_port = 81
|
||||
publish_mode = "host"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user