feat: add systemd install script for daemon-only deployment

The daemon already handles bidirectional sync (SVN→Git polling and
Git→SVN push), so a single systemd service is sufficient. The script
creates a venv, generates svn-mirror.service, and enables it for a
given user (default: gitea). README updated accordingly.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-08-19 13:32:40 +02:00
parent 6c413b6191
commit fc6bca9c03
2 changed files with 200 additions and 5 deletions
+48 -5
View File
@@ -235,14 +235,57 @@ it fetches the new commits from Gitea and runs `sync_git_to_svn`.
- Secret: same as `webhook_secret` in config
- Events: "Push"
### Mode C: Both (recommended)
### Mode C: systemd service (recommended)
Run daemon AND webhook. The daemon handles SVN→Git polling; the webhook
handles instant Git→SVN on developer push.
The daemon handles **bidirectional** sync: SVN→Git polling AND Git→SVN push
on each cycle. One service is all you need.
#### Quick install via script
Use the provided install script to generate and enable the systemd service
running as a given user (e.g. `gitea`):
```bash
screen -dmS daemon python3.11 -m svn_mirror daemon --config /etc/svn-mirror/config.yml
screen -dmS webhook python3.11 -m svn_mirror webhook --config /etc/svn-mirror/config.yml
sudo ./deploy/install.sh --install-dir /opt/svn-git-server --user gitea
```
This will:
- Create a Python virtualenv at `<install-dir>/.venv` and install deps
- Generate `svn-mirror.service`
- Enable the service (auto-start on boot)
Options:
| Option | Default | Description |
|--------|---------|-------------|
| `--install-dir DIR` | *(required)* | Where the code is installed |
| `--user USER` | `gitea` | System user to run the service as |
| `--config FILE` | `<install-dir>/config.yml` | Config file path |
| `--venv DIR` | `<install-dir>/.venv` | Virtualenv path |
| `--uninstall` | — | Remove service instead of installing |
After install, start the service:
```bash
sudo systemctl start svn-mirror
```
Check logs:
```bash
journalctl -u svn-mirror -f
```
To uninstall:
```bash
sudo ./deploy/install.sh --uninstall
```
#### Manual setup (screen/tmux)
```bash
screen -dmS svn-mirror python3.11 -m svn_mirror daemon --config /etc/svn-mirror/config.yml
```
### Mode D: Gitea post-receive hook (filesystem)