# Coolify deployment — Production ERPNext (+ HRMS, Lending, LMS) ## Prerequisites - Coolify v4+ with Docker Compose support - Jenkins green build published image to `git.aexoradao.com/epistemophiliac/erpnext` - Server: **minimum 4 GB RAM**, **8 GB+** recommended (custom image + LMS frontend assets) - Public domain (e.g. `erp.yourdomain.com`) ## 1. Create the Coolify service (you do this) | Setting | Value | |---------|--------| | Type | Docker Compose | | Repository | `https://git.aexoradao.com/epistemophiliac/erpnext` | | Branch | `main` | | Compose file | `docker-compose.yml` | ## 2. Environment variables From latest **green Jenkins build**, use `dist/coolify-image.env` or: | Variable | Required | Example | Notes | |----------|----------|---------|-------| | `CUSTOM_IMAGE` | yes | `git.aexoradao.com/epistemophiliac/erpnext` | Forgejo registry | | `CUSTOM_TAG` | yes | `main-3eefb73` or `main` | Pin SHA for prod; `main` = latest CI | | `PULL_POLICY` | yes | `always` | Pull from registry on deploy | | `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 | | `INSTALL_APPS` | yes | `erpnext,payments,hrms,lending,lms` | First site only | | `MIGRATE_SITES` | no | `true` | 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. ## 3. Domain routing 1. Add domain: `erp.yourdomain.com` 2. Attach to service **`frontend`** 3. Port **`8080`** ## 4. First deploy timeline ```text pull custom image → db (healthy) → redis → configurator → create-site (install erpnext + payments + hrms + lending + lms, ~10–20 min) → migrator → backend / workers / frontend ``` ## 5. Upgrades 1. Push app changes to git → Jenkins builds new image 2. Set `CUSTOM_TAG` in Coolify to new `main-` 3. Redeploy — `migrator` runs `bench migrate` ## Apps in the image See [`apps.json`](../apps.json). Site install list: `INSTALL_APPS` in [`example.env`](../example.env). ## Troubleshooting | Symptom | Fix | |---------|-----| | Image pull failed | Check registry login on Coolify host; verify tag exists in Forgejo Packages | | create-site fails on LMS | Ensure `payments` is in `INSTALL_APPS` before `lms` | | 502 / unhealthy frontend | Wait for create-site; check `backend` health | | Wrong site | `SITE_NAME` and `FRAPPE_SITE_NAME_HEADER` must match Coolify domain |