homelab/nomad-job/decom/nextcloud.nomad

78 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2022-04-30 19:14:02 +00:00
job "nextcloud" {
datacenters = ["homelab"]
type = "service"
2022-05-02 19:32:42 +00:00
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
2022-04-30 19:14:02 +00:00
meta {
2022-05-02 19:32:42 +00:00
forcedeploy = "2"
2022-04-30 19:14:02 +00:00
}
group "nextcloud"{
network {
mode = "host"
port "http" {
to = 80
}
}
vault{
2022-05-02 19:32:42 +00:00
policies= ["access-tables"]
2022-04-30 19:14:02 +00:00
}
task "server" {
driver = "docker"
service {
name = "nextcloud"
port = "http"
tags = [
"traefik.enable=true",
2023-11-05 18:08:17 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`file.ducamps.eu`)",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=file.ducamps.eu",
2022-04-30 19:14:02 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
2022-05-09 06:50:17 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.entrypoints=web",
2023-11-05 18:08:17 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.rule=Host(`file.ducamps.eu`)",
2022-05-09 06:50:17 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.middlewares=httpsRedirect",
"traefik.http.middlewares.httpsRedirect.redirectscheme.scheme=https",
2022-04-30 19:14:02 +00:00
]
}
config {
image = "nextcloud:latest"
ports = ["http"]
volumes = [
2022-05-02 19:32:42 +00:00
"/mnt/diskstation/nextcloud/data:/var/www/html/data",
"/mnt/diskstation/nextcloud/config:/var/www/html/config",
2022-05-03 21:20:31 +00:00
"/mnt/diskstation/nextcloud/root:/var/www/html/"
2022-04-30 19:14:02 +00:00
]
}
env {
2022-05-02 19:32:42 +00:00
}
2022-04-30 19:14:02 +00:00
template {
data= <<EOH
2022-05-02 19:32:42 +00:00
{{ with secret "secrets/data/nextcloud"}}
2022-05-03 21:20:31 +00:00
POSTGRES_DB="nextcloud"
2022-05-02 19:32:42 +00:00
POSTGRES_USER="nextcloud"
POSTGRES_PASSWORD="{{ .Data.data.POSTGRES_PASSWORD }}"
NEXTCLOUD_ADMIN_USER="vincent"
NEXTCLOUD_ADMIN_PASSWORD="{{ .Data.data.ADMIN_PASSWORD }}"
2023-11-05 18:08:17 +00:00
NEXTCLOUD_TRUSTED_DOMAINS="file.ducamps.eu"
2023-11-01 07:42:04 +00:00
POSTGRES_HOST="active.db.service.consul"
2022-04-30 19:14:02 +00:00
{{end}}
EOH
2022-05-02 19:32:42 +00:00
destination = "secrets/nextcloud.env"
2022-04-30 19:14:02 +00:00
env = true
}
}
}
}