mirror of
https://gitlab.sectorq.eu/home/docker-compose.git
synced 2025-12-13 18:04:54 +01:00
build
This commit is contained in:
@@ -27,12 +27,12 @@ services:
|
||||
stop_grace_period: 60s
|
||||
deploy:
|
||||
labels:
|
||||
homepage.container: n8n
|
||||
homepage.container: n8n_n8n
|
||||
homepage.description: Workflow management
|
||||
homepage.group: Utils
|
||||
homepage.href: https://${APPNAME}.sectorq.eu
|
||||
homepage.icon: /icons/n8n.svg
|
||||
homepage.name: n8n_n8n
|
||||
homepage.name: n8n
|
||||
homepage.server: my-docker-swarm
|
||||
wud.watch: 'true'
|
||||
wud.watch.digest: 'true'
|
||||
|
||||
26
__swarm/regsync/regsync-swarm.yml
Normal file
26
__swarm/regsync/regsync-swarm.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
volumes:
|
||||
regsync:
|
||||
driver: local
|
||||
services:
|
||||
regsync:
|
||||
command: -c /home/appuser/regsync.yml server
|
||||
env_file:
|
||||
- stack.env
|
||||
image: ${DOCKER_REGISTRY:-}ghcr.io/regclient/regsync:latest
|
||||
logging:
|
||||
driver: loki
|
||||
options:
|
||||
loki-url: http://192.168.77.101:3100/loki/api/v1/push
|
||||
network_mode: host
|
||||
stdin_open: true
|
||||
volumes:
|
||||
- regsync:/home/appuser/
|
||||
- /etc/localtime:/etc/localtime
|
||||
deploy:
|
||||
labels:
|
||||
wud.watch: 'true'
|
||||
wud.watch.digest: 'true'
|
||||
replicas: 1
|
||||
placement:
|
||||
constraints:
|
||||
- node.role == manager
|
||||
58
copu_to_volume.py
Normal file
58
copu_to_volume.py
Normal file
@@ -0,0 +1,58 @@
|
||||
import docker
|
||||
import os
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description="Portainer helper - use env vars or pass credentials.")
|
||||
|
||||
parser.add_argument("--volume_name","-v", type=str, default=None, help="Volume name")
|
||||
parser.add_argument("--source_dir","-s", type=str, default=None, help="Source directory to copy from")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def copy_to_volume(volume_name, source_dir, container_path="/data", image="busybox:latest"):
|
||||
"""
|
||||
Copy all files from source_dir into a Docker volume using a temporary container.
|
||||
Creates the volume if it does not exist.
|
||||
|
||||
:param volume_name: Name of the Docker volume
|
||||
:param source_dir: Local directory to copy
|
||||
:param container_path: Path inside the container where volume is mounted
|
||||
:param image: Temporary container image
|
||||
"""
|
||||
client = docker.from_env()
|
||||
|
||||
if not os.path.isdir(source_dir):
|
||||
raise ValueError(f"Source directory {source_dir} does not exist")
|
||||
|
||||
# Check if volume exists
|
||||
try:
|
||||
volume = client.volumes.get(volume_name)
|
||||
print(f"Volume '{volume_name}' exists.")
|
||||
except docker.errors.NotFound:
|
||||
print(f"Volume '{volume_name}' does not exist. Creating...")
|
||||
volume = client.volumes.create(name=volume_name)
|
||||
print(f"Volume '{volume_name}' created.")
|
||||
|
||||
print(f"Copying files from {source_dir} to volume '{volume_name}'...")
|
||||
|
||||
# Run temporary container to copy files
|
||||
client.containers.run(
|
||||
image,
|
||||
command=f"sh -c 'cp -r /tmp/* {container_path}/'",
|
||||
volumes={
|
||||
volume_name: {"bind": container_path, "mode": "rw"},
|
||||
os.path.abspath(source_dir): {"bind": "/tmp", "mode": "ro"}
|
||||
},
|
||||
remove=True,
|
||||
detach=False
|
||||
)
|
||||
|
||||
print("Files copied successfully.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Example usage
|
||||
copy_to_volume(
|
||||
volume_name=args.volume_name,
|
||||
source_dir=args.source_dir,
|
||||
container_path="/data"
|
||||
)
|
||||
@@ -18,7 +18,7 @@ services:
|
||||
- N8N_SECURE_COOKIE=false
|
||||
- WEBHOOK_URL=https://n8n.sectorq.eu
|
||||
volumes:
|
||||
- /share/docker_data/n8n/n8n-data:/home/node/.n8n
|
||||
- n8n-data:/home/node/.n8n
|
||||
restart: ${RESTART:-unless-stopped}
|
||||
stop_grace_period: 60s
|
||||
labels:
|
||||
@@ -30,4 +30,7 @@ services:
|
||||
homepage.name: n8n
|
||||
homepage.server: my-docker
|
||||
wud.watch: true
|
||||
wud.watch.digest: true
|
||||
wud.watch.digest: true
|
||||
volumes:
|
||||
n8n-data:
|
||||
driver: local
|
||||
@@ -1 +1,2 @@
|
||||
pyyaml
|
||||
docker
|
||||
|
||||
Reference in New Issue
Block a user