Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20 adjust documentation and ssh base64 encoding #26

Merged
merged 7 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ SCRIPT_RESTORE_DATA_TO=/path/to/restore/data
# to access log files outside of the container, default not needed (optional)
SCRIPT_LOG_PATH=/path/to/logfiles

### storagebox settings (needed)
ENV_TARGET_DOMAIN=name_of_your_storagebox_domain
ENV_TARGET_DOMAIN_USER=login_name_of_your_storagebox
ENV_SSH_PRIVATE_KEY='your private key between single quotes'
### nextcloud when used
ENV_NC_URL=url_of_your_nextcloud
ENV_NC_USER=your_nextcloud_user
ENV_NC_PASS='password to your nextcloud between single quotes'

### postgres when used
ENV_POSTGRES_USER="user of your postgres database"
ENV_POSTGRES_PASSWORD="password of your postgres database"
ENV_POSTGRES_DATABASE="name of your postgres database"
ENV_POSTGRES_HOST="host of your postgres database"

### restic (needed)
ENV_RESTIC_REPOSITORY_NAME=name_of_your_repository
Expand All @@ -32,13 +38,7 @@ ENV_CRON='0 1 * * *'
### possible values: "postgres", "nextcloud", "none"
ENV_PROVISION_MODE="nextcloud"

### nextcloud when used
ENV_NC_URL=url_of_your_nextcloud
ENV_NC_USER=your_nextcloud_user
ENV_NC_PASS='password to your nextcloud between single quotes'

### postgres when used
ENV_POSTGRES_USER="user of your postgres database"
ENV_POSTGRES_PASSWORD="password of your postgres database"
ENV_POSTGRES_DATABASE="name of your postgres database"
ENV_POSTGRES_HOST="host of your postgres database"
### storagebox settings (needed)
ENV_TARGET_DOMAIN=name_of_your_storagebox_domain
ENV_TARGET_DOMAIN_USER=login_name_of_your_storagebox
ENV_SSH_PRIVATE_KEY_BASE64='your private key between single quotes as base64 encoded string'
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ When used with Hetzner Storagebox, follow this [guide](https://docs.hetzner.com/

### 2. Download the script and .env file
* `curl -O https://raw.githubusercontent.com/realAP/backup/main/run_backup.sh`
* `curl -0 https://raw.githubusercontent.com/realAP/backup/main/.env`
* `curl -O https://raw.githubusercontent.com/realAP/backup/main/.env`
* make the script executable `chmod +x run_backup.sh`

### 3. Set .env file
Fill all needed variables in the `.env` file, it is provided with example values.

* For ``ENV_TELEGRAM_TOKEN`` token see [here](https://core.telegram.org/bots/features#creating-a-new-bot)
* For ``ENV_TELEGRAM_CHAT_ID`` see [here](https://stackoverflow.com/a/32572159)
* For ``ENV_SSH_PRIVATE_KEY_BASE64`` you can use the following command to get the base64 encoded private key in the `.env` file
* ``echo "ENV_SSH_PRIVATE_KEY_BASE=$(cat <insert path of private key> | base64)" >> .env``
* ATTENTION: you have to remove the template key in the `.env` file afterward

### 4. Run Backup
Just run the script `./run_backup.sh` the backup will immediately start and repeat every day at 1am (default).
For the first run, the script will initialize the restic repository.
Expand Down
2 changes: 1 addition & 1 deletion docker/prepare_ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi
ssh-keyscan -t rsa $TARGET_DOMAIN > /etc/ssh/ssh_known_hosts

# Create the private key file
echo "$SSH_PRIVATE_KEY" > /private_key
echo "$SSH_PRIVATE_KEY" | base64 --decode > /private_key
chmod 600 /private_key

# Create the ssh_config file
Expand Down
Loading