Skip to content

Revert: Deploy watchtower on UGNAS #61

Revert: Deploy watchtower on UGNAS

Revert: Deploy watchtower on UGNAS #61

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy (${{ matrix.config.stack_name }}, ${{ matrix.config.host }})
runs-on: self-hosted
strategy:
matrix:
config:
- { stack_name: 'arr-stack', host: 'tcp://192.168.2.102:2375' }
- { stack_name: 'portainer', host: 'tcp://192.168.2.102:2375' }
- { stack_name: 'uptime-kuma', host: 'tcp://192.168.2.102:2375' }
- { stack_name: 'n8n', host: 'tcp://192.168.2.102:2375' }
- { stack_name: 'wallos', host: 'tcp://192.168.2.102:2375' }
- { stack_name: 'cadvisor', host: 'tcp://192.168.2.102:2375' }
- { stack_name: 'cadvisor', host: 'tcp://192.168.2.107:2375' }
- { stack_name: 'cadvisor', host: 'tcp://192.168.2.108:2375' }
- { stack_name: 'watchtower', host: 'tcp://192.168.2.102:2375', ntfy_title: 'Docker_102', ntfy_topic: 'ehcan-docker-PVBwxrR8Hm'}
- { stack_name: 'watchtower', host: 'tcp://192.168.2.107:2375', ntfy_title: 'Traefik_107', ntfy_topic: 'ehcan-traefik-pVRanLAbLF'}
- { stack_name: 'watchtower', host: 'tcp://192.168.2.108:2375', ntfy_title: 'Grafana_108', ntfy_topic: 'ehcan-grafana-vpSU2BdGnR'}
env:
DOCKER_HOST: ${{ matrix.config.host }}
DOCKER_CONTEXT_NAME: ${{ matrix.config.stack_name }}-ctx
DOCKER_COMPOSE_FILE: ${{ matrix.config.stack_name }}.yml
DOCKER_PROJECT_NAME: ${{ matrix.config.stack_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker context
run: |
docker context \
create ${{ env.DOCKER_CONTEXT_NAME }} \
--docker host=${{ env.DOCKER_HOST }}
- name: Inject secrets (arr-stack)
if: env.DOCKER_PROJECT_NAME == 'arr-stack'
run: |
echo "${{ secrets.ARR_CIFS }}" >> $GITHUB_ENV
- name: Inject secrets (firefox-vpn)
if: env.DOCKER_PROJECT_NAME == 'firefox-vpn'
run: |
echo "${{ secrets.GLUETUN_SECRETS }}" > gluetun_secrets.env
- name: Inject Watchtower configs
if: env.DOCKER_PROJECT_NAME == 'watchtower'
run: |
echo "NTFY_TITLE=${{ matrix.config.ntfy_title }}" >> $GITHUB_ENV
echo "NTFY_TOPIC=${{ matrix.config.ntfy_topic }}" >> $GITHUB_ENV
- name: Deploy with Docker Compose
run: |
docker --context ${{ env.DOCKER_CONTEXT_NAME }} compose --file ${{ env.DOCKER_COMPOSE_FILE }} pull
docker --context ${{ env.DOCKER_CONTEXT_NAME }} compose --file ${{ env.DOCKER_COMPOSE_FILE }} \
--project-name ${{ env.DOCKER_PROJECT_NAME }} up -d --remove-orphans
- name: Cleanup Docker context
if: always()
run: |
docker context rm ${{ env.DOCKER_CONTEXT_NAME }} --force