diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index ec5e090..bbefdd7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -104,3 +104,28 @@ jobs: docker compose up -d --remove-orphans docker image prune -f EOF + + notify: + - name: Wait for ntfy service to be healthy + run: | + ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP ' + echo "Waiting for ntfy container..." + for i in {1..30}; do + STATUS=$(docker inspect --format="{{json .State.Health.Status }}" ntfy) + if [[ $STATUS == "\"healthy\"" ]]; then + echo "ntfy is healthy!" + exit 0 + fi + echo "ntfy not ready yet ($STATUS). Retrying..." + sleep 2 + done + echo "Error: ntfy did not become healthy in time." + exit 1 + ' + + - name: Notify ntfy + run: | + curl -d "🚀 Deployment successful: $IMAGE_NAME:$GITHUB_SHA" \ + https://ntfy.nicosaya.com/server-deploy + + \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index d31b858..27b49fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,3 +18,18 @@ services: - "3000:5173" depends_on: - backend + + services: + ntfy: + image: binwiederhier/ntfy + ports: + - 8081:80 + volumes: + - ./ntfy/cache:/var/cache/ntfy + - ./ntfy/etc:/etc/ntfy + restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "-qO-", "http://localhost/"] + interval: 5s + timeout: 3s + retries: 10 \ No newline at end of file