|
|
||
|---|---|---|
| .env.example | ||
| .gitignore | ||
| .woodpecker.yaml | ||
| docker-compose.yaml | ||
| README.md | ||
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.sockto monitor and restart containers. - Cleanup: Configured to remove old images after updating (
WATCHTOWER_CLEANUP=true). - Update Interval: Polls for updates once every 24 hours (
86400seconds). - 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.envfile.
📊 Dashboard Integration (Homepage)
This instance is configured to expose metrics for the Homepage dashboard.
- API Token: Defined via
WATCHTOWER_HTTP_API_TOKEN. - Access: Exposed on port
8080(Internal/Host only). - Usage: Use the token defined in your
.envto 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.