67 lines
1.8 KiB
Markdown
67 lines
1.8 KiB
Markdown
# 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`:
|
|
|
|
```yaml
|
|
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
|
|
|
|
1. Push code to Gitea
|
|
2. Create compose in Dokploy:
|
|
- Source type: raw compose with git URL
|
|
- Set env vars in Dokploy UI
|
|
3. Configure domains in Dokploy:
|
|
- API: `api.<app>.donovankelly.xyz` → api service port
|
|
- Web: `app.<app>.donovankelly.xyz` → web service port
|
|
4. Enable HTTPS (Dokploy handles Let's Encrypt)
|
|
5. Deploy and verify health check
|
|
|
|
## Domain Pattern
|
|
|
|
- Test: `test-<app>.donovankelly.xyz`
|
|
- Production: `<app>.donovankelly.xyz`
|
|
- API: `api.<app>.donovankelly.xyz` (or `api.todo.donovankelly.xyz`)
|
|
- Frontend: `app.<app>.donovankelly.xyz` (or `app.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
|