inital commit

This commit is contained in:
Raphael Martin 2023-11-25 13:00:24 +01:00
commit 34ad0298e5
5 changed files with 75 additions and 0 deletions

8
.env.sample Normal file
View File

@ -0,0 +1,8 @@
PROJECT_URL=watchtower.localhost
PROJECT_NAME=sample
TRAEFIK_NETWORK=traefik_net
GOTIFY_URL=gotify.localhost
GOTIFY_TOKEN=YOUR_GENERATED_GOTIFY_TOKEN

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

20
README.md Normal file
View File

@ -0,0 +1,20 @@
# traefik watchtower
### get started
generate a token in your gotify and create a .env file
sample .env:
# .env
PROJECT_URL=watchtower.localhost
PROJECT_NAME=sample
GOTIFY_URL=gotify.localhost
GOTIFY_TOKEN=YOUR_GENERATED_GOTIFY_TOKEN
# the traefik network you want to use
TRAEFIK_NETWORK=traefik_net
then execute the first time the init script

39
docker-compose.yml Normal file
View File

@ -0,0 +1,39 @@
version: '1'
networks:
default:
name: "${TRAEFIK_NETWORK}"
external: true
services:
watchtower:
image: "containrrr/watchtower"
container_name: "${PROJECT_NAME}_watchtower"
hostname: "${PROJECT_URL}"
restart: "unless-stopped"
environment:
- "WATCHTOWER_NOTIFICATIONS=gotify"
- "WATCHTOWER_NOTIFICATION_GOTIFY_URL=http://${GOTIFY_URL}"
- "WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN=${GOTIFY_TOKEN}"
- "WATCHTOWER_CLEANUP=true"
- "WATCHTOWER_LABEL_ENABLE=true"
- "WATCHTOWER_INCLUDE_RESTARTING=true"
- "WATCHTOWER_ROLLING_RESTARTING=true"
- "WATCHTOWER_INTERVAL=200"
- "WATCHTOWER_INCLUDE_STOPPED=true"
security_opt:
- "no-new-privileges:true"
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
# Watchtower add to auto update
- "com.centurylinklabs.watchtower.enable=true"
# traefik
- "traefikf.enable=true"
- "traefik.docker.network=${TRAEFIK_NETWORK}"
- "traefik.http.routers.${PROJECT_NAME}_watchtower.entrypoints=websecure"
- "traefik.http.routers.${PROJECT_NAME}_watchtower.rule=Host(`${PROJECT_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_watchtower.tls=true"
- "traefik.http.services.${PROJECT_NAME}_watchtower.loadbalancer.server.port=3000"

7
init Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
source ./.env
docker network create $TRAEFIK_NETWORK
docker compose up -d