Skip to content

Conversation

@le-lenn
Copy link
Contributor

@le-lenn le-lenn commented Dec 21, 2025

What?

Fixes #696

How I tested this

  1. create notification-docker-compose.yml
services:
  gotify:
    image: gotify/server:latest
    ports:
      - "8080:80"
    environment:
      - GOTIFY_DEFAULTUSER_PASS=custom
    volumes:
      - gotify_data:/app/data

  backup:
    build: .
    entrypoint: ["/usr/bin/backup"]
    depends_on:
      - gotify
    environment:
      BACKUP_FILENAME: test.tar.gz
      NOTIFICATION_LEVEL: error
      NOTIFICATION_URLS: gotify://gotify/${GOTIFY_TOKEN}?disableTLS=true
      AWS_S3_BUCKET_NAME: missing-bucket
      AWS_ACCESS_KEY_ID_FILE: /tmp/missing
      AWS_SECRET_ACCESS_KEY_FILE: /tmp/missing
    volumes:
      - backup_data:/backup:ro
      - backup_archive:/archive

volumes:
  backup_data:
  backup_archive:
  gotify_data:
  1. Start Gotify:
    • docker compose -f notification-docker-compose.yml up -d gotify
  2. Create a Gotify token:
  3. Run the failing backup with notifications:
    • GOTIFY_TOKEN=$TOKEN docker compose -f notification-docker-compose.yml up --build --exit-code-from backup backup
  4. Verify a message arrived:

Should look like this:

[
  {
    "id": 1,
    "appid": 2,
    "message": "Running docker-volume-backup failed with error: main.(*script).init: error creating s3 storage backend: s3.NewStorageBackend: AWS_S3_BUCKET_NAME is defined, but no credentials were provided\n\nLog output of the failed run was:\n\n",
    "title": "Failure running docker-volume-backup at 2025-12-21T17:39:28Z",
    "priority": 0,
    "date": "2025-12-21T17:39:28.49883576Z"
  }
]

@le-lenn
Copy link
Contributor Author

le-lenn commented Dec 21, 2025

Tests ran locally without errors. Although I had to change a bunch of stuff because of being on a mac and having differing docker desktop setting:

diff --git a/test/docker-compose.yml b/test/docker-compose.yml
index eb4445b..b8f23ca 100644
--- a/test/docker-compose.yml
+++ b/test/docker-compose.yml
@@ -3,6 +3,8 @@ services:
     hostname: manager
     privileged: true
     image: offen/docker-volume-backup:test-sandbox
+    environment:
+      DOCKER_CONFIG: /tmp/docker-config
     healthcheck:
       test: ["CMD", "docker", "info"]
       interval: 1s
@@ -10,7 +12,7 @@ services:
       retries: 50
     volumes:
       - ./:/code
-      - ${HOME}/.docker/config.json:/root/.docker/config.json
+      - docker_config:/tmp/docker-config
       - ${TARBALL:-.}:/cache/image.tar.gz
       - docker_volume_backup_test_sandbox_image:/var/lib/docker/image
       - docker_volume_backup_test_sandbox_containerd:/var/lib/docker/containerd
@@ -20,7 +22,7 @@ services:
     hostname: worker1
     volumes:
       - ./:/code
-      - ${HOME}/.docker/config.json:/root/.docker/config.json
+      - docker_config:/tmp/docker-config
       - ${TARBALL:-.}:/cache/image.tar.gz
       - docker_volume_backup_test_sandbox_image:/var/lib/docker/image
       - docker_volume_backup_test_sandbox_containerd_1:/var/lib/docker/containerd
@@ -31,7 +33,7 @@ services:
     hostname: worker2
     volumes:
       - ./:/code
-      - ${HOME}/.docker/config.json:/root/.docker/config.json
+      - docker_config:/tmp/docker-config
       - ${TARBALL:-.}:/cache/image.tar.gz
       - docker_volume_backup_test_sandbox_image:/var/lib/docker/image
       - docker_volume_backup_test_sandbox_containerd_2:/var/lib/docker/containerd
@@ -43,3 +45,4 @@ volumes:
   docker_volume_backup_test_sandbox_containerd:
   docker_volume_backup_test_sandbox_containerd_1:
   docker_volume_backup_test_sandbox_containerd_2:
+  docker_config:
diff --git a/test/test.sh b/test/test.sh
index c695326..208c7db 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -29,7 +29,7 @@ if [ ! -z "$MATCH_PATTERN" ]; then
   find_args="$find_args -name $MATCH_PATTERN"
 fi
 
-for dir in $(find $find_args | sort); do
+for dir in $(gfind $find_args | sort); do
   dir=$(echo $dir | cut -c 3-)
   echo "################################################"
   echo "Now running ${dir}"
@@ -58,7 +58,7 @@ for dir in $(find $find_args | sort); do
     docker exec $svc /bin/sh -c "docker load -i /cache/image.tar.gz"
   done
 
-  for executable in $(find $dir -type f -executable | sort); do
+  for executable in $(gfind $dir -type f -executable | sort); do
     context="manager"
     if [ -f "$executable.context" ]; then
         context=$(cat "$executable.context")

@m90
Copy link
Member

m90 commented Dec 22, 2025

I went through the commit history and it seems the deadlock I remembered is gone for a while now (and I missed that it's now possible to do what this PR does). One of your changes made me find a slight inconsistency in error handling in runScript which I fixed on your branch.

Once this is green, it's ready to go, thanks for fixing.

@le-lenn
Copy link
Contributor Author

le-lenn commented Dec 22, 2025

Thanks for creating the “offen” collective. I like the concept!

@m90 m90 merged commit 2938b6c into offen:main Dec 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: no failure notification on misconfigured S3 credentials

2 participants