diff --git a/deploy.sh b/deploy.sh index 4fb3c22..48f6735 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,16 +1,21 @@ #!/bin/bash -# DEPLOYTIME=$(date +%s%3N) # Check if .env file exists if [ ! -f .env ]; then echo "Error: .env file not found in /var/www/owncloud" exit 1 fi +# Create network if it doesn't exist +if ! docker network ls | grep -q 'web '; then + docker network create --driver=overlay web +fi -export $(cat .env | xargs) +# Automatically export all variables from .env file +set -a +source .env +set +a + +# Deploy the stack envsubst < docker-stack.yml | docker stack deploy selfhosted-owncloud --compose-file=docker-stack.yml --with-registry-auth --resolve-image always -# curl -X POST https://log.spares.nu/api/annotations \ -# -H "Authorization: Bearer eyJrIjoiOGNhQVM5SkNaaEFlQ1FkTDFJNTdPNzhFazVuTko0TTEiLCJuIjoiZGVwbG95IiwiaWQiOjF9" \ -# -H "Content-Type: application/json" \ -# -d "{\"time\":${DEPLOYTIME},\"timeEnd\":${DEPLOYTIME},\"tags\":[\"deploy\"],\"text\":\"Docker Stack Deploy\"}"; echo +