Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Use a variable to control the nextcloud version between two containers
- job "nextcloud" {
- datacenters = ["dc1"]
- namespace = "dev"
- type = "service"
- reschedule {
- delay = "30s"
- delay_function = "exponential"
- max_delay = "120s"
- unlimited = true
- }
- group "nextcloud" {
- # Nextcloud takes time to initialze, so we give it a long healthy deadline
- update {
- min_healthy_time = "2m"
- healthy_deadline = "15m"
- progress_deadline = "20m"
- }
- network {
- mode = "bridge"
- port "http" {
- to = 80
- }
- }
- service {
- name = "nextcloud"
- port = "http"
- provider = "nomad"
- check {
- type = "http"
- path = "/"
- interval = "60s"
- timeout = "5s"
- }
- }
- volume "nextcloud" {
- type = "csi"
- source = "nextcloud"
- attachment_mode = "file-system"
- access_mode = "multi-node-multi-writer"
- read_only = false
- }
- volume "nextcloud-postgres" {
- type = "host"
- source = "nextcloud-postgres-dev"
- read_only = false
- }
- task "nextcloud" {
- driver = "docker"
- config {
- image = "nextcloud:28.0.4"
- ports = ["http"]
- group_add = [105] # nextcloud recommends adding render group (which is 105 on host)
- devices = [
- {
- host_path = "/dev/dri"
- container_path = "/dev/dri"
- },
- ]
- }
- env {
- NEXTCLOUD_TRUSTED_DOMAINS = "nextcloud.domain.com 10.1.1.*"
- PHP_UPLOAD_LIMIT = "16G"
- TRUSTED_PROXIES = "172.26.64.0/20" # Nomad bridge network
- REDIS_HOST = "127.0.0.1"
- POSTGRES_HOST = "127.0.0.1"
- POSTGRES_DB = "nextcloud"
- # POSTGRES_USER = ""
- # POSTGRES_PASSWORD = ""
- }
- volume_mount {
- volume = "nextcloud"
- destination = "/var/www/html"
- }
- template {
- destination = "secrets/.env"
- env = true
- change_mode = "restart"
- data = <<-EOF
- {{- range nomadVarListSafe }}
- {{- if nomadVarExists .Path }}
- {{- with nomadVar .Path }}
- {{- range .Tuples }}
- {{ .K }}="{{ .V }}"
- {{- end }}
- {{- end }}
- {{- end }}
- {{- end }}
- EOF
- }
- resources {
- cpu = 500
- memory = 2048
- }
- }
- task "cron" {
- driver = "docker"
- config {
- image = "nextcloud:28.0.4"
- entrypoint = ["/cron.sh"]
- group_add = [105]
- devices = [
- {
- host_path = "/dev/dri"
- container_path = "/dev/dri"
- },
- ]
- }
- env {
- NEXTCLOUD_TRUSTED_DOMAINS = "nextcloud.domain.com 10.1.1.*"
- PHP_UPLOAD_LIMIT = "16G"
- TRUSTED_PROXIES = "172.26.64.0/20" # Nomad bridge network
- REDIS_HOST = "127.0.0.1"
- POSTGRES_HOST = "127.0.0.1"
- POSTGRES_DB = "nextcloud"
- # POSTGRES_USER = ""
- # POSTGRES_PASSWORD = ""
- }
- volume_mount {
- volume = "nextcloud"
- destination = "/var/www/html"
- }
- template {
- destination = "secrets/.env"
- env = true
- change_mode = "restart"
- data = <<-EOF
- {{- range nomadVarListSafe }}
- {{- if nomadVarExists .Path }}
- {{- with nomadVar .Path }}
- {{- range .Tuples }}
- {{ .K }}="{{ .V }}"
- {{- end }}
- {{- end }}
- {{- end }}
- {{- end }}
- EOF
- }
- resources {
- cpu = 100
- memory = 128
- }
- }
- task "redis" {
- driver = "docker"
- config {
- image = "redis:7-alpine"
- }
- resources {
- cpu = 250
- memory = 256
- }
- }
- task "postgres" {
- driver = "docker"
- config {
- image = "postgres:16-alpine"
- }
- env {
- POSTGRES_DB = "nextcloud"
- # POSTGRES_USER = ""
- # POSTGRES_PASSWORD = ""
- }
- volume_mount {
- volume = "nextcloud-postgres"
- destination = "/var/lib/postgresql/data"
- }
- template {
- destination = "secrets/.env"
- env = true
- change_mode = "restart"
- data = <<-EOF
- {{- range nomadVarListSafe }}
- {{- if nomadVarExists .Path }}
- {{- with nomadVar .Path }}
- {{- range .Tuples }}
- {{ .K }}="{{ .V }}"
- {{- end }}
- {{- end }}
- {{- end }}
- {{- end }}
- EOF
- }
- resources {
- cpu = 250
- memory = 256
- }
- }
- restart {
- attempts = 3
- delay = "2m"
- interval = "10m"
- mode = "delay"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment