This directory contains a working example of dchook for local testing.
Using just:
# Start services
just up
# Test successful webhook
just success
# Test rate limiting
just rate-limited
# Test failed authentication
just failed
# Test ban after failures
just banned
# View logs
just logs
# Stop services
just downThe webhook secret has been generated in webhook_secret.txt (permissions:
0600).
Start the services:
docker compose up -dCheck the services are running:
docker compose psVisit the web service:
curl http://localhost:8081Check dchook health:
curl http://localhost:7999/health
curl http://localhost:7999/versionBuild the notifier (from project root):
go build -o dchook-notify ./cmd/dchook-notifySend a test webhook:
# From the example directory
export DCHOOK_URL="http://localhost:7999/deploy"
export DCHOOK_SECRET_FILE="./webhook_secret.txt"
../dchook-notify payload.jsonOr using flags:
../dchook-notify -u http://localhost:7999/deploy -s ./webhook_secret.txt payload.jsonWatch the logs:
docker compose logs -f dchookThe Justfile includes recipes for testing different scenarios:
just success- Send a valid webhook (should succeed)just rate-limited- Send 2 webhooks quickly (second should be rate limited)just failed- Send webhook with wrong secret (should fail)just banned- Send 2 failed webhooks (should trigger 1-hour ban)
just clean
# or
docker compose down- The example uses a separate
Dockerfilewith public base images (golang:alpine,alpine:latest) for easy local testing without Docker Hub authentication - The production
Dockerfileat the repo root uses Docker Hardened Images (dhi.io) which require authentication - The dchook service has access to the Docker socket to manage containers
- The webhook secret is mounted as a Docker secret with proper permissions
- The compose file is mounted read-only into the dchook container
- Rate limit: 1 successful deployment per minute
- Ban: 2 failed attempts trigger 1-hour ban (restart services to clear)
- In production, use HTTPS and proper network isolation