fix: 修复备份工具的多处问题

- go.mod: 将非法版本号 go 1.26.4 改为 go 1.26
- engine: 压缩失败时删除残留的半截 tar.gz 文件
- config: 支持仅按天数保留(count 和 days 均未设时才用默认 count=7)
- engine: docker compose stop 失败时也尝试重启,避免容器停摆
- list: 仅显示真正的备份归档文件(新增导出 IsBackupArchive)
- systemd: 移除 PrivateTmp,暂存目录改到安装目录内,避免私有 /tmp 被大目录撑爆
This commit is contained in:
2026-07-04 19:12:50 +08:00
parent 5c8944fd58
commit 034edb2b1e
9 changed files with 60 additions and 11 deletions
+3 -3
View File
@@ -54,13 +54,13 @@ sudo mkdir -p /opt/docker-compose-backup
sudo cp docker-compose-backup-linux-arm64 /opt/docker-compose-backup/docker-compose-backup
sudo chmod +x /opt/docker-compose-backup/docker-compose-backup
sudo cp config.yaml /opt/docker-compose-backup/config.yaml
sudo mkdir -p /opt/docker-compose-backup/backups
sudo mkdir -p /opt/docker-compose-backup/backups /opt/docker-compose-backup/tmp
sudo cp docker-compose-backup.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now docker-compose-backup
```
The example config uses `/opt/docker-compose-backup/backups`, which is allowed by the service sandbox.
The example config uses `/opt/docker-compose-backup/backups`, which is allowed by the service sandbox. The unit's `ReadWritePaths` covers the whole install dir, so set `global.temp_dir` to a subdirectory there (e.g. `/opt/docker-compose-backup/tmp`). The unit intentionally does **not** enable `PrivateTmp`, since a private `/tmp` is often small and would be exhausted when copying large project directories.
## Configuration
@@ -69,7 +69,7 @@ See [config.example.yaml](config.example.yaml) for a full annotated example.
```yaml
global:
backup_dir: /opt/docker-compose-backup/backups
temp_dir: /tmp/docker-backup # optional, defaults to OS temp
temp_dir: /opt/docker-compose-backup/tmp # optional, defaults to OS temp
projects:
- name: myapp