Move wordpress to NFS.

This removes the need for the syncthing and rysnc plumbing.
This commit is contained in:
2025-10-22 15:01:01 +01:00
parent 2437d46aa9
commit f8aee0d438
4 changed files with 2 additions and 86 deletions

View File

@@ -1,11 +1,10 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
# Compute node: Cluster node with Nomad, GlusterFS server, and Syncthing # Compute node: Cluster node with Nomad and GlusterFS server
# Used by: c1, c2, c3 # Used by: c1, c2, c3
imports = [ imports = [
./cluster-node.nix ./cluster-node.nix
./glusterfs.nix ./glusterfs.nix
./nomad.nix ./nomad.nix
./syncthing-data.nix
]; ];
} }

View File

@@ -1,53 +0,0 @@
{
# TODO: when deploying this to a new machine for the first time, first
# comment this out to get /data/sync created with the right owner and
# permissions. then, do it again with persistence enabled.
# This could list the owner user but I'm not sure if it's already created at
# the time impermanence setup runs.
# Note: chown syncthing:syncthing /data/sync && chmod 700 /data/sync also seems to work
environment.persistence."/persist".directories = [ "/data/sync" ];
services.syncthing = {
enable = true;
dataDir = "/data/sync";
openDefaultPorts = true;
#guiAddress = "0.0.0.0:8384";
overrideDevices = true;
overrideFolders = true;
settings = {
devices = {
"c1" = {
id = "XJECP3R-AZHCAYX-UIQKHIT-AHBK5UM-KM7T4OV-B7SEUCW-ZE2UFPG-7BNAIQZ";
};
"c2" = {
id = "II4XUXQ-7WCH3SB-FU655O7-NI6DYYW-GQCJS6J-K7USRC2-XLM5J5W-6ZCWPQU";
};
"c3" = {
id = "D3C3YII-A3QGUNF-LHOGZNX-GJ4ZF3X-VVLMNY5-BBKF3BO-KNHKJMD-EA5QYQJ";
};
"zippy" = {
id = "WXDYZWN-JG2OBQH-CC42RMM-LPJGTS6-Y2BV37J-TYSLHL4-VHGYL5M-URI42QJ";
};
};
folders = {
"wordpress" = {
path = "/data/sync/wordpress";
devices = [
"c1"
"c2"
"c3"
"zippy"
];
ignorePerms = false;
versioning = {
type = "staggered";
params = {
cleanInterval = "3600";
maxAge = "15768000";
};
};
};
};
};
};
}

View File

@@ -1,30 +0,0 @@
job "wordpress-backup" {
datacenters = ["alo"]
type = "batch"
periodic {
crons = ["*/5 * * * * *"]
prohibit_overlap = true
}
group "cron" {
task "rsync" {
driver = "raw_exec"
config {
command = "/bin/sh"
args = [ "local/script.sh" ]
}
template {
destination = "local/script.sh"
data = <<EOH
set -e
/run/current-system/sw/bin/rsync -a /data/sync/wordpress/ /data/compute/appdata/wordpress/ && \
echo "last_success $(date +%s)" | \
/run/current-system/sw/bin/curl --data-binary @- http://pushgateway.service.consul:9091/metrics/job/wordpress_backup
EOH
}
}
}
}

View File

@@ -20,7 +20,7 @@ job "wordpress" {
image = "gitea.v.paler.net/ppetru/wordpress" image = "gitea.v.paler.net/ppetru/wordpress"
ports = ["http"] ports = ["http"]
volumes = [ volumes = [
"/data/sync/wordpress:/var/www/html", "/data/services/wordpress:/var/www/html",
"local/php-custom.ini:/usr/local/etc/php/conf.d/php-custom.ini", "local/php-custom.ini:/usr/local/etc/php/conf.d/php-custom.ini",
] ]
} }