2026-02-02 22:15:54 +01:00
|
|
|
# pobsync
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
`pobsync` is a pull-based backup service. It runs on a central backup server and pulls data from remote machines via
|
|
|
|
|
rsync over SSH.
|
2026-02-02 22:15:54 +01:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
The current refactor is SQL-first:
|
2026-02-02 22:15:54 +01:00
|
|
|
|
2026-05-19 05:14:29 +02:00
|
|
|
- Django is the management layer and source of truth.
|
|
|
|
|
- SQLite is the default database; MariaDB is optional.
|
2026-05-19 18:15:34 +02:00
|
|
|
- Backups use the existing rsync snapshot engine internally.
|
2026-05-19 15:59:07 +02:00
|
|
|
- Scheduling is handled by a Django scheduler service, not host cron.
|
2026-05-19 18:15:34 +02:00
|
|
|
- SSH keys can be managed from Django and selected globally or per host.
|
2026-02-02 22:15:54 +01:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
## Recommended Production Install
|
2026-02-02 22:15:54 +01:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
The recommended production deployment is native systemd services on the backup server. Docker Compose remains available
|
|
|
|
|
for development and disposable test installs, but native systemd avoids Docker friction around SSH, filesystem mounts,
|
|
|
|
|
large backup storage, and host-level service logs.
|
2026-05-19 15:59:07 +02:00
|
|
|
|
|
|
|
|
Recommended layout:
|
2026-05-19 04:48:13 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 18:15:34 +02:00
|
|
|
/opt/pobsync/app # installed app checkout
|
2026-05-19 15:59:07 +02:00
|
|
|
/opt/pobsync/venv # Python virtualenv
|
|
|
|
|
/etc/pobsync/pobsync.env # settings and secrets
|
|
|
|
|
/var/lib/pobsync # SQLite database, state, runtime SSH key files, static files
|
2026-05-19 18:15:34 +02:00
|
|
|
/backups # backup storage, or set another absolute path
|
2026-05-19 15:59:07 +02:00
|
|
|
```
|
2026-05-19 04:48:13 +02:00
|
|
|
|
(feature) Add full native installer and self-check page
Expand the systemd installer so it can perform a complete native
installation with sensible defaults: copy the checkout into the target
app directory, create runtime directories, write the environment file,
install dependencies, configure systemd units, and optionally configure
nginx.
Add a staff-only Django self-check page that verifies runtime settings,
required binaries, writable paths, database connectivity, global config
state, and systemd service status when available.
Document installer overrides and expose the self-check from the main
navigation.
2026-05-19 16:05:03 +02:00
|
|
|
From a checked-out copy of this repository, run:
|
2026-05-19 04:53:47 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 15:59:07 +02:00
|
|
|
sudo scripts/install-systemd
|
2026-05-19 04:53:47 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
The installer will, by default:
|
|
|
|
|
|
|
|
|
|
- install required Debian/Ubuntu OS packages with `apt-get`
|
|
|
|
|
- copy the checkout to `/opt/pobsync/app`
|
|
|
|
|
- create `/opt/pobsync/venv`
|
|
|
|
|
- write `/etc/pobsync/pobsync.env` if it does not exist
|
|
|
|
|
- create `/var/lib/pobsync`, `/var/log/pobsync`, and the backup root
|
|
|
|
|
- install Python dependencies
|
|
|
|
|
- run migrations and collect static files
|
|
|
|
|
- install and start `pobsync-web`, `pobsync-worker`, and `pobsync-scheduler`
|
(feature) Add full native installer and self-check page
Expand the systemd installer so it can perform a complete native
installation with sensible defaults: copy the checkout into the target
app directory, create runtime directories, write the environment file,
install dependencies, configure systemd units, and optionally configure
nginx.
Add a staff-only Django self-check page that verifies runtime settings,
required binaries, writable paths, database connectivity, global config
state, and systemd service status when available.
Document installer overrides and expose the self-check from the main
navigation.
2026-05-19 16:05:03 +02:00
|
|
|
|
|
|
|
|
Common overrides:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
sudo scripts/install-systemd \
|
|
|
|
|
--backup-root /mnt/backups/pobsync \
|
|
|
|
|
--allowed-hosts backup.example.com,localhost,127.0.0.1 \
|
|
|
|
|
--csrf-trusted-origins https://backup.example.com
|
|
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
Use `--no-install-os-packages` if you want to manage system packages yourself. Use `--force-env` only when you want the
|
|
|
|
|
installer to rewrite an existing `/etc/pobsync/pobsync.env`.
|
2026-05-19 15:59:07 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
For MariaDB support, add:
|
2026-05-19 12:48:32 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 18:15:34 +02:00
|
|
|
sudo scripts/install-systemd --install-extras mariadb
|
2026-05-19 12:48:32 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
## Services
|
2026-05-19 15:59:07 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
The installer creates:
|
|
|
|
|
|
|
|
|
|
- `pobsync-web.service`: Gunicorn Django control panel on `127.0.0.1:8010`
|
|
|
|
|
- `pobsync-worker.service`: queued backup worker
|
|
|
|
|
- `pobsync-scheduler.service`: SQL-backed schedule dispatcher
|
2026-05-19 15:59:07 +02:00
|
|
|
|
|
|
|
|
Check service state and logs:
|
2026-05-19 05:14:29 +02:00
|
|
|
|
2026-05-19 15:59:07 +02:00
|
|
|
```
|
|
|
|
|
systemctl status pobsync-web pobsync-worker pobsync-scheduler
|
|
|
|
|
journalctl -u pobsync-worker -f
|
|
|
|
|
```
|
2026-05-19 15:33:09 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
Restart after configuration changes:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
sudo systemctl restart pobsync-web pobsync-worker pobsync-scheduler
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Reverse Proxy
|
(feature) Add full native installer and self-check page
Expand the systemd installer so it can perform a complete native
installation with sensible defaults: copy the checkout into the target
app directory, create runtime directories, write the environment file,
install dependencies, configure systemd units, and optionally configure
nginx.
Add a staff-only Django self-check page that verifies runtime settings,
required binaries, writable paths, database connectivity, global config
state, and systemd service status when available.
Document installer overrides and expose the self-check from the main
navigation.
2026-05-19 16:05:03 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
Use an existing reverse proxy by forwarding to:
|
2026-05-19 15:33:09 +02:00
|
|
|
|
2026-05-19 15:59:07 +02:00
|
|
|
```
|
2026-05-19 18:15:34 +02:00
|
|
|
http://127.0.0.1:8010
|
2026-05-19 15:59:07 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
To install a starter nginx site file:
|
2026-05-19 15:33:09 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 15:59:07 +02:00
|
|
|
sudo scripts/install-systemd --with-nginx --server-name backup.example.com
|
2026-05-19 15:33:09 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
For HTTPS behind a reverse proxy, set:
|
2026-05-19 15:33:09 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 18:15:34 +02:00
|
|
|
POBSYNC_DJANGO_ALLOWED_HOSTS=backup.example.com,localhost,127.0.0.1
|
|
|
|
|
POBSYNC_DJANGO_CSRF_TRUSTED_ORIGINS=https://backup.example.com
|
2026-05-19 15:33:09 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
## Django UI
|
2026-05-19 15:59:07 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
After install, open the control panel through your reverse proxy or directly at:
|
2026-05-19 15:33:09 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 18:15:34 +02:00
|
|
|
http://127.0.0.1:8010/
|
2026-05-19 15:33:09 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
Create a superuser if needed:
|
2026-05-19 15:33:09 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 18:15:34 +02:00
|
|
|
sudo -u pobsync /opt/pobsync/venv/bin/python /opt/pobsync/app/manage.py createsuperuser
|
2026-05-19 15:33:09 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
The UI includes:
|
2026-05-19 15:33:09 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
- dashboard and host detail pages
|
|
|
|
|
- global and per-host config forms
|
|
|
|
|
- schedule editing
|
|
|
|
|
- manual backup queueing
|
|
|
|
|
- snapshot discovery
|
|
|
|
|
- SQL retention planning and apply flow
|
|
|
|
|
- Django-managed SSH keys
|
|
|
|
|
- `/self-check/` for runtime checks
|
2026-05-19 14:37:38 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
## SSH Keys
|
2026-05-19 14:37:38 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
SSH keys can be managed from `/ssh-credentials/`. Add a private key, optionally paste `known_hosts` entries, and select
|
|
|
|
|
the credential either as the global default or as a per-host override.
|
2026-05-19 14:37:38 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
When a backup starts, the worker writes the selected key to:
|
2026-05-19 04:48:13 +02:00
|
|
|
|
|
|
|
|
```
|
2026-05-19 18:15:34 +02:00
|
|
|
$POBSYNC_HOME/state/ssh-credentials/<id>/identity
|
2026-05-19 04:48:13 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
The key file is written with `0600` permissions and injected into the rsync SSH command with `IdentityFile`.
|
2026-05-19 04:53:47 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
## Updates
|
2026-05-19 04:53:47 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
From a fresh checkout or the existing app directory:
|
2026-05-19 05:14:29 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
```
|
|
|
|
|
git pull
|
|
|
|
|
sudo scripts/install-systemd --app-dir /opt/pobsync/app
|
|
|
|
|
```
|
2026-05-19 05:14:29 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
Then check:
|
2026-05-19 05:14:29 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
```
|
|
|
|
|
systemctl status pobsync-web pobsync-worker pobsync-scheduler
|
|
|
|
|
```
|
2026-05-19 04:48:13 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
## Development
|
2026-05-19 04:48:13 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
Development, Docker, migration helper commands, and architecture notes live in:
|
2026-05-19 04:48:13 +02:00
|
|
|
|
2026-05-19 18:15:34 +02:00
|
|
|
- [docs/development.md](docs/development.md)
|