mirror of
https://gitlab.sectorq.eu/home/docker-compose.git
synced 2025-12-15 02:44:52 +01:00
build
This commit is contained in:
@@ -33,7 +33,7 @@ services:
|
|||||||
wud.watch: false
|
wud.watch: false
|
||||||
restart: ${RESTART:-unless-stopped}
|
restart: ${RESTART:-unless-stopped}
|
||||||
volumes:
|
volumes:
|
||||||
- /share/docker_data/authentik/database:/var/lib/postgresql/data
|
- authentik_database:/var/lib/postgresql/data
|
||||||
redis:
|
redis:
|
||||||
command: --save 60 1 --loglevel warning
|
command: --save 60 1 --loglevel warning
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -50,7 +50,7 @@ services:
|
|||||||
wud.watch.digest: true
|
wud.watch.digest: true
|
||||||
restart: ${RESTART:-unless-stopped}
|
restart: ${RESTART:-unless-stopped}
|
||||||
volumes:
|
volumes:
|
||||||
- redis:/data
|
- authentik_redis:/data
|
||||||
server:
|
server:
|
||||||
command: server
|
command: server
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -84,8 +84,8 @@ services:
|
|||||||
- ${COMPOSE_PORT_HTTPS:-9453}:9443
|
- ${COMPOSE_PORT_HTTPS:-9453}:9443
|
||||||
restart: ${RESTART:-unless-stopped}
|
restart: ${RESTART:-unless-stopped}
|
||||||
volumes:
|
volumes:
|
||||||
- /share/docker_data/authentik/media:/media
|
- authentik_media:/media
|
||||||
- /share/docker_data/authentik/custom-templates:/templates
|
- authentik_custom-templates:/templates
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
worker:
|
worker:
|
||||||
command: worker
|
command: worker
|
||||||
@@ -108,12 +108,18 @@ services:
|
|||||||
user: root
|
user: root
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- /share/docker_data/authentik/media:/media
|
- authentik_media:/media
|
||||||
- /share/docker_data/authentik/certs:/certs
|
- authentik_certs:/certs
|
||||||
- /share/docker_data/authentik/custom-templates:/templates
|
- authentik_custom-templates:/templates
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
database:
|
authentik_database:
|
||||||
driver: local
|
driver: local
|
||||||
redis:
|
authentik_redis:
|
||||||
driver: local
|
driver: local
|
||||||
|
authentik_custom-templates:
|
||||||
|
driver: local
|
||||||
|
authentik_media:
|
||||||
|
driver: local
|
||||||
|
authentik_certs:
|
||||||
|
driver: local
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import docker
|
import docker
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
PORTAINER_URL = "https://port.sectorq.eu/api"
|
PORTAINER_URL = "https://port.sectorq.eu/api"
|
||||||
API_KEY = "ptr_/5RkMCT/j3BTaL32vMSDtXFi76yOXRKVFOrUtzMsl5Y="
|
API_KEY = "ptr_/5RkMCT/j3BTaL32vMSDtXFi76yOXRKVFOrUtzMsl5Y="
|
||||||
HEADERS = {"X-API-Key": f"{API_KEY}"}
|
HEADERS = {"X-API-Key": f"{API_KEY}"}
|
||||||
@@ -78,8 +78,10 @@ def main():
|
|||||||
# Backup stacks
|
# Backup stacks
|
||||||
for stack_name, vols in stack_volumes.items():
|
for stack_name, vols in stack_volumes.items():
|
||||||
stop_stack(stack_name)
|
stop_stack(stack_name)
|
||||||
|
#input("Press Enter to continue with backup...")
|
||||||
for v in vols:
|
for v in vols:
|
||||||
backup_volume(v)
|
backup_volume(v)
|
||||||
|
time.sleep(10) # Small delay to ensure stack is fully stopped
|
||||||
start_stack(stack_name)
|
start_stack(stack_name)
|
||||||
|
|
||||||
# Backup normal volumes
|
# Backup normal volumes
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ def copy_to_volume(volume_name, source_dir, container_path="/data", image="busyb
|
|||||||
|
|
||||||
if not os.path.isdir(source_dir):
|
if not os.path.isdir(source_dir):
|
||||||
raise ValueError(f"Source directory {source_dir} does not exist")
|
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
|
# Check if volume exists
|
||||||
try:
|
try:
|
||||||
volume = client.volumes.get(volume_name)
|
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}'...")
|
print(f"Copying files from {source_dir} to volume '{volume_name}'...")
|
||||||
|
|
||||||
# Run temporary container to copy files
|
# Run temporary container to copy files
|
||||||
|
print(container_path)
|
||||||
client.containers.run(
|
client.containers.run(
|
||||||
image,
|
image,
|
||||||
command=f"sh -c 'cp -r /tmp/* {container_path}/'",
|
command=f"sh -c 'cp -r /tmp/* {container_path}/'",
|
||||||
|
|||||||
Reference in New Issue
Block a user