watchtower/README.md
GeorgeWebberley 3aef787b5d
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Added README
2026-02-02 21:07:14 +01:00

2.1 KiB

Watchtower Deployment

This repository contains the configuration for Watchtower, a service that automates the process of updating Docker containers. It monitors running containers and watches for changes to the images that those containers were originally started from.

🏗️ Architecture Overview

  • Service: Watchtower
  • Socket Integration: Mounts /var/run/docker.sock to monitor and restart containers.
  • Cleanup: Configured to remove old images after updating (WATCHTOWER_CLEANUP=true).
  • Update Interval: Polls for updates once every 24 hours (86400 seconds).
  • Metrics API: Enables an HTTP API for integration with dashboards like Homepage.

📂 Repository Structure

  • docker-compose.yaml: Service definition including environment mappings and volume mounts.
  • .woodpecker.yaml: Automation for deployment to the host server.
  • .env.example: Template for the required API token.
  • .gitignore: Configured to ignore the active .env file.

📊 Dashboard Integration (Homepage)

This instance is configured to expose metrics for the Homepage dashboard.

  1. API Token: Defined via WATCHTOWER_HTTP_API_TOKEN.
  2. Access: Exposed on port 8080 (Internal/Host only).
  3. Usage: Use the token defined in your .env to allow Homepage to display update status and container statistics.

🚀 Getting Started

1. Environment Configuration

Create your local environment file:

cp .env.example .env

Edit .env and set your HOMEPAGE_VAR_WATCHTOWER_KEY to a secure random string.

2. Manual Deployment

docker compose up -d

🔄 CI/CD Workflow

The Woodpecker CI pipeline triggers on every push to main. It:

  • Syncs the repository configuration to the server.
  • Recreates the Watchtower container with the latest image.

⚠️ Notes

  • Network: Unlike other services in this stack, Watchtower does not use the web_traffic network as it does not require a public interface via Caddy.
  • API Security: Ensure port 8080 is not exposed to the public internet; it is intended for local metrics polling.