fix: deploy

This commit is contained in:
Urko. 2023-12-25 10:05:19 +01:00
parent f1e55131d9
commit d17a0434a3
1 changed files with 11 additions and 6 deletions

View File

@ -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