diff --git a/docs/modules/files/index.md b/docs/modules/files/index.md index 0b4fe35..af2c602 100644 --- a/docs/modules/files/index.md +++ b/docs/modules/files/index.md @@ -14,7 +14,7 @@ that have recently been created, and are not yet in the database. WROLPi can search any file in your media directory, this can only be accomplished after a full files refresh has been completed. -> To refresh all your files, click the **Files** link in the top navigation bar, then click **Refresh All** found at the +> To refresh all your files, click the **Files** link in the top navigation bar, then click **Refresh** found at the > bottom of the files table. ## Files Tools diff --git a/docs/system/backup.md b/docs/system/backup.md new file mode 100644 index 0000000..0651041 --- /dev/null +++ b/docs/system/backup.md @@ -0,0 +1,53 @@ +# Backup +## Backup from one WROLPi to another + +As of the writing of this tutorial, WROLPi does not have an official way to back up a WROLPi. The current workaround +is to use rsync with a manual refresh. + +Follow these steps to automate backup of your WROLPi. + +1. SSH/login to the primary WROLPi, add a password for the "wrolpi" user + - `sudo -u wrolpi passwd` +2. SSH/login into the backup WROLPi + 1. Switch to the "wrolpi" user: + - `sudo su - wropi` + 2. Generate SSH keys for the wrolpi user: + - `ssh-keygen` + 3. Copy ssh keys to the primary WROLPi (using the password from step 1) + - `ssh-copy-id wrolpi@PRIMARY_IP_ADDRESS` + 4. Ensure the backup can login to the primary by ssh'ing into it from the backup + - `ssh wrolpi@PRIMARY_IP_ADDRESS` + 5. Copy all files from the primary to the backup + - `rsync -avrle ssh wrolpi@PRIMARY_IP_ADDRESS:/media/wrolpi/* /media/wrolpi` + +Files are now synchronized, now you need to automate it. Copy/paste the following into the shell of the backup WROLPI, +it will create a bash script that will copy files from the primary to the backup WROLPi. + +```shell +cat > /home/wrolpi/backup_wrolpi.sh << 'EOF' +#! /usr/bin/env bash +logfile=/home/wrolpi/wrolpi.log + +echo >> ${logfile} +echo >> ${logfile} +echo start $(date +"%Y-%m-%d %H:%M:%S") >> ${logfile} +/usr/bin/rsync \ + --exclude="lost+found" \ + -avue ssh \ + wrolpi@PRIMARY_IP_ADDRESS:/media/wrolpi/* \ + /media/wrolpi/ \ + 2>&1 >> ${logfile} +echo end $(date +"%Y-%m-%d %H:%M:%S") >> ${logfile} + +EOF +``` + +1. Modify the above file (at `/home/wrolpi/backup_wrolpi.sh`), replacing `PRIMARY_IP_ADDRESS` with the correct IP + address. +2. Modify the crontab of the "wrolpi" user so this script runs daily + - `sudo -u wrolpi crontab -e` +3. Add the following cron entry to run the backup script + +```shell +0 4 * * * /bin/bash -l /home/wrolpi/backup_wrolpi.sh +``` \ No newline at end of file diff --git a/docs/system/getting-help.md b/docs/system/getting-help.md index c2ae993..8449661 100644 --- a/docs/system/getting-help.md +++ b/docs/system/getting-help.md @@ -71,6 +71,7 @@ OK: Kiwix app responded OK: The media directory exists OK: Can modify media directory +OK: Media directory is a mounted drive OK: Media directory files are served by nginx OK: Config can be fetched from nginx OK: Media directory is owned by wrolpi user diff --git a/docs/system/special-directories.md b/docs/system/special-directories.md index 80b43d5..19aa5b5 100644 --- a/docs/system/special-directories.md +++ b/docs/system/special-directories.md @@ -1,11 +1,11 @@ -# Special Directories +# Special System Directories | Path | Purpose | |-------------------------|----------------------------------------------------------| | `/media/wrolpi/` | The [Media Directory](#media-directory). | | `/opt/wrolpi/` | The [source code](#wrolpi-source-directory) of WROLPi. | | `/media/wrolpi/config/` | The [configuration files](#wrolpi-config) of the WROLPi. | -| `/opt/wrolpi-blobs/` | Contains files necessary to the repair of a WROLPi. | +| `/opt/wrolpi-blobs/` | Contains files necessary to repair a WROLPi. | | `/opt/wrolpi-help/` | These help files. | ## Media Directory