commit 34ad0298e571d8eb2acac9c9440e8e1da748c497 Author: Raphael Martin Date: Sat Nov 25 13:00:24 2023 +0100 inital commit diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..6b832a4 --- /dev/null +++ b/.env.sample @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e6dbf49 --- /dev/null +++ b/README.md @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..653b68d --- /dev/null +++ b/docker-compose.yml @@ -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" \ No newline at end of file diff --git a/init b/init new file mode 100644 index 0000000..7f83d8f --- /dev/null +++ b/init @@ -0,0 +1,7 @@ +#!/bin/bash + +source ./.env + +docker network create $TRAEFIK_NETWORK + +docker compose up -d \ No newline at end of file