# A weekly backup of a Fablewright instance, for a bare Node install. # # 1. Install: cp deploy/fablewright-backup.service deploy/fablewright-backup.timer /etc/systemd/system/ # 2. Enable: systemctl daemon-reload && systemctl enable --now fablewright-backup.timer # 3. Copy the backups in /var/lib/fablewright/backups off the machine. # # The backup runs beside the app, as the same user, and reads the same # environment. It does not stop the app: the tool copies a live database with # SQLite's own VACUUM INTO. A backup on the same disk is not a backup, so this # unit writes the file and stops there. Copying it elsewhere is the job that makes # it one. [Unit] Description=Back up a Fablewright instance Documentation=https://tangled.org/katsuricata.com/Fablewright After=fablewright.service [Service] Type=oneshot User=fablewright Group=fablewright WorkingDirectory=/opt/fablewright StateDirectory=fablewright StateDirectoryMode=0750 Environment=DATABASE_URL=file:/var/lib/fablewright/fablewright.db Environment=DATA_DIR=/var/lib/fablewright ExecStart=/usr/bin/node /opt/fablewright/scripts/ops.mjs backup --keep 8 NoNewPrivileges=yes PrivateTmp=yes PrivateDevices=yes ProtectSystem=strict ProtectHome=yes ProtectKernelTunables=yes ProtectKernelModules=yes ProtectControlGroups=yes RestrictAddressFamilies=AF_UNIX RestrictNamespaces=yes LockPersonality=yes MemoryDenyWriteExecute=yes ReadWritePaths=/var/lib/fablewright