Compare commits

..
12 Commits
Author SHA1 Message Date
xavierandClaude Opus 5.5 2d9d1c0136 Merge branch 'main' into dev
Bring dev up to date with main. dev had nothing pending (its changes were
already in main in newer form), so the merge keeps main's tree as is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018inUJhddwLWVwYhGB8t6RP
2026-11-22 15:57:02 +01:00
xavier 9cd92707d7 Merge pull request 'Dump de la base Gitea et Nextcloud dans le volume data' (#19) from feat/nextcloud-db-dump into main
Reviewed-on: #19
2026-11-22 15:55:53 +01:00
xavierandClaude Opus 5.5 8f5255f36c feat(profiles): nextcloud profile : Add DB dump script and systemd timers
Add a script to dump the DB in the volume dir so DB dumps can be backed
up alongside data files, like the gitea profile.

The DB is much bigger than gitea's (~216 MB of SQL): the dump runs every
4 hours and the last 24 hours are kept. The dump is plain SQL, not
gzipped, so that restic deduplicates between dumps: measured, a gzipped
dump adds ~67 MB to the repository each time, a plain one ~5 MB.

The dump goes through a pipe: the snap's AppArmor profile prevents
nextcloud.mysqldump from writing to a redirected file. --single-transaction
gives a consistent dump without locking the tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018inUJhddwLWVwYhGB8t6RP
2026-11-22 15:55:42 +01:00
xavierandClaude Opus 5.5 b8b847fe68 refactor(profiles): gitea profile : Use explicit variable names in the DB dump script
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:55:42 +01:00
xavierandClaude Opus 5.5 ef76fb8fec fix(profiles): gitea profile : Enable the DB dump timer after installing gitea
The timer was enabled before the snap install, so a first run could fire
while gitea was not installed yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:55:42 +01:00
xavier 200160976e Merge pull request 'Demo/backrest' (#20) from demo/backrest into main
Reviewed-on: #20
2026-11-22 15:51:30 +01:00
xavier a528e569c4 Merge pull request 'chore: minor changes in profiles' (#13) from feature/clean-profiles into dev
Reviewed-on: cloud.logerais.com/lxd-profiles#13
2025-10-11 22:07:47 +02:00
xavier ce80ba0ee8 chore: minor changes in profiles
- reorder keys
- clean useless (dynamic) fields
- rename somes profile to normalize naming
2025-10-11 22:07:37 +02:00
xavier cb09ad0dbd Merge pull request 'feat: Add unattended-upgrades system profile' (#14) from feat/unattended-upgrades-profile into dev
Reviewed-on: cloud.logerais.com/lxd-profiles#14
2025-10-11 22:07:27 +02:00
xavier 25f0947ce2 Merge branch 'dev' into feat/unattended-upgrades-profile 2025-10-11 22:06:44 +02:00
xavier d1d509a584 Merge pull request 'feat: Add profile to install streamrip application' (#15) from feat/streamrip into dev
Reviewed-on: cloud.logerais.com/lxd-profiles#15
2025-10-11 22:06:30 +02:00
xavier 0a363c086a feat: Add profile to install streamrip application 2025-10-11 19:25:47 +02:00
2 changed files with 49 additions and 8 deletions

No files matched your search

+9 -8
View File
@@ -26,12 +26,12 @@ config:
content: | content: |
#!/bin/sh #!/bin/sh
set -eu set -eu
D=/var/snap/gitea/common/dump DIRECTORY=/var/snap/gitea/common/dump
mkdir -p "$D" mkdir -p "${DIRECTORY}"
F="$D/gitea-db-$(date +%Y%m%d-%H%M).tar" FILE="${DIRECTORY}/gitea-db-$(date +%Y%m%d-%H%M).tar"
/snap/bin/gitea dump --skip-repository --skip-lfs-data --skip-attachment-data --skip-package-data --skip-log --skip-custom-dir --skip-index --type tar --file "$F.tmp" /snap/bin/gitea dump --skip-repository --skip-lfs-data --skip-attachment-data --skip-package-data --skip-log --skip-custom-dir --skip-index --type tar --file "${FILE}.tmp"
mv "$F.tmp" "$F" mv "${FILE}.tmp" "${FILE}"
ls -1t "$D"/gitea-db-*.tar | tail -n +25 | xargs -r rm -f -- ls -1t "${DIRECTORY}"/gitea-db-*.tar | tail -n +25 | xargs -r rm -f --
- path: /etc/systemd/system/gitea-db-dump.service - path: /etc/systemd/system/gitea-db-dump.service
content: | content: |
[Unit] [Unit]
@@ -53,7 +53,8 @@ config:
WantedBy=timers.target WantedBy=timers.target
runcmd: runcmd:
- systemctl daemon-reload
- systemctl enable --now gitea-db-dump.timer
# Install gitea # Install gitea
- [ snap, install, gitea ] - [ snap, install, gitea ]
# Enable the DB dump timer once gitea is installed
- systemctl daemon-reload
- systemctl enable --now gitea-db-dump.timer
@@ -21,6 +21,46 @@ config:
shell: /bin/bash shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL'] sudo: ['ALL=(ALL) NOPASSWD:ALL']
write_files:
# The dump goes through a pipe: the snap's AppArmor profile prevents
# nextcloud.mysqldump from writing to a redirected file (empty dump).
# Plain SQL, not gzipped, so that restic deduplicates between dumps
# (a gzipped dump is uploaded in full each time).
# Every 4 hours, the last 24 hours are kept here.
- path: /usr/local/bin/nextcloud-db-dump.sh
permissions: '0755'
content: |
#!/bin/bash
set -euo pipefail
DIRECTORY=/var/snap/nextcloud/common/dump
mkdir -p "${DIRECTORY}"
FILE="${DIRECTORY}/nextcloud-db-$(date +%Y%m%d-%H%M).sql"
/snap/bin/nextcloud.mysqldump --single-transaction --skip-lock-tables | cat > "${FILE}.tmp"
mv "${FILE}.tmp" "${FILE}"
ls -1t "${DIRECTORY}"/nextcloud-db-*.sql | tail -n +7 | xargs -r rm -f --
- path: /etc/systemd/system/nextcloud-db-dump.service
content: |
[Unit]
Description=Dump de la base Nextcloud
[Service]
Type=oneshot
ExecStart=/usr/local/bin/nextcloud-db-dump.sh
- path: /etc/systemd/system/nextcloud-db-dump.timer
content: |
[Unit]
Description=Dump de la base Nextcloud toutes les 4 heures
[Timer]
OnCalendar=*-*-* 00/4:30
Persistent=true
[Install]
WantedBy=timers.target
runcmd: runcmd:
# Install Nextcloud # Install Nextcloud
- [ snap, install, nextcloud ] - [ snap, install, nextcloud ]
# Enable the DB dump timer once Nextcloud is installed
- systemctl daemon-reload
- systemctl enable --now nextcloud-db-dump.timer