Phase 1b: Rename all ~94 commands across 12 plugins to /<noun> <action> sub-command pattern. Git-flow consolidated from 8→5 commands (commit variants absorbed into --push/--merge/--sync flags). Dispatch files, name: frontmatter, and cross-reference updates for all plugins. Phase 2: Design documents for 8 new plugins in docs/designs/. Phase 3: Scaffold 8 new plugins — saas-api-platform, saas-db-migrate, saas-react-platform, saas-test-pilot, data-seed, ops-release-manager, ops-deploy-pipeline, debug-mcp. Each with plugin.json, commands, agents, skills, README, and claude-md-integration. Marketplace grows from 12→20. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
Docker Compose Patterns Skill
Best practices and patterns for Docker Compose service definitions targeting self-hosted infrastructure.
Service Naming
- Use lowercase with hyphens:
my-service - Prefix with stack name for multi-project hosts:
myapp-db,myapp-redis - Container name should match service name:
container_name: myapp-db
Network Isolation
Every stack should define its own bridge network:
networks:
app-network:
driver: bridge
Services join the stack network. Only the reverse proxy entry point should be exposed to the host.
Volume Management
- Use named volumes for data persistence (databases, uploads)
- Use bind mounts for configuration files only
- Set explicit permissions with
:rofor read-only mounts - Label volumes with
labelsfor identification
volumes:
db-data:
labels:
com.project: myapp
com.service: database
Healthchecks
Every service MUST have a healthcheck:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
Common healthcheck patterns:
- HTTP:
curl -f http://localhost:<port>/health - PostgreSQL:
pg_isready -U <user> - Redis:
redis-cli ping - MySQL:
mysqladmin ping -h localhost
Restart Policies
| Environment | Policy |
|---|---|
| Development | restart: "no" |
| Production | restart: unless-stopped |
| Critical services | restart: always |
Resource Limits
For Raspberry Pi (8GB RAM):
deploy:
resources:
limits:
memory: 256M
cpus: '1.0'
reservations:
memory: 128M
Dependency Ordering
Use healthcheck-aware dependencies:
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
Environment Variables
Never inline secrets. Use env_file:
env_file:
- .env
- .env.${DEPLOY_ENV:-development}
Multi-Service Patterns
Web App + Database + Cache
services:
app:
image: myapp:1.0.0
env_file: [.env]
depends_on:
db: { condition: service_healthy }
redis: { condition: service_healthy }
networks: [app-network]
db:
image: postgres:16-alpine
volumes: [db-data:/var/lib/postgresql/data]
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
networks: [app-network]
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
networks: [app-network]