Watch Configuration Examples
Real-world examples of watch configurations for popular frameworks and use cases.
Python Django
Full Production Setup
{
"name": "django-app",
"services": [
{
"name": "backend",
"path": "./backend",
"fileSync": true,
"fileSyncIgnore": [
"*.pyc",
"__pycache__/",
"*.egg-info/",
".pytest_cache/",
"htmlcov/",
".coverage",
"*.log"
],
"watch": [
{
"patterns": ["Dockerfile"],
"actions": ["rebuildImage"],
"description": "Rebuild on Dockerfile changes"
},
{
"patterns": ["requirements.txt", "requirements/*.txt", "pyproject.toml"],
"actions": ["rebuildImage"],
"description": "Rebuild when dependencies change"
},
{
"patterns": ["db/migrations/**/*.sql", "apps/**/migrations/*.py"],
"scripts": {
"runMigrations": {
"command": "python manage.py migrate",
"target": "container",
"timeout": "5m"
}
},
"actions": ["runMigrations"],
"description": "Run database migrations"
},
{
"patterns": ["k8s/configmap.yaml", "k8s/secrets.yaml"],
"actions": ["reapplyK8sManifest", "restartContainer"],
"description": "Update config and restart"
},
{
"patterns": ["static/**/*", "templates/**/*"],
"scripts": {
"collectStatic": {
"command": "python manage.py collectstatic --noinput",
"target": "container"
}
},
"actions": ["collectStatic"],
"description": "Collect static files"
}
]
},
{
"name": "celery-worker",
"path": "./backend",
"fileSync": true,
"fileSyncIgnore": ["*.pyc", "__pycache__/"],
"watch": [
{
"patterns": ["requirements.txt"],
"actions": ["rebuildImage"],
"description": "Rebuild on dependency changes"
},
{
"patterns": ["apps/**/tasks.py", "config/celery.py"],
"actions": ["restartContainer"],
"debounce": 2000,
"description": "Restart on Celery task changes"
}
]
}
]
}
Development with Testing
{
"watch": [
{
"patterns": ["**/*.py"],
"ignorePatterns": ["tests/**/*.py"],
"scripts": {
"runTests": {
"command": "pytest --cov=apps --cov-report=term-missing",
"target": "host",
"timeout": "10m"
}
},
"actions": ["runTests"],
"continueOnError": true,
"debounce": 2000,
"description": "Run tests on Python changes"
},
{
"patterns": ["requirements.txt", "requirements/dev.txt"],
"scripts": {
"installDeps": {
"command": "pip install -r requirements/dev.txt",
"target": "container"
}
},
"actions": ["installDeps", "restartContainer"],
"description": "Install dev dependencies"
}
]
}
Node.js Express
Full Stack Application
{
"name": "express-app",
"services": [
{
"name": "backend",
"path": "./backend",
"fileSync": true,
"fileSyncIgnore": [
"node_modules/",
"dist/",
"build/",
"*.map",
"coverage/",
".next/"
],
"watch": [
{
"patterns": ["Dockerfile"],
"actions": ["rebuildImage"],
"description": "Rebuild on Dockerfile changes"
},
{
"patterns": ["package.json", "package-lock.json"],
"scripts": {
"installAndBuild": {
"command": "npm ci && npm run build",
"target": "host",
"timeout": "10m"
}
},
"actions": ["installAndBuild", "restartContainer"],
"description": "Install dependencies and rebuild"
},
{
"patterns": ["tsconfig.json", "webpack.config.js", "vite.config.js"],
"scripts": {
"rebuild": {
"command": "npm run build",
"target": "host"
}
},
"actions": ["rebuild", "restartContainer"],
"description": "Rebuild on config changes"
},
{
"patterns": ["k8s/**/*.yaml"],
"actions": ["reapplyK8sManifest"],
"description": "Update Kubernetes resources"
}
]
}
]
}
TypeScript with Linting
{
"watch": [
{
"patterns": ["**/*.ts", "**/*.tsx"],
"ignorePatterns": ["**/*.spec.ts", "**/*.test.ts"],
"scripts": {
"typeCheck": {
"command": "tsc --noEmit",
"target": "host"
},
"lint": {
"command": "eslint --fix .",
"target": "host"
}
},
"actions": ["typeCheck", "lint"],
"continueOnError": true,
"debounce": 2000,
"description": "Type check and lint TypeScript files"
}
]
}
React / Next.js
Next.js with SSR
{
"name": "nextjs-app",
"services": [
{
"name": "frontend",
"path": "./frontend",
"fileSync": true,
"fileSyncIgnore": [
"node_modules/",
".next/",
"out/",
"build/",
"*.map"
],
"watch": [
{
"patterns": ["Dockerfile"],
"actions": ["rebuildImage"],
"description": "Rebuild on Dockerfile changes"
},
{
"patterns": ["package.json", "package-lock.json"],
"scripts": {
"reinstall": {
"command": "rm -rf node_modules && npm ci",
"target": "host",
"timeout": "15m"
}
},
"actions": ["reinstall", "rebuildImage"],
"description": "Clean reinstall dependencies"
},
{
"patterns": ["next.config.js", "tsconfig.json"],
"scripts": {
"rebuild": {
"command": "npm run build",
"target": "host",
"timeout": "10m"
}
},
"actions": ["rebuild", "restartContainer"],
"description": "Rebuild on config changes"
},
{
"patterns": ["public/**/*"],
"scripts": {
"syncStatic": {
"command": "kubectl cp public/ $POD_NAME:/app/public/",
"target": "host"
}
},
"actions": ["syncStatic"],
"description": "Sync static assets"
}
]
}
]
}
Go Microservices
Single Service
{
"name": "go-service",
"services": [
{
"name": "api",
"path": "./api",
"fileSync": true,
"fileSyncIgnore": [
"*.exe",
"*.test",
"vendor/",
"bin/"
],
"watch": [
{
"patterns": ["**/*.go"],
"scripts": {
"buildBinary": {
"command": "go build -o /app/main ./cmd/api",
"target": "container",
"timeout": "5m"
}
},
"actions": ["buildBinary", "restartContainer"],
"debounce": 2000,
"description": "Build and restart on Go changes"
},
{
"patterns": ["go.mod", "go.sum"],
"actions": ["rebuildImage"],
"description": "Rebuild on dependency changes"
},
{
"patterns": ["Dockerfile"],
"actions": ["rebuildImage"],
"description": "Rebuild on Dockerfile changes"
},
{
"patterns": ["db/migrations/**/*.sql"],
"scripts": {
"runMigrations": {
"command": "./migrate -path=/app/db/migrations -database=$DATABASE_URL up",
"target": "container",
"timeout": "5m"
}
},
"actions": ["runMigrations"],
"description": "Run database migrations"
}
]
}
]
}
gRPC Service with Protobuf
{
"watch": [
{
"patterns": ["**/*.proto"],
"scripts": {
"generateProto": {
"command": "protoc --go_out=. --go-grpc_out=. proto/*.proto",
"target": "host",
"workingDir": "."
},
"buildBinary": {
"command": "go build -o /app/main ./cmd/server",
"target": "container"
}
},
"actions": ["generateProto", "buildBinary", "restartContainer"],
"description": "Generate protobuf and rebuild"
},
{
"patterns": ["**/*.go"],
"ignorePatterns": ["**/*.pb.go"],
"scripts": {
"build": {
"command": "go build -o /app/main ./cmd/server",
"target": "container"
}
},
"actions": ["build", "restartContainer"],
"debounce": 2000,
"description": "Build on Go changes"
}
]
}
Monorepo
Multi-Service Monorepo
{
"name": "monorepo-app",
"services": [
{
"name": "frontend",
"path": "./packages/frontend",
"fileSync": true,
"fileSyncIgnore": ["node_modules/", ".next/"],
"watch": [
{
"patterns": ["Dockerfile", "package.json"],
"actions": ["rebuildImage"],
"description": "Rebuild frontend"
},
{
"patterns": ["../../shared/**/*.ts"],
"scripts": {
"buildShared": {
"command": "npm run build",
"target": "host",
"workingDir": "../../shared"
}
},
"actions": ["buildShared", "restartContainer"],
"description": "Rebuild shared package"
}
]
},
{
"name": "backend",
"path": "./packages/backend",
"fileSync": true,
"fileSyncIgnore": ["node_modules/", "dist/"],
"watch": [
{
"patterns": ["Dockerfile", "package.json"],
"actions": ["rebuildImage"],
"description": "Rebuild backend"
},
{
"patterns": ["../../shared/**/*.ts"],
"scripts": {
"buildShared": {
"command": "npm run build",
"target": "host",
"workingDir": "../../shared"
}
},
"actions": ["buildShared", "restartContainer"],
"description": "Rebuild shared package"
}
]
},
{
"name": "worker",
"path": "./packages/worker",
"fileSync": true,
"fileSyncIgnore": ["node_modules/"],
"watch": [
{
"patterns": ["Dockerfile", "package.json"],
"actions": ["rebuildImage"],
"description": "Rebuild worker"
}
]
}
]
}
Shared Configuration Service
{
"services": [
{
"name": "shared-config",
"path": "./k8s",
"fileSync": false,
"watch": [
{
"patterns": ["configmap-*.yaml"],
"scripts": {
"restartAll": {
"path": "./scripts/restart-all-services.sh",
"target": "host"
}
},
"actions": ["reapplyK8sManifest", "restartAll"],
"description": "Update ConfigMaps and restart all services"
},
{
"patterns": ["ingress.yaml", "gateway.yaml"],
"actions": ["reapplyK8sManifest"],
"description": "Update routing configuration"
}
]
}
]
}
Database Migrations
Flyway (Java)
{
"watch": [
{
"patterns": ["db/migrations/**/*.sql"],
"scripts": {
"runMigrations": {
"command": "flyway -configFiles=/app/flyway.conf migrate",
"target": "container",
"timeout": "10m"
}
},
"actions": ["runMigrations"],
"description": "Run Flyway migrations"
}
]
}
Liquibase
{
"watch": [
{
"patterns": ["db/changelog/**/*.xml", "db/changelog/**/*.sql"],
"scripts": {
"updateDatabase": {
"command": "liquibase --changelog-file=db/changelog/db.changelog-master.xml update",
"target": "container",
"timeout": "10m"
}
},
"actions": ["updateDatabase"],
"description": "Apply Liquibase changesets"
}
]
}
Alembic (Python)
{
"watch": [
{
"patterns": ["alembic/versions/**/*.py"],
"scripts": {
"runMigrations": {
"command": "alembic upgrade head",
"target": "container",
"timeout": "5m"
}
},
"actions": ["runMigrations"],
"description": "Run Alembic migrations"
}
]
}
Testing Workflows
Pre-Deployment Testing
{
"watch": [
{
"patterns": ["**/*.py"],
"ignorePatterns": ["tests/**/*.py"],
"scripts": {
"runUnitTests": {
"command": "pytest tests/unit --cov",
"target": "host",
"timeout": "5m"
},
"runIntegrationTests": {
"command": "pytest tests/integration",
"target": "host",
"timeout": "10m"
}
},
"actions": ["runUnitTests", "runIntegrationTests", "rebuildImage"],
"continueOnError": false,
"description": "Test before deploying"
}
]
}
Continuous Testing
{
"watch": [
{
"patterns": ["src/**/*.ts", "tests/**/*.spec.ts"],
"scripts": {
"runTests": {
"command": "jest --coverage --onlyChanged",
"target": "host"
}
},
"actions": ["runTests"],
"continueOnError": true,
"debounce": 2000,
"description": "Run tests on changes"
}
]
}
Build Optimization
Cached Builds
{
"watch": [
{
"patterns": ["package.json"],
"scripts": {
"buildWithCache": {
"command": "docker build --cache-from=registry.myapp.com/app:latest -t app:latest .",
"target": "host",
"timeout": "15m"
}
},
"actions": ["buildWithCache"],
"description": "Build with layer caching"
}
]
}
Multi-Stage Builds
{
"watch": [
{
"patterns": ["Dockerfile"],
"scripts": {
"buildMultiStage": {
"command": "docker build --target production -t app:prod .",
"target": "host",
"timeout": "20m"
}
},
"actions": ["buildMultiStage"],
"description": "Multi-stage production build"
}
]
}
Advanced Patterns
Conditional Actions Based on File Type
{
"watch": [
{
"patterns": ["**/*.proto"],
"scripts": {
"generateGo": {
"command": "protoc --go_out=. proto/*.proto",
"target": "host"
}
},
"actions": ["generateGo", "rebuildImage"],
"description": "Generate Go code from proto"
},
{
"patterns": ["**/*.go"],
"ignorePatterns": ["**/*.pb.go"],
"scripts": {
"quickBuild": {
"command": "go build -o /app/main .",
"target": "container"
}
},
"actions": ["quickBuild", "restartContainer"],
"debounce": 2000,
"description": "Quick rebuild on Go changes"
}
]
}
Environment-Specific Configuration
{
"watch": [
{
"patterns": ["k8s/base/**/*.yaml"],
"actions": ["reapplyK8sManifest"],
"description": "Update base Kubernetes resources"
},
{
"patterns": ["k8s/overlays/dev/**/*.yaml"],
"scripts": {
"applyDevOverlay": {
"command": "kubectl apply -k k8s/overlays/dev",
"target": "host"
}
},
"actions": ["applyDevOverlay"],
"description": "Apply dev overlay"
}
]
}
Startup Initialization
{
"watch": [
{
"patterns": ["**/*.sql"],
"scripts": {
"seedDatabase": {
"command": "psql -U postgres -d mydb -f /app/seed.sql",
"target": "container"
}
},
"actions": ["seedDatabase"],
"onStartup": true,
"description": "Seed database on startup"
},
{
"patterns": ["fixtures/**/*.json"],
"scripts": {
"loadFixtures": {
"command": "python manage.py loaddata fixtures/*.json",
"target": "container"
}
},
"actions": ["loadFixtures"],
"onStartup": true,
"description": "Load fixtures on startup"
}
]
}
Debugging Examples
Verbose Logging
{
"watch": [
{
"patterns": ["**/*.py"],
"scripts": {
"runWithLogging": {
"command": "python -m pdb manage.py runserver 0.0.0.0:8000",
"target": "container"
}
},
"actions": ["runWithLogging"],
"description": "Run with debugger attached"
}
]
}
Health Check After Deploy
{
"watch": [
{
"patterns": ["Dockerfile"],
"scripts": {
"deployAndCheck": {
"path": "./scripts/deploy-with-health-check.sh",
"target": "host",
"timeout": "5m"
}
},
"actions": ["rebuildImage", "deployAndCheck"],
"description": "Deploy and verify health"
}
]
}
scripts/deploy-with-health-check.sh:
#!/bin/bash
set -e
echo "Waiting for deployment..."
kubectl rollout status deployment/$SERVICE_NAME --timeout=180s
echo "Running health checks..."
for i in {1..10}; do
if curl -f http://$SERVICE_HOST/health; then
echo "Health check passed!"
exit 0
fi
sleep 5
done
echo "Health check failed!"
exit 1