mirror of
https://github.com/sstent/foodplanner.git
synced 2026-01-25 11:11:36 +00:00
adding autopush to nomad
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 44s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 44s
This commit is contained in:
@@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
55
fooplanner.nomad
Normal file
55
fooplanner.nomad
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user