chore: backup Nomad jobs [skip ci]
This commit is contained in:
107
nomad_backup/trilium.hcl
Normal file
107
nomad_backup/trilium.hcl
Normal file
@@ -0,0 +1,107 @@
|
||||
job "trilium" {
|
||||
datacenters = ["dc1"]
|
||||
type = "service"
|
||||
|
||||
group "trilium" {
|
||||
count = 1
|
||||
|
||||
# Prestart restore task
|
||||
task "restore" {
|
||||
driver = "docker"
|
||||
lifecycle {
|
||||
hook = "prestart"
|
||||
sidecar = false
|
||||
}
|
||||
config {
|
||||
image = "litestream/litestream:latest"
|
||||
args = [
|
||||
"restore",
|
||||
"-if-replica-exists",
|
||||
"-if-db-not-exists",
|
||||
"-o", "/alloc/tmp/trilium.db",
|
||||
"sftp://root:odroid@192.168.4.63/mnt/Shares/litestream/trilium.db"
|
||||
|
||||
]
|
||||
volumes = [
|
||||
"/mnt/configs/trilium:/data"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Main trilium task
|
||||
task "trilium" {
|
||||
driver = "docker"
|
||||
config {
|
||||
image = "triliumnext/trilium:stable"
|
||||
force_pull = true # This ensures the image is always pulled
|
||||
memory_hard_limit = "2048"
|
||||
ports = ["http"]
|
||||
volumes = [
|
||||
"/mnt/configs/trilium:/home/node/trilium-data/data",
|
||||
"/mnt/Public/configs/trilium/backup:/home/node/trilium-data/backup",
|
||||
"/mnt/Public/configs/trilium/config:/home/node/trilium-data/config"
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
env {
|
||||
TRILIUM_DATA_DIR="/home/node/trilium-data/data"
|
||||
TRILIUM_BACKUP_DIR="/home/node/trilium-data/backup"
|
||||
TRILIUM_CONFIG_INI_PATH= "/home/node/trilium-data/config/config.ini"
|
||||
|
||||
}
|
||||
resources {
|
||||
cpu = 100
|
||||
memory = 128
|
||||
}
|
||||
service {
|
||||
name = "trilium"
|
||||
tags = [
|
||||
"trilium",
|
||||
"web",
|
||||
"urlprefix-/trilium",
|
||||
"tools",
|
||||
"traefik.http.routers.triliumlan.rule=Host(`trilium.service.dc1.consul`)",
|
||||
"traefik.http.routers.triliumwan.rule=Host(`tril.fbleagh.duckdns.org`)",
|
||||
"traefik.http.routers.triliumwan.middlewares=dex@consulcatalog",
|
||||
"traefik.http.routers.triliumwan.tls=true",
|
||||
]
|
||||
port = "http"
|
||||
check {
|
||||
type = "tcp"
|
||||
interval = "10s"
|
||||
timeout = "2s"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Litestream sidecar for continuous replication
|
||||
task "litestream" {
|
||||
driver = "docker"
|
||||
lifecycle {
|
||||
hook = "poststart" # runs after main task starts
|
||||
sidecar = true
|
||||
}
|
||||
config {
|
||||
image = "litestream/litestream:latest"
|
||||
args = [
|
||||
"replicate",
|
||||
"/alloc/tmp/trilium.db",
|
||||
"sftp://root:odroid@192.168.4.63/mnt/Shares/litestream/trilium.db"
|
||||
]
|
||||
volumes = [
|
||||
"/mnt/configs/trilium:/data"
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
network {
|
||||
port "http" {
|
||||
static = 6699
|
||||
to = 8080
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user