erpnext/docs/COOLIFY_DEPLOY.md
epistemophiliac 4144bd1115
Some checks failed
Production Readiness / Coolify compose readiness (push) Has been cancelled
Production Readiness / Render and validate stack (push) Has been cancelled
Target epistemophiliac/erpnext and extend CI for Coolify deploy
Point docs at the new Forgejo repo, add compose render artifact upload,
and verify the pinned frappe/erpnext image pulls in CI before Coolify deploy.
2026-06-16 17:56:24 -04:00

102 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Coolify deployment — Production ERPNext
## Prerequisites
- Coolify v4+ with Docker Compose support
- Server: **minimum 4 GB RAM**, **8 GB+** for production workloads
- Public domain (e.g. `erp.yourdomain.com`)
## 1. Create the Coolify service
| Setting | Value |
|---------|--------|
| Type | Docker Compose |
| Repository | `https://git.aexoradao.com/epistemophiliac/erpnext` |
| Branch | `main` |
| Compose file | `docker-compose.yml` |
## 2. Environment variables
Set these in **Coolify → Service → Environment Variables** before first deploy:
| Variable | Required | Example | Notes |
|----------|----------|---------|-------|
| `ERPNEXT_VERSION` | yes | `v16.22.0` | Pin image tag |
| `DB_PASSWORD` | yes | strong secret | MariaDB root |
| `SITE_NAME` | yes | `erp.yourdomain.com` | Must match domain |
| `ADMIN_PASSWORD` | yes | strong secret | Frappe login |
| `FRAPPE_SITE_NAME_HEADER` | yes | same as `SITE_NAME` | Single-site routing |
| `MIGRATE_SITES` | no | `true` | Run migrate on redeploy |
> **Coolify env cache:** Changing defaults in `docker-compose.yml` does **not** update values already stored in Coolify. Edit them in the UI after changes.
## 3. Domain routing
1. Open the deployed service in Coolify
2. Add domain: `erp.yourdomain.com`
3. Attach domain to service **`frontend`**
4. Internal port: **`8080`** (Frappe nginx — not 80)
The compose file sets `SERVICE_URL_FRONTEND_8080` so Coolify routes HTTPS to nginx correctly.
## 4. First deploy timeline
```text
db (healthy) → redis → configurator (exit 0)
→ create-site (new-site + install-app erpnext, ~515 min)
→ migrator → backend / workers / frontend
```
Watch logs:
- `create-site` — site creation progress
- `backend` — gunicorn ready
- `frontend` — nginx on 8080
## 5. Post-deploy verification
From Coolify terminal on `frontend`:
```bash
curl -sI http://localhost:8080/
```
From your machine:
```bash
curl -sI https://erp.yourdomain.com/
```
Login at `https://erp.yourdomain.com` — user `Administrator`.
## 6. Upgrades
1. Bump `ERPNEXT_VERSION` in Coolify env vars
2. Redeploy — `migrator` runs `bench --site all migrate`
3. Confirm `migrator` logs show success
## Troubleshooting
| Symptom | Fix |
|---------|-----|
| Coolify 404 | Domain on wrong service — must be `frontend:8080` |
| Site not found | `SITE_NAME` ≠ domain; fix `FRAPPE_SITE_NAME_HEADER` in UI |
| Stack unhealthy | Healthcheck port must be **8080** on frontend |
| create-site fails on redeploy | Should be idempotent — check `sites/$SITE_NAME` exists |
| Env change ignored | Update variable in Coolify UI, not only in git |
## What we intentionally omit
- No Traefik / nginx-proxy / Let's Encrypt in compose — Coolify handles TLS
- No `ports:` — Coolify proxy only
- No `pwd.yml` demo stack
## CI / production gate
Every merge to `main` must pass `.github/workflows/production-readiness.yml` before Coolify auto-deploy (if wired).
Local check:
```bash
make ci
```