chore: backup infrastructure configurations [skip ci]
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"backup_timestamp": "2025-11-26T02:00:46.427516",
|
||||
"backup_timestamp": "2025-11-27T02:00:45.033278",
|
||||
"total_keys": 79,
|
||||
"successful_backups": 74,
|
||||
"failed_backups": 5,
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"conn_url":"postgres://192.168.4.226:5432/postgres","api_url":"http://192.168.4.226:8008/patroni","state":"running","role":"replica","version":"4.0.4","xlog_location":590757289528,"replication_state":"streaming","timeline":248}
|
||||
{"conn_url":"postgres://192.168.4.226:5432/postgres","api_url":"http://192.168.4.226:8008/patroni","state":"running","role":"replica","version":"4.0.4","xlog_location":591801262376,"replication_state":"streaming","timeline":248}
|
||||
@@ -1 +1 @@
|
||||
{"conn_url":"postgres://192.168.4.227:5432/postgres","api_url":"http://192.168.4.227:8008/patroni","state":"running","role":"replica","version":"4.0.4","xlog_location":590757274112,"replication_state":"streaming","timeline":248}
|
||||
{"conn_url":"postgres://192.168.4.227:5432/postgres","api_url":"http://192.168.4.227:8008/patroni","state":"running","role":"replica","version":"4.0.4","xlog_location":591801239752,"replication_state":"streaming","timeline":248}
|
||||
@@ -1 +1 @@
|
||||
{"conn_url":"postgres://192.168.4.228:5432/postgres","api_url":"http://192.168.4.228:8008/patroni","state":"running","role":"primary","version":"4.0.4","xlog_location":590757273600,"timeline":248}
|
||||
{"conn_url":"postgres://192.168.4.228:5432/postgres","api_url":"http://192.168.4.228:8008/patroni","state":"running","role":"primary","version":"4.0.4","xlog_location":591801239752,"timeline":248}
|
||||
@@ -1 +1 @@
|
||||
{"conn_url":"postgres://192.168.4.36:5432/postgres","api_url":"http://192.168.4.36:8008/patroni","state":"running","role":"replica","version":"4.0.4","xlog_location":590757297544,"replication_state":"streaming","timeline":248}
|
||||
{"conn_url":"postgres://192.168.4.36:5432/postgres","api_url":"http://192.168.4.36:8008/patroni","state":"running","role":"replica","version":"4.0.4","xlog_location":591801281992,"replication_state":"streaming","timeline":248}
|
||||
@@ -1 +1 @@
|
||||
{"optime":590757346904,"slots":{"pg_odroid6":590757346904,"pg_odroid7":590757346904,"pg_opti1":590757346904,"pg_odroid8":590757346904},"retain_slots":["pg_odroid6","pg_odroid7","pg_odroid8","pg_opti1"]}
|
||||
{"optime":591801239752,"slots":{"pg_odroid6":591801239752,"pg_odroid7":591801239752,"pg_opti1":591801239752,"pg_odroid8":591801239752},"retain_slots":["pg_odroid6","pg_odroid7","pg_odroid8","pg_opti1"]}
|
||||
@@ -2,6 +2,12 @@ job "trilium" {
|
||||
datacenters = ["dc1"]
|
||||
type = "service"
|
||||
|
||||
constraint {
|
||||
attribute = "${node.unique.name}"
|
||||
value = "odroid7"
|
||||
}
|
||||
|
||||
|
||||
group "trilium" {
|
||||
count = 1
|
||||
|
||||
@@ -38,7 +44,7 @@ job "trilium" {
|
||||
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/backup:/home/node/backup",
|
||||
"/mnt/Public/configs/trilium/config:/home/node/trilium-data/config"
|
||||
|
||||
|
||||
@@ -46,8 +52,8 @@ job "trilium" {
|
||||
}
|
||||
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"
|
||||
TRILIUM_BACKUP_DIRxx="/home/node/backup"
|
||||
TRILIUM_CONFIG_INI_PATH="/home/node/trilium-data/config/config.ini"
|
||||
|
||||
}
|
||||
resources {
|
||||
@@ -75,6 +81,46 @@ job "trilium" {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#inside group "trilium" ...rsync sidecar to copy trilium native backup to public
|
||||
|
||||
task "rsync-sidecar" {
|
||||
driver = "docker"
|
||||
|
||||
lifecycle {
|
||||
hook = "poststart"
|
||||
sidecar = true
|
||||
}
|
||||
|
||||
config {
|
||||
image = "alpine:latest"
|
||||
command = "/bin/sh"
|
||||
memory_hard_limit = "2048"
|
||||
args = [
|
||||
"-c",
|
||||
# 1. Install rsync
|
||||
# 2. Enter infinite loop
|
||||
# 3. Rsync data -> backup
|
||||
# 4. Sleep 30 mins (1800 seconds)
|
||||
"apk add --no-cache rsync && while true; do echo '[Sidecar] Starting rsync...'; rsync -av --delete /data/ /backup/; echo '[Sidecar] Done. Sleeping 30m...'; sleep 1800; done"
|
||||
]
|
||||
|
||||
# Ensure these match the paths you want to sync
|
||||
volumes = [
|
||||
"/mnt/configs/trilium:/data", # Source
|
||||
"/mnt/Public/configs/trilium/backup:/backup" # Destination
|
||||
]
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 50
|
||||
memory = 50
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Litestream sidecar for continuous replication
|
||||
task "litestream" {
|
||||
driver = "docker"
|
||||
@@ -86,7 +132,7 @@ job "trilium" {
|
||||
image = "litestream/litestream:latest"
|
||||
args = [
|
||||
"replicate",
|
||||
"/alloc/tmp/trilium.db",
|
||||
"/data/document.db",
|
||||
"sftp://root:odroid@192.168.4.63/mnt/Shares/litestream/trilium.db"
|
||||
]
|
||||
volumes = [
|
||||
|
||||
Reference in New Issue
Block a user