From 1d9017c1a1cdca3a6382e1c678a2ebfa51bff361 Mon Sep 17 00:00:00 2001 From: sstent Date: Thu, 15 Jan 2026 14:25:57 -0800 Subject: [PATCH] adding autopush to nomad --- foodplanner.nomad.hcl | 99 ------------------------------------------- fooplanner.nomad | 55 ++++++++++++++++++++++++ planner.nomad | 98 ------------------------------------------ 3 files changed, 55 insertions(+), 197 deletions(-) delete mode 100644 foodplanner.nomad.hcl create mode 100644 fooplanner.nomad delete mode 100644 planner.nomad diff --git a/foodplanner.nomad.hcl b/foodplanner.nomad.hcl deleted file mode 100644 index 8f15b81..0000000 --- a/foodplanner.nomad.hcl +++ /dev/null @@ -1,99 +0,0 @@ -job "foodplanner" { - datacenters = ["dc1"] - - type = "service" - - group "app" { - count = 1 - - network { - port "http" { - to = 8999 - } - } - - service { - name = "foodplanner" - port = "http" - - check { - type = "http" - path = "/" - interval = "10s" - timeout = "2s" - } - } - - # Prestart restore task - task "restore" { - driver = "docker" - lifecycle { - hook = "prestart" - sidecar = false - } - config { - # image = "litestream/litestream:latest" - image = "litestream/litestream:0.3" - args = [ - "restore", - # "-if-replica-exists", - #"-if-db-not-exists", - "-o", "/alloc/tmp/meal_planner.db", - "sftp://root:odroid@192.168.4.63/mnt/Shares/litestream/foodplanner.db" - ] - volumes = [ - "/opt/nomad/data:/data" - ] - } - } - - task "app" { - driver = "docker" - - config { - image = "ghcr.io/sstent/foodplanner:main" - ports = ["http"] - - # Mount the SQLite database file to persist data - # Adjust the source path as needed for your environment - volumes = [ - "/mnt/Public/configs/FoodPlanner_backups:/app/backups/", - ] - } - env { - DATABASE_PATH = "/alloc/tmp" - DATABASE_URL = "sqlite:////alloc/tmp/meal_planner.db" - } - resources { - cpu = 500 - memory = 1024 - } - - # Restart policy - restart { - attempts = 3 - interval = "10m" - delay = "15s" - mode = "fail" - } - } - - # Litestream sidecar for continuous replication - task "litestream" { - driver = "docker" - lifecycle { - hook = "poststart" # runs after main task starts - sidecar = true - } - config { - # image = "litestream/litestream:0.5.0-test.10" - image = "litestream/litestream:0.3" - args = [ - "replicate", - "/alloc/tmp/meal_planner.db", - "sftp://root:odroid@192.168.4.63/mnt/Shares/litestream/foodplanner.db" - ] - } - } - } -} \ No newline at end of file diff --git a/fooplanner.nomad b/fooplanner.nomad new file mode 100644 index 0000000..fb931fd --- /dev/null +++ b/fooplanner.nomad @@ -0,0 +1,55 @@ +job "foodplanner" { + datacenters = ["dc1"] + + type = "service" + + group "app" { + count = 1 + + network { + port "http" { + to = 8999 + } + } + + service { + name = "foodplanner" + port = "http" + + check { + type = "http" + path = "/" + interval = "10s" + timeout = "2s" + } + } + + + task "app" { + driver = "docker" + + config { + image = "ghcr.io/sstent/foodplanner:main" + ports = ["http"] + } + env { + DATABASE_URL = "postgresql://postgres:postgres@master.postgres.service.dc1.consul/meal_planner" + + } + resources { + cpu = 500 + memory = 1024 + } + + # Restart policy + restart { + attempts = 3 + interval = "10m" + delay = "15s" + mode = "fail" + } + } + + + } +} \ No newline at end of file diff --git a/planner.nomad b/planner.nomad deleted file mode 100644 index f3a8916..0000000 --- a/planner.nomad +++ /dev/null @@ -1,98 +0,0 @@ -job "foodplanner" { - datacenters = ["dc1"] - - type = "service" - - group "app" { - count = 1 - - network { - port "http" { - to = 8999 - } - } - - service { - name = "foodplanner" - port = "http" - - check { - type = "http" - path = "/" - interval = "10s" - timeout = "2s" - } - } - - # Prestart restore task - task "restore" { - driver = "docker" - lifecycle { - hook = "prestart" - sidecar = false - } - config { - # image = "litestream/litestream:latest" - image = "litestream/litestream:0.3" - args = [ - "restore", - # "-if-replica-exists", - #"-if-db-not-exists", - "-o", "/alloc/tmp/meal_planner.db", - "sftp://root:odroid@192.168.4.63/mnt/Shares/litestream/foodplanner.db" - ] - volumes = [ - "/opt/nomad/data:/data" - ] - } - } - - task "app" { - driver = "docker" - - config { - image = "ghcr.io/sstent/foodplanner:main" - ports = ["http"] - - # Mount the SQLite database file to persist data - # Adjust the source path as needed for your environment - volumes = [ - "/mnt/Public/configs/FoodPlanner_backups:/app/backups/", - ] - } - env { - DATABASE_PATH = "/alloc/tmp" - DATABASE_URL = "sqlite:////alloc/tmp/meal_planner.db" - } - resources { - cpu = 500 - memory = 1024 - } - - # Restart policy - restart { - attempts = 3 - interval = "10m" - delay = "15s" - mode = "fail" - } - } - - # Litestream sidecar for continuous replication - task "litestream" { - driver = "docker" - lifecycle { - hook = "poststart" # runs after main task starts - sidecar = true - } - config { - # image = "litestream/litestream:0.5.0-test.10" - image = "litestream/litestream:0.3" - args = [ - "replicate", - "/alloc/tmp/meal_planner.db", - "sftp://root:odroid@192.168.4.63/mnt/Shares/litestream/foodplanner.db" - ] - } - } - }