diff --git a/__swarm/authentik/docker-compose.yml b/__swarm/authentik/docker-compose.yml index 6621cba..b4ec871 100755 --- a/__swarm/authentik/docker-compose.yml +++ b/__swarm/authentik/docker-compose.yml @@ -33,7 +33,7 @@ services: wud.watch: false restart: ${RESTART:-unless-stopped} volumes: - - /share/docker_data/authentik/database:/var/lib/postgresql/data + - authentik_database:/var/lib/postgresql/data redis: command: --save 60 1 --loglevel warning healthcheck: @@ -50,7 +50,7 @@ services: wud.watch.digest: true restart: ${RESTART:-unless-stopped} volumes: - - redis:/data + - authentik_redis:/data server: command: server depends_on: @@ -84,8 +84,8 @@ services: - ${COMPOSE_PORT_HTTPS:-9453}:9443 restart: ${RESTART:-unless-stopped} volumes: - - /share/docker_data/authentik/media:/media - - /share/docker_data/authentik/custom-templates:/templates + - authentik_media:/media + - authentik_custom-templates:/templates - /var/run/docker.sock:/var/run/docker.sock worker: command: worker @@ -108,12 +108,18 @@ services: user: root volumes: - /var/run/docker.sock:/var/run/docker.sock - - /share/docker_data/authentik/media:/media - - /share/docker_data/authentik/certs:/certs - - /share/docker_data/authentik/custom-templates:/templates + - authentik_media:/media + - authentik_certs:/certs + - authentik_custom-templates:/templates volumes: - database: + authentik_database: driver: local - redis: + authentik_redis: driver: local + authentik_custom-templates: + driver: local + authentik_media: + driver: local + authentik_certs: + driver: local \ No newline at end of file diff --git a/backup_volumes.py b/backup_volumes.py index b3e3990..fd444f1 100644 --- a/backup_volumes.py +++ b/backup_volumes.py @@ -1,7 +1,7 @@ import docker import requests import os - +import time PORTAINER_URL = "https://port.sectorq.eu/api" API_KEY = "ptr_/5RkMCT/j3BTaL32vMSDtXFi76yOXRKVFOrUtzMsl5Y=" HEADERS = {"X-API-Key": f"{API_KEY}"} @@ -78,8 +78,10 @@ def main(): # Backup stacks for stack_name, vols in stack_volumes.items(): stop_stack(stack_name) + #input("Press Enter to continue with backup...") for v in vols: backup_volume(v) + time.sleep(10) # Small delay to ensure stack is fully stopped start_stack(stack_name) # Backup normal volumes diff --git a/copu_to_volume.py b/copu_to_volume.py index 9b1c7f8..df96801 100644 --- a/copu_to_volume.py +++ b/copu_to_volume.py @@ -23,7 +23,11 @@ def copy_to_volume(volume_name, source_dir, container_path="/data", image="busyb if not os.path.isdir(source_dir): raise ValueError(f"Source directory {source_dir} does not exist") - + if not os.listdir(source_dir): + print("Folder is empty") + return 1 + else: + print("Folder is not empty") # Check if volume exists try: volume = client.volumes.get(volume_name) @@ -36,6 +40,7 @@ def copy_to_volume(volume_name, source_dir, container_path="/data", image="busyb print(f"Copying files from {source_dir} to volume '{volume_name}'...") # Run temporary container to copy files + print(container_path) client.containers.run( image, command=f"sh -c 'cp -r /tmp/* {container_path}/'",