homelab/nomad-job/decom/nextcloud.nomad

78 lines
1.9 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",
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`file.ducamps.win`)",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=file.ducamps.win",
"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",
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.rule=Host(`file.ducamps.win`)",
"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 }}"
2022-04-30 19:14:02 +00:00
NEXTCLOUD_TRUSTED_DOMAINS="file.ducamps.win"
2022-05-02 19:32:42 +00:00
POSTGRES_HOST="db1.ducamps.win"
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
}
}
}
}