homelab/nomad-job/gitea.nomad

108 lines
3.4 KiB
Plaintext
Raw Permalink 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"
}
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 {
image = "gitea/gitea:latest"
ports = [
"http",
"ssh"
]
2022-10-29 08:40:01 +00:00
volumes = [
"/mnt/diskstation/git:/repo",
"/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"
2022-10-29 08:40:01 +00:00
GITEA__repository__ROOT = "/repo"
GITEA__server__APP_DATA_PATH = "/data"
GITEA__server__LFS_CONTENT_PATH = "/repo/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
}
}
}