small memos stuff

This commit is contained in:
counterweight 2025-12-15 23:33:20 +01:00
parent 4cc72da4da
commit 859cd2d8b7
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 6 additions and 7 deletions

View file

@ -14,12 +14,11 @@ memos_tailscale_ip: "100.64.0.4"
# (caddy_sites_dir and subdomain in services_config.yml)
# Remote access (for backup from lapy)
backup_host_name: "memos_box_local"
backup_host: "{{ hostvars.get(backup_host_name, {}).get('ansible_host', backup_host_name) }}"
backup_user: "{{ hostvars.get(backup_host_name, {}).get('ansible_user', 'counterweight') }}"
backup_key_file: "{{ hostvars.get(backup_host_name, {}).get('ansible_ssh_private_key_file', '') }}"
backup_port: "{{ hostvars.get(backup_host_name, {}).get('ansible_port', 22) }}"
# Remote access (for backup from lapy via Tailscale)
backup_host: "{{ memos_tailscale_hostname }}"
backup_user: "counterweight"
backup_key_file: "~/.ssh/counterganzua"
backup_port: 22
# Local backup
local_backup_dir: "{{ lookup('env', 'HOME') }}/memos-backups"

View file

@ -46,7 +46,7 @@
SSH_CMD="ssh -p {{ backup_port }}"
{% endif %}
rsync -az -e "$SSH_CMD" --delete {{ backup_user }}@{{ backup_host }}:{{ backup_data_path }}/ "$BACKUP_DIR/"
rsync -az -e "$SSH_CMD" --rsync-path="sudo rsync" --delete {{ backup_user }}@{{ backup_host }}:{{ backup_data_path }}/ "$BACKUP_DIR/"
# Rotate old backups (keep 14 days)
# Calculate cutoff date (14 days ago) and delete backups older than that