2023-06-15 23:09:40 +02:00
|
|
|
variable "flake_ref" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "flake_sha" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
job "gitea" {
|
|
|
|
datacenters = [ "homelab-1" ]
|
|
|
|
type = "service"
|
|
|
|
|
|
|
|
constraint {
|
|
|
|
attribute = "${attr.unique.hostname}"
|
|
|
|
value = "blowhole"
|
|
|
|
}
|
|
|
|
|
|
|
|
group "svc" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
volume "gitea-data" {
|
|
|
|
type = "csi"
|
|
|
|
source = "gitea-data"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "gitea-db" {
|
|
|
|
type = "csi"
|
|
|
|
source = "gitea-db"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "gitea"
|
|
|
|
port = "3000"
|
|
|
|
|
|
|
|
check {
|
|
|
|
type = "http"
|
|
|
|
address_mode = "alloc"
|
|
|
|
path = "/"
|
|
|
|
port = "3000"
|
|
|
|
interval = "2s"
|
|
|
|
timeout = "2s"
|
|
|
|
}
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "app" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "gitea-data"
|
2024-01-18 21:10:13 +01:00
|
|
|
destination = "/var/lib/gitea"
|
2023-06-15 23:09:40 +02:00
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "gitea-db"
|
2024-01-18 21:10:13 +01:00
|
|
|
destination = "/var/lib/postgresql"
|
2023-06-15 23:09:40 +02:00
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
2023-06-19 00:50:02 +02:00
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.gitea.config.system.build.toplevel"
|
2023-06-15 23:09:40 +02:00
|
|
|
nix_flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
|
|
|
|
|
|
|
# mounts = [
|
|
|
|
# {
|
|
|
|
# type = "bind"
|
|
|
|
# target = "/var/nfs/gitea-data"
|
|
|
|
# source = "/data/gitea"
|
|
|
|
# options = ["rbind","rw","x-mount.mkdir"]
|
|
|
|
# }
|
|
|
|
# ]
|
|
|
|
}
|
|
|
|
|
|
|
|
env {
|
|
|
|
USER_UID = "5001"
|
|
|
|
USER_GID = "5001"
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 500
|
|
|
|
memory = 1024
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["gitea-policy"]
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2024-01-18 21:23:18 +01:00
|
|
|
{{ with secret "kv/data/cluster/gitea/gitea" }}{{ .Data.data.secret_key }}{{ end }}
|
2023-06-15 23:09:40 +02:00
|
|
|
EOF
|
|
|
|
destination = "secrets/secret_key"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2024-01-18 21:23:18 +01:00
|
|
|
{{ with secret "kv/data/cluster/gitea/gitea" }}{{ .Data.data.internal_token }}{{ end }}
|
2023-06-15 23:09:40 +02:00
|
|
|
EOF
|
|
|
|
destination = "secrets/internal_token"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2024-01-18 21:23:18 +01:00
|
|
|
{{ with secret "kv/data/cluster/gitea/gitea" }}{{ .Data.data.jwt_secret }}{{ end }}
|
2023-06-15 23:09:40 +02:00
|
|
|
EOF
|
|
|
|
destination = "secrets/jwt_secret"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2024-01-18 21:23:18 +01:00
|
|
|
{{ with secret "kv/data/cluster/gitea/gitea" }}{{ .Data.data.lfs_jwt_secret }}{{ end }}
|
2023-06-15 23:09:40 +02:00
|
|
|
EOF
|
|
|
|
destination = "secrets/lfs_jwt_secret"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|