49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#--label "traefik.http.routers.${UUID}.middlewares=cors-headers@file" \
|
|
echo "Start N8N container ${UUID}"
|
|
|
|
# Get the hostname of the machine
|
|
HOSTNAME=$(hostname)
|
|
|
|
mkdir -p /4server/data/${UUID}/n8n
|
|
mkdir -p /4server/data/${UUID}/data
|
|
|
|
chmod 777 /4server/data/${UUID}/n8n
|
|
chmod 777 /4server/data/${UUID}/data
|
|
|
|
|
|
# Stop the container if it exists
|
|
if docker ps -a --format '{{.Names}}' | grep -q "^${UUID}$"; then
|
|
echo "$(date '+%Y-%m-%d %H:%M') - stopping existing container $UUID"
|
|
docker stop "$UUID"
|
|
docker rm "$UUID"
|
|
fi
|
|
|
|
|
|
|
|
docker run -d \
|
|
--name "$UUID" \
|
|
-p 5678 \
|
|
--cap-add=SYS_ADMIN \
|
|
--security-opt seccomp=unconfined \
|
|
--restart=always \
|
|
-e N8N_HOST="${UUID}.odoo4projects.com" \
|
|
-e N8N_PORT=5678 \
|
|
-e N8N_PROTOCOL=https \
|
|
-e NODE_ENV=production \
|
|
-e WEBHOOK_URL="https://${UUID}.odoo4projects.com/" \
|
|
-e GENERIC_TIMEZONE="UTC-3" \
|
|
-e N8N_CUSTOM_EXTENSIONS="/usr/local/share/n8n/custom" \
|
|
-v "/4server/data/${UUID}/n8n:/home/node/.n8n" \
|
|
-v "/4server/data/${UUID}/data:/data" \
|
|
--label "traefik.enable=true" \
|
|
--label "traefik.http.routers.${UUID}.rule=Host(\`${UUID}.odoo4projects.com\`)" \
|
|
--label "traefik.http.routers.${UUID}.entrypoints=web,websecure" \
|
|
--label "traefik.http.routers.${UUID}.tls=true" \
|
|
--label "traefik.http.routers.${UUID}.tls.certresolver=production" \
|
|
--label "traefik.http.services.${UUID}.loadbalancer.server.port=5678" \
|
|
--network 4server_4projects \
|
|
docker.odoo4projects.com/4projects/n8n:release
|
|
|
|
echo "Started $1"
|