kopia lustrzana https://github.com/Ovski4/docker-borgbackup-cron
Update the image as the ansible playbooks are now public
rodzic
4dbe8a5394
commit
6c295c60d7
10
README.md
10
README.md
|
@ -15,6 +15,11 @@ docker build -t ovski/borgbackup-cron:latest .
|
|||
Usage
|
||||
-----
|
||||
|
||||
1. Make sure borg is installed on your remote server
|
||||
2. Make sure the public key associated with the given private key is present in the ~/.ssh/authorized_keys file of your remote server
|
||||
3. Replace the value of the environment variables of the following command according to your needs.
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-d \
|
||||
-v /path/to/folder_to_backup:/var/folder_to_backup \
|
||||
|
@ -26,15 +31,12 @@ docker run \
|
|||
-e BORG_REPO_NAME=folder_to_backup \
|
||||
-e BORG_PASSPHRASE=youyouthatsnotgood \
|
||||
-e LOCAL_FOLDER=/var/folder_to_backup \
|
||||
-e GITLAB_USER=gitlab+deploy-token-99999 \
|
||||
-e GITLAB_PASSWORD=keyhereverysecret \
|
||||
ovski/borgbackup-cron
|
||||
```
|
||||
|
||||
You can also use secrets in a stack to store sensitive information.
|
||||
Instead of specifiying environment variables, create the following secrets in /var/secrets (default location):
|
||||
|
||||
```
|
||||
/run/secrets/borg_passphrase
|
||||
/run/secrets/gitlab_user
|
||||
/run/secrets/gitlab_password
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
ansible-playbook /var/ansible/playbooks/borg-backup/main.yml \
|
||||
ansible-playbook /var/borg-backup-playbook/main.yml \
|
||||
-e ssh_connection=$SSH_CONNECTION \
|
||||
-e private_key_path=$PRIVATE_KEY_PATH \
|
||||
-e borg_repo_path=$BORG_REPO_PATH \
|
||||
|
|
|
@ -14,17 +14,8 @@ if [[ -n "$SSH_KNOWN_HOSTS" ]]; then
|
|||
fi
|
||||
|
||||
# Clone ansible playbooks
|
||||
if [[ ! -z "$GITLAB_USER" && ! -z "$GITLAB_PASSWORD" ]]; then
|
||||
echo "Cloning ansible gitlab repository"
|
||||
git clone https://${GITLAB_USER}:${GITLAB_PASSWORD}@gitlab.com/ovski-projects/infra/ansible.git /var/ansible
|
||||
elif [[ -f /run/secrets/gitlab_user && -f /run/secrets/gitlab_password ]]; then
|
||||
GITLAB_USER=$(cat /run/secrets/gitlab_user)
|
||||
GITLAB_PASSWORD=$(cat /run/secrets/gitlab_password)
|
||||
git clone https://${GITLAB_USER}:${GITLAB_PASSWORD}@gitlab.com/ovski-projects/infra/ansible.git /var/ansible
|
||||
else
|
||||
echo "Gitlab credentials not set. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
echo "Cloning ansible gitlab repository"
|
||||
git clone https://gitlab.com/ovski-projects/infra/ansible-playbooks/borg-backup.git /var/borg-backup-playbook
|
||||
|
||||
# Set borg passphrase env variable
|
||||
if [[ -f /run/secrets/borg_passphrase ]]; then
|
||||
|
|
Ładowanie…
Reference in New Issue