1.8 KiB
1.8 KiB
Dokploy Deployment Guide
Prerequisites
- Dokploy server at 191.101.0.153 (Hostinger KVM2)
- Dokploy API key in Bitwarden ("dokploy api key")
- Gitea repos created at git.infra.nkode.tech
Compose File Structure
Every app uses docker-compose.dokploy.yml:
services:
api:
build:
context: ./apps/api # or ./api, ./backend
dockerfile: Dockerfile
restart: unless-stopped
ports:
- 3001
environment:
- DATABASE_URL=${DATABASE_URL}
- PORT=3001
- NODE_ENV=production
- APP_URL=${APP_URL}
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS}
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
- HAMMER_API_KEY=${HAMMER_API_KEY}
command: sh -c 'bun run db:push && bun run src/index.ts'
web:
build:
context: ./apps/web # or ./web, ./frontend
dockerfile: Dockerfile
restart: unless-stopped
ports:
- 80
depends_on:
- api
Deployment Steps
- Push code to Gitea
- Create compose in Dokploy:
- Source type: raw compose with git URL
- Set env vars in Dokploy UI
- Configure domains in Dokploy:
- API:
api.<app>.donovankelly.xyz→ api service port - Web:
app.<app>.donovankelly.xyz→ web service port
- API:
- Enable HTTPS (Dokploy handles Let's Encrypt)
- Deploy and verify health check
Domain Pattern
- Test:
test-<app>.donovankelly.xyz - Production:
<app>.donovankelly.xyz - API:
api.<app>.donovankelly.xyz(orapi.todo.donovankelly.xyz) - Frontend:
app.<app>.donovankelly.xyz(orapp.todo.donovankelly.xyz)
Environment Variables
Set in Dokploy compose env (not in docker-compose file):
- All
${VAR}references resolve from Dokploy env settings - Generate secrets with
openssl rand -hex 32 - Store everything in Bitwarden immediately after creating