How to add new services to the homelab. There are two patterns depending on where the service lives.
For services with their own GitHub repo (e.g., flight-tracker). Dokploy pulls the compose.yaml from the repo and runs docker compose up.
-
Add a
compose.yamlto the repo root with all production services. -
Create the Dokploy Compose service via API:
# Source credentials
source <(grep DOKPLOY_API_KEY access.md | head -1 | sed 's/.*`\(.*\)`.*/DOKPLOY_API_KEY=\1/')
# Create compose service in the flight-tracker project
curl -sf -X POST 'http://beelink:3000/api/trpc/compose.create' \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"json":{"name":"my-service","description":"What it does","environmentId":"<envId>"}}'- Link to GitHub — set the GitHub provider, repo, and branch:
curl -sf -X POST 'http://beelink:3000/api/trpc/compose.update' \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"json":{
"composeId":"<composeId>",
"sourceType":"github",
"githubId":"JrqTkAxpd2g35bKN6TqBL",
"repository":"Owner/repo-name",
"branch":"main",
"composePath":"./compose.yaml"
}}'- Set environment variables (if needed):
curl -sf -X POST 'http://beelink:3000/api/trpc/compose.update' \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"json":{"composeId":"<composeId>","env":"KEY1=value1\nKEY2=value2"}}'- Deploy:
curl -sf -X POST 'http://beelink:3000/api/trpc/compose.deploy' \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"json":{"composeId":"<composeId>"}}'Add a GitHub Actions workflow that deploys on push to main:
deploy-backend:
name: Deploy via Dokploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Connect to Tailscale
uses: tailscale/github-action@v4
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Trigger Dokploy deploy
run: |
curl -sf -X POST 'http://beelink:3000/api/trpc/compose.deploy' \
-H 'x-api-key: ${{ secrets.DOKPLOY_API_KEY }}' \
-H 'Content-Type: application/json' \
-d '{"json":{"composeId":"<composeId>"}}'Required GitHub Secrets: TS_OAUTH_CLIENT_ID, TS_OAUTH_SECRET, DOKPLOY_API_KEY
- Cloudflared entrypoint: The
cloudflare/cloudflaredimage hasENTRYPOINT ["cloudflared", "--no-autoupdate"]. Your composecommandmust NOT includecloudflared— justtunnel run --token .... - Branch must be
main: If you deploy from a feature branch and delete it after merge, auto-deploy breaks. - Compose profiles: Use
COMPOSE_PROFILES=prodenv var in Dokploy if your compose uses profiles.
For infrastructure services managed in this repo (e.g., Home Assistant, MQTT, observability). Compose files live in stacks/<service>/compose.yaml.
- Create the stack directory:
mkdir -p stacks/my-service- Write
compose.yaml:
services:
my-service:
image: some-image:latest
restart: unless-stopped
ports:
- "${TAILSCALE_IP:?}:8080:8080"
volumes:
- my-data:/data
volumes:
my-data:- Add a mise deploy task in
mise.toml:
[tasks."deploy:my-service"]
description = "Deploy my-service"
run = "docker compose -f stacks/my-service/compose.yaml up -d"- Add to
deploy:alldepends:
[tasks."deploy:all"]
depends = ["deploy:ha", "deploy:mqtt", "deploy:my-service"]- Deploy:
mise run deploy:my-service- Port binding: Use
${TAILSCALE_IP:?}:hostPort:containerPortto bind only to Tailscale. Fails fast ifTAILSCALE_IPis not set. - Host network: Only use
network_mode: hostwhen required (e.g., Home Assistant needs Bluetooth/mDNS). - Volumes: Use named volumes for data persistence. Add data directories to
.gitignoreviastacks/*/data/. - Image versions: Pin image tags (e.g.,
grafana/grafana:11.5) for Renovate to track and auto-PR updates.
| Scenario | Pattern | Example |
|---|---|---|
| Service has its own repo with CI | Dokploy Compose | flight-tracker |
| Infrastructure/monitoring service | Local Stack | HA, MQTT, observability |
| Third-party service, no custom code | Local Stack | Grafana, Prometheus |
| Service needs public ingress | Dokploy Compose + cloudflared | flight-tracker |