homelab/nomad-job/gitea.nomad

112 lines
3.5 KiB
Plaintext
Raw Normal View History

2022-04-27 11:05:55 +00:00
job "git" {
2022-10-14 11:08:10 +00:00
datacenters = ["homelab"]
2022-12-10 16:10:32 +00:00
priority = 90
2022-10-29 08:40:01 +00:00
type = "service"
2022-11-26 20:04:51 +00:00
meta {
force = 1
}
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
2024-02-21 18:03:31 +00:00
}
constraint {
attribute = "${node.class}"
operator = "set_contains"
value = "cluster"
2022-11-26 20:04:51 +00:00
}
2022-04-27 11:05:55 +00:00
group "gitea" {
network {
mode = "host"
port "http" {
to = 3000
}
port "ssh" {
to = 22
}
}
vault {
2022-10-30 08:33:39 +00:00
policies = ["gitea"]
2022-04-27 11:05:55 +00:00
}
task "gitea" {
driver = "docker"
service {
name = "gitea"
port = "http"
2022-09-09 15:19:07 +00:00
tags = [
2022-05-23 19:44:34 +00:00
"homer.enable=true",
"homer.name=Gitea",
"homer.service=Platform",
"homer.target=_blank",
2023-11-05 18:08:17 +00:00
"homer.logo=https://git.ducamps.eu/assets/img/logo.svg",
"homer.url=https://${NOMAD_JOB_NAME}.ducamps.eu",
2022-04-27 11:05:55 +00:00
"traefik.enable=true",
2023-11-05 18:08:17 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`${NOMAD_JOB_NAME}.ducamps.eu`)",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.eu",
2022-04-27 11:05:55 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
"traefik.http.middlewares.httpsRedirect.redirectscheme.scheme=https",
2023-10-07 16:40:40 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.middlewares=httpsRedirect",
"traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure",
2022-04-27 11:05:55 +00:00
]
}
service {
2022-10-29 08:40:01 +00:00
name = "gitea-ssh"
2022-04-27 11:05:55 +00:00
port = "ssh"
tags = [
"traefik.enable=true",
"traefik.tcp.routers.gitea-ssh.rule=HostSNI(`*`)",
"traefik.tcp.routers.gitea-ssh.entrypoints=ssh"
]
}
config {
2024-03-17 17:58:24 +00:00
image = "docker.service.consul:5000/gitea/gitea:latest"
2022-04-27 11:05:55 +00:00
ports = [
"http",
"ssh"
]
2022-10-29 08:40:01 +00:00
volumes = [
"/mnt/diskstation/nomad/gitea:/data"
]
2022-04-27 11:05:55 +00:00
}
env {
2022-10-29 08:40:01 +00:00
USER_UID = 1000000
2022-11-26 20:04:51 +00:00
USER_GID = 984
2023-11-05 18:08:17 +00:00
GITEA__server__DOMAIN = "git.ducamps.eu"
GITEA__server__ROOT_URL = "https://git.ducamps.eu"
GITEA__server__SSH_DOMAIN = "git.ducamps.eu"
2022-10-29 08:40:01 +00:00
GITEA__server__SSH_PORT = "2222"
GITEA__server__SSH_LISTEN_PORT = "2222"
GITEA__server__START_SSH_SERVER = "false"
GITEA__database__DB_TYPE = "postgres"
2023-11-01 07:42:04 +00:00
GITEA__database__HOST = "active.db.service.consul"
2022-10-29 08:40:01 +00:00
GITEA__database__NAME = "gitea"
GITEA__database__USER = "gitea"
2022-04-27 11:05:55 +00:00
GITEA__service__DISABLE_REGISTRATION = "true"
GITEA__repository__ROOT = "/data/gitea-repositories"
2022-10-29 08:40:01 +00:00
GITEA__server__APP_DATA_PATH = "/data"
GITEA__server__LFS_CONTENT_PATH = "/data/lfs"
2023-11-05 18:08:17 +00:00
GITEA__webhook__ALLOWED_HOST_LIST = "drone.ducamps.eu"
2022-12-04 08:36:50 +00:00
GITEA__webhook__DELIVER_TIMEOUT = "30"
2022-04-27 11:05:55 +00:00
}
template {
2022-10-29 08:40:01 +00:00
data = <<EOH
2022-10-30 08:33:39 +00:00
{{ with secret "secrets/data/nomad/gitea"}}
2022-04-27 11:05:55 +00:00
GITEA__security__SECRET_KEY = "{{.Data.data.secret_key}}"
GITEA__oauth2__JWT_SECRET = "{{.Data.data.jwt_secret}}"
GITEA__security__INTERNAL_TOKEN = "{{.Data.data.internal_token}}"
{{end}}
2022-10-30 08:33:39 +00:00
{{ with secret "secrets/data/database/gitea"}}
GITEA__database__PASSWD = "{{.Data.data.password}}"
{{end}}
2022-04-27 11:05:55 +00:00
EOH
destination = "secrets/gitea.env"
2022-10-29 08:40:01 +00:00
env = true
2022-04-27 11:05:55 +00:00
}
2022-05-12 09:36:04 +00:00
resources {
2022-05-13 18:16:19 +00:00
memory = 400
2022-05-12 09:36:04 +00:00
}
2022-04-27 11:05:55 +00:00
}
}
}