WordPress Server Setup, Part III

So far, using restic + rclone is the best solution for backing up data to cloud store. The free account of MegaIO got 30Gb capacity. Since the Wordpress web site is not going to have too much data, MegaIO is quite suitable.

overall setup

  • Create MegaIO account
  • Setup rclone for MegaIO
  • Create restic repository for rclone
  • Config cronjob for daily backup
  • Config alias for restic with preset parameter

backup script

#!/bin/bash

DROOT=/home/clam/docker/wordpress
RPATH='rclone:megaio:restic'
TAG='wordpress-taiyip'

cd $DROOT
# docker compose down
docker compose stop
restic -r $RPATH backup -p ~/.restic  --tag $TAG $DROOT
# docker compose up -d
docker compose start

restic -r $RPATH -p ~/.restic  forget -l 50
mused=`mega-df -h | awk 'NR==5 {print $3  "GB/"$7 "GB"}'`

timenow=`date +"%y/%m/%d %H:%M"`

curl -H "Title: CLAMNERD: TaiYip Backup Done ✅" \
    -d "MegaIO ($mused) | $timenow" \
    -u :[secret key] \
    ntfy.7zero8.win/ResticBackup

###

DROOT=/home/clam/docker/wordpress.alva
RPATH='rclone:pcloud:restic'
TAG='wordpress-alva'

cd $DROOT
# docker compose down
docker compose stop
restic -r $RPATH backup -p ~/.restic  --tag $TAG $DROOT
# docker compose up -d
docker compose start

restic -r $RPATH -p ~/.restic  forget -l 30 
# pused=`rclone size pcloud:restic  | tail -1 | cut -d" " -f 3,4`
pused=`restic -r $RPATH -p ~/.restic stats  | awk 'END {print $3,$4}'`


timenow=`date +"%y/%m/%d %H:%M"`

curl -H "Title: CLAMNERD: Alva Backup Done ✅" \
    -d "Pcloud($pused) | $timenow" \
    -u :[secret key] \
    ntfy.7zero8.win/ResticBackup

cronjob (under root)

30 4 * * * /root/scripts/restic-docker-split.sh 2>&1

restic alias

alias mrestic='restic -r rclone:megaio:restic -p ~/.restic --option=rclone.timeout=10m '
alias prestic='restic -r rclone:pcloud:restic -p ~/.restic --option=rclone.timeout=10m '

example of using mrestic

mrestic snapshots   # check backup snapshot
mrestic forget -l 10  # delete and keep last 10 backup
mrestic prune    # repack and modifiy index for deleted files
mrestic restore b129d626 --target /root/restore # restore b129d626 to /root/restore

reference

rclone with restic

https://www.reddit.com/r/rclone/comments/mez3x3/using_rclone_with_restic/

This page was last edited on 2025-01-13 07:33

Powered by Wiki|Docs

This page was last edited on 2025-01-13 07:33

Mac
To whom it may concern

Powered by Wiki|Docs