Homelab Service Scaffold
Follow this workflow whenever adding a new service.
Core Rules (must follow)
- •Required files:
services/<name>/docker-compose.yml,services/<name>/README.md,services/<name>/.env.<name>.example. - •Optional:
services/<name>/Taskfile.ymlonly if hooks are needed (ask if unsure). - •Cron tasks: If scheduled jobs are needed, propose the Ofelia pattern (labels + scripts + status JSON). If not needed, do not add cron plumbing.
- •Compose envs:
docker-compose.ymlmust use env_file and must not include anenvironment:block. - •Labels: Always add Traefik + Homepage labels.
- •Healthcheck: Always define a container healthcheck.
- •No root edits: Do not edit root
.env,.env.example, rootTaskfile.yml, or other services (Homepage config is the only exception, and only if labels cannot be used). - •Secrets: Never commit API keys, tokens, domains, or absolute host paths outside the repo. Use placeholders and comments in
.env.<name>.example. - •Defaults: Use image defaults for port mappings and comment out optional envs.
- •Mode: Use production mode if the image supports it.
- •Docs: Use official docs/GitHub repo; browse when necessary.
- •Validation: Run
task up SERVICE=<name>and debug until healthy, Traefik routes, and Homepage entry work.
Workflow
- •
Identify the service
- •Confirm service name, image, ports, and subdomain.
- •Ask about persistence needs, storage paths, auth/secrets, and whether a health endpoint exists.
- •If the service likely needs cron jobs or hooks, suggest them and ask for confirmation.
- •
Compose file (
services/<name>/docker-compose.yml)- •Use
env_filefor config. - •Map ports using env vars with defaults matching the image.
- •Add Traefik + Homepage labels.
- •Add a healthcheck (HTTP or command-based).
- •Add networks/volumes as needed; prefer external
traefiknetwork.
- •Use
- •
Env example (
services/<name>/.env.<name>.example)- •Document all vars and comment optional/default values.
- •Never include secrets or user-specific paths.
- •Use placeholders for secrets (e.g.,
changeme_...).
- •
README (
services/<name>/README.md)- •Explain what the service does, how it’s wired in this homelab, URLs, and healthcheck.
- •List required/optional env vars and volumes.
- •Describe any init steps.
- •
Hooks (optional)
- •Add
Taskfile.ymlonly if a hook is needed (e.g., create network, pre-up steps). Ask first if unsure.
- •Add
- •
Cron (optional)
- •If needed, use the existing Ofelia pattern:
- •Job labels on the target service
- •Script(s) under
services/<name>/scripts/ - •Status JSON served by ofelia-status
- •Homepage entries only if labels are insufficient
- •If needed, use the existing Ofelia pattern:
- •
Bring it up and verify
- •Run
task up SERVICE=<name>. - •Verify
docker pshealth, Traefik route, Homepage entry. - •Debug until green.
- •Run
Before commit checklist
- •No secrets or personal paths in tracked files.
- •Healthcheck works.
- •Traefik route works.
- •Homepage entry appears.
- •README updated and accurate.
Reference
See references/service-checklist.md for a detailed checklist.