nomad

HCL and Docker files for Nomad deployments
git clone https://git.in0rdr.ch/nomad.git
Log | Files | Refs | Pull requests |Archive

hortusfox.nomad (3041B)


      1 # https://github.com/danielbrendel/hortusfox-web/blob/main/README.md
      2 # https://github.com/danielbrendel/hortusfox-web/blob/main/docker-compose.yml
      3 
      4 job "hortusfox" {
      5   datacenters = ["dc1"]
      6 
      7   vault {}
      8 
      9   group "server" {
     10     count = 1
     11 
     12     volume "tls" {
     13       type = "csi"
     14       source = "certbot"
     15       access_mode = "multi-node-multi-writer"
     16       attachment_mode = "file-system"
     17     }
     18     volume "hortusfox-img" {
     19       type = "csi"
     20       source = "hortusfox-img"
     21       access_mode = "multi-node-multi-writer"
     22       attachment_mode = "file-system"
     23     }
     24     volume "hortusfox-logs" {
     25       type = "csi"
     26       source = "hortusfox-logs"
     27       access_mode = "multi-node-multi-writer"
     28       attachment_mode = "file-system"
     29     }
     30     volume "hortusfox-backup" {
     31       type = "csi"
     32       source = "hortusfox-backup"
     33       access_mode = "multi-node-multi-writer"
     34       attachment_mode = "file-system"
     35     }
     36     volume "hortusfox-themes" {
     37       type = "csi"
     38       source = "hortusfox-themes"
     39       access_mode = "multi-node-multi-writer"
     40       attachment_mode = "file-system"
     41     }
     42     volume "hortusfox-migrations" {
     43       type = "csi"
     44       source = "hortusfox-migrations"
     45       access_mode = "multi-node-multi-writer"
     46       attachment_mode = "file-system"
     47     }
     48 
     49     network {
     50       port "http" {
     51         to = 80
     52       }
     53       port "https" {
     54         static = 44413
     55       }
     56     }
     57 
     58     task "nginx" {
     59       driver = "podman"
     60 
     61       config {
     62         image = "docker.io/library/nginx:stable-alpine"
     63         ports = ["https"]
     64         volumes = [
     65           # mount the templated config from the task directory to the container
     66           "local/hortusfox.conf:/etc/nginx/conf.d/hortusfox.conf",
     67         ]
     68       }
     69 
     70       volume_mount {
     71         volume = "tls"
     72         destination = "/etc/letsencrypt"
     73       }
     74 
     75       template {
     76         destination = "${NOMAD_TASK_DIR}/hortusfox.conf"
     77         data = file("./templates/nginx.conf.tmpl")
     78       }
     79 
     80       resources {
     81         memory = 50
     82         memory_max = 256
     83         cpu    = 200
     84       }
     85     }
     86 
     87     task "hortusfox" {
     88       driver = "podman"
     89 
     90       config {
     91         image = "ghcr.io/danielbrendel/hortusfox-web:latest"
     92         force_pull = true
     93         ports = ["http"]
     94       }
     95 
     96       volume_mount {
     97         volume = "hortusfox-img"
     98         destination = "/var/www/html/public/img"
     99       }
    100       volume_mount {
    101         volume = "hortusfox-backup"
    102         destination = "/var/www/html/public/backup"
    103       }
    104       volume_mount {
    105         volume = "hortusfox-themes"
    106         destination = "/var/www/html/public/themes"
    107       }
    108       volume_mount {
    109         volume = "hortusfox-logs"
    110         destination = "/var/www/html/app/logs"
    111       }
    112       volume_mount {
    113         volume = "hortusfox-migrations"
    114         destination = "/var/www/html/app/migrations"
    115       }
    116 
    117       template {
    118         env = true
    119         destination = "${NOMAD_SECRETS_DIR}/env"
    120         data = file("./templates/env.tmpl")
    121       }
    122 
    123       resources {
    124         memory = 512
    125         memory_max = 1024
    126         cpu    = 500
    127       }
    128     }
    129   }
    130 }