Compare commits

...

17 Commits

Author SHA1 Message Date
moritz fa5078eb6e Merge pull request 'chore(deps): update docker docker tag to v29.4.3' (#87) from renovate/docker-29.x into main
Reviewed-on: coop-cloud/backup-bot-two#87
2026-05-12 12:27:35 +00:00
renovate-bot 3bbef4a0de chore(deps): update docker docker tag to v29.4.3 2026-05-12 12:27:22 +00:00
moritz f3924969e8 Merge pull request 'fix backup download instruction and some beautifying' (#90) from doc-download into main
Reviewed-on: coop-cloud/backup-bot-two#90
2026-05-12 12:26:44 +00:00
stevensting ff7c9c5cd8 fix backup download instruction and some beautifying 2026-05-12 12:26:07 +00:00
moritz 25f977c312 Merge pull request 'fix: Use actual CRON_SCHEDULE for swarm-cronjob instead of demo */5' (#88) from fix/3wc/swarm-cronjob-schedule into main
Reviewed-on: coop-cloud/backup-bot-two#88
Reviewed-by: decentral1se <decentral1se@noreply.git.coopcloud.tech>
2026-05-11 15:44:24 +00:00
3wordchant 6255edc834 fix: Use actual CRON_SCHEDULE for swarm-cronjob instead of demo */5 2026-04-11 16:59:25 -04:00
moritz c17c3f0273 chore: publish 2.4.0+2.4.0 release 2026-03-31 19:00:05 +02:00
moritz b1051c7a35 chore(deps): update resticpy to 1.3.0 2026-03-31 18:59:50 +02:00
moritz c2cb524710 fix cronjob output 2026-03-31 18:53:06 +02:00
moritz 1a617f0942 Merge pull request 'chore(deps): update docker docker tag to v29' (#81) from renovate/docker-29.x into main
Reviewed-on: coop-cloud/backup-bot-two#81
2026-03-31 12:30:33 +00:00
renovate-bot dd85f389f4 chore(deps): update docker docker tag to v29 2026-03-25 19:31:23 +00:00
3wordchant 4d7d8fc577 Merge pull request 'fix docs typo' (#83) from hermzz/backup-bot-two:docs-typo into main
Reviewed-on: coop-cloud/backup-bot-two#83
2026-03-14 03:37:22 +00:00
hermzz ef4f0ec87e fix docs typo 2026-03-13 22:30:51 -04:00
val 2f719bc1f7 Merge pull request 'corrected ssh_key secret insert' (#77) from secret_insert_ssh into main
Reviewed-on: coop-cloud/backup-bot-two#77
2026-01-02 12:43:10 +00:00
contraintuitiv 833d87aa14 corrected ssh_key secret insert 2026-01-02 13:25:06 +01:00
iexos 11f1c6bb55 remove default TIMEOUT (abra #596) 2025-12-30 14:06:15 +01:00
3wordchant e972ca24d8 Switch to abra-bot for deployment
Re toolshed/organising#668
2025-09-04 15:22:30 -04:00
8 changed files with 33 additions and 33 deletions
+2 -2
View File
@@ -5,9 +5,9 @@ steps:
- name: publish image - name: publish image
image: plugins/docker image: plugins/docker
settings: settings:
username: 3wordchant username: abra-bot
password: password:
from_secret: git_coopcloud_tech_token_3wc from_secret: git_coopcloud_tech_token_abra_bot
repo: git.coopcloud.tech/coop-cloud/backup-bot-two repo: git.coopcloud.tech/coop-cloud/backup-bot-two
tags: ${DRONE_SEMVER_BUILD} tags: ${DRONE_SEMVER_BUILD}
registry: git.coopcloud.tech registry: git.coopcloud.tech
+2
View File
@@ -4,6 +4,8 @@ SECRET_RESTIC_PASSWORD_VERSION=v1
COMPOSE_FILE=compose.yml COMPOSE_FILE=compose.yml
#TIMEOUT=
RESTIC_REPOSITORY=/backups/restic RESTIC_REPOSITORY=/backups/restic
CRON_SCHEDULE='30 3 * * *' CRON_SCHEDULE='30 3 * * *'
+3 -4
View File
@@ -1,11 +1,10 @@
FROM docker:24.0.7-dind FROM docker:29.4.3-dind
RUN apk add --upgrade --no-cache restic bash python3 py3-pip py3-click py3-docker-py py3-json-logger curl RUN apk add --upgrade --no-cache restic bash python3 py3-pip py3-click py3-docker-py py3-json-logger curl
# Todo use requirements file with specific versions RUN pip install --break-system-packages resticpy==1.3.0
RUN pip install --break-system-packages resticpy==1.0.2
COPY backupbot.py /usr/bin/backup COPY backupbot.py /usr/bin/backup
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]
+18 -18
View File
@@ -79,10 +79,8 @@ Add the key to your `authorized_keys`:
`ssh-copy-id -i backupkey <user>@<hostname>` `ssh-copy-id -i backupkey <user>@<hostname>`
Add your `SSH_KEY` as docker secret: Add your `SSH_KEY` as docker secret:
``` ```
abra app secret insert <backupbot_name> ssh_key v1 """$(cat backupkey) cat backupkey | abra app secret insert <backupbot_name> ssh_key v1
"""
``` ```
> Attention: This command needs to be executed exactly as stated above, because it places a trailing newline at the end, if this is missing you will get the following error: `Load key "/run/secrets/ssh_key": error in libcrypto`
### Restic REST server Storage ### Restic REST server Storage
@@ -139,55 +137,57 @@ Enable basic auth in the env file, by uncommenting the following line:
## Usage ## Usage
Run the cronjob that creates a backup, including the push notifications and docker logging: ### Run the cronjob that creates a backup, including the push notifications and docker logging:
`abra app cmd <backupbot_name> app run_cron` `abra app cmd <backupbot_name> app run_cron`
Create a backup of all apps: ### Create a backup of all apps:
`abra app run <backupbot_name> app -- backup create` `abra app run <backupbot_name> app -- backup create`
> The apps to backup up need to be deployed > The apps to backup up need to be deployed
Create an individual backup: ### Create an individual backup:
`abra app run <backupbot_name> app -- backup --host <target_app_name> create` `abra app run <backupbot_name> app -- backup --host <target_app_name> create`
Create a backup to a local repository: ### Create a backup to a local repository:
`abra app run <backupbot_name> app -- backup create -r /backups/restic` `abra app run <backupbot_name> app -- backup create -r /backups/restic`
> It is recommended to shutdown/undeploy an app before restoring the data > It is recommended to shutdown/undeploy an app before restoring the data
Restore the latest snapshot of all including apps: ### Restore the latest snapshot of all including apps:
`abra app run <backupbot_name> app -- backup restore` `abra app run <backupbot_name> app -- backup restore`
Restore a specific snapshot of an individual app: ### Restore a specific snapshot of an individual app:
`abra app run <backupbot_name> app -- backup --host <target_app_name> restore --snapshot <snapshot_id>` `abra app run <backupbot_name> app -- backup --host <target_app_name> restore --snapshot <snapshot_id>`
Show all snapshots: ### Show all snapshots:
`abra app run <backupbot_name> app -- backup snapshots` `abra app run <backupbot_name> app -- backup snapshots`
Show all snapshots containing a specific app: ### Show all snapshots containing a specific app:
`abra app run <backupbot_name> app -- backup --host <target_app_name> snapshots` `abra app run <backupbot_name> app -- backup --host <target_app_name> snapshots`
Show all files inside the latest snapshot (can be very verbose): ### Show all files inside the latest snapshot (can be very verbose):
`abra app run <backupbot_name> app -- backup ls` `abra app run <backupbot_name> app -- backup ls`
Show specific files inside a selected snapshot: ### Show specific files inside a selected snapshot:
`abra app run <backupbot_name> app -- backup ls --snapshot <snapshot_id> /var/lib/docker/volumes/` `abra app run <backupbot_name> app -- backup ls --snapshot <snapshot_id> /var/lib/docker/volumes/`
Download files from a snapshot: ### Download files from a snapshot:
``` `abra app run <backupbot_name> app -- backup download --snapshot <snapshot_id> --path <absolute_path>`
filename=$(abra app run <backupbot_name> app -- backup download --snapshot <snapshot_id> --path <absolute_path>)
abra app cp <backupbot_name> app:$filename . extract the <path> from the output of the first command and use in the second.
```
`abra app cp <backupbot_name> app:<path> .`
## Run restic ## Run restic
+1 -1
View File
@@ -1,6 +1,6 @@
export SSH_CONFIG_VERSION=v1 export SSH_CONFIG_VERSION=v1
export ENTRYPOINT_VERSION=v17 export ENTRYPOINT_VERSION=v17
export CRONJOB_VERSION=v2 export CRONJOB_VERSION=v3
run_cron () { run_cron () {
schedule="$(crontab -l | tr -s " " | cut -d ' ' -f-5)" schedule="$(crontab -l | tr -s " " | cut -d ' ' -f-5)"
+1 -3
View File
@@ -7,9 +7,7 @@ services:
replicas: 0 replicas: 0
labels: labels:
- "swarm.cronjob.enable=true" - "swarm.cronjob.enable=true"
# Note(3wc): every 5m, testing - "swarm.cronjob.schedule=${CRON_SCHEDULE}"
- "swarm.cronjob.schedule=*/5 * * * *"
# Note(3wc): blank label to be picked up by `abra recipe sync`
restart_policy: restart_policy:
condition: none condition: none
entrypoint: [ "/usr/bin/backup.sh" ] entrypoint: [ "/usr/bin/backup.sh" ]
+3 -3
View File
@@ -2,7 +2,7 @@
version: "3.8" version: "3.8"
services: services:
app: app:
image: git.coopcloud.tech/coop-cloud/backup-bot-two:2.3.0-beta image: git.coopcloud.tech/coop-cloud/backup-bot-two:2.4.0
volumes: volumes:
- "/var/run/docker.sock:/var/run/docker.sock" - "/var/run/docker.sock:/var/run/docker.sock"
- "/var/lib/docker/volumes/:/var/lib/docker/volumes/" - "/var/lib/docker/volumes/:/var/lib/docker/volumes/"
@@ -23,8 +23,8 @@ services:
mode: 666 mode: 666
deploy: deploy:
labels: labels:
- coop-cloud.${STACK_NAME}.version=2.3.0+2.3.0-beta - coop-cloud.${STACK_NAME}.version=2.4.0+2.4.0
- coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-300} - coop-cloud.${STACK_NAME}.timeout=${TIMEOUT}
- coop-cloud.backupbot.enabled=true - coop-cloud.backupbot.enabled=true
#entrypoint: ['tail', '-f','/dev/null'] #entrypoint: ['tail', '-f','/dev/null']
healthcheck: healthcheck:
+3 -2
View File
@@ -4,7 +4,7 @@ set -e
CURL_OPTS="-s" CURL_OPTS="-s"
# Check for basic auth # Check for basic auth
if [ -n "$(cat /run/secrets/push_basicauth)" ] if [ -s /run/secrets/push_basicauth ]
then then
CURL_OPTS="$CURL_OPTS -u $(cat /run/secrets/push_basicauth)" CURL_OPTS="$CURL_OPTS -u $(cat /run/secrets/push_basicauth)"
fi fi
@@ -32,7 +32,8 @@ else
fi fi
eval "$push_start_notification" eval "$push_start_notification"
if [ "$(backup --machine-logs create 2>&1 | tee /tmp/backup.log && (grep -q 'backup finished' /tmp/backup.log))" ] backup --machine-logs create 2>&1 | tee /tmp/backup.log
if grep -q 'backup finished' /tmp/backup.log
then then
eval "$push_success_notification" eval "$push_success_notification"
else else