31 lines
1.7 KiB
Markdown
31 lines
1.7 KiB
Markdown
# Deployment — Coolify
|
|
|
|
## Requirements
|
|
- A Coolify server (any host with Docker) and a git repository containing this project.
|
|
|
|
## Steps
|
|
1. **Coolify → Projects → Add Service → Dockerfile** (Git repository source).
|
|
2. Point it at this repo; Coolify detects the `Dockerfile` at the project root.
|
|
3. **Port:** publish container port `8030` (or set env `PORT` and publish that).
|
|
4. **Environment variables:** none required — sensible defaults are baked in:
|
|
- `PORT=8030`, `DATA_DIR=/app/data`.
|
|
5. **Persistence:** add a volume for path `/app/data` (Docker volume or S3/object
|
|
storage) so uploaded EPUBs and generated PDFs survive deploys/restarts.
|
|
6. **Healthcheck** (Coolify settings): `GET /health`, expect HTTP 200.
|
|
7. **Domain/HTTPS:** optional — attach a domain and Coolify's Traefik letsencrypt
|
|
will handle TLS. The app itself is plain HTTP and sends no cookies, so it
|
|
needs no special proxy config. Large uploads (up to 400 MB) work through the
|
|
default proxy; if you see timeouts on very large files, raise the Traefik
|
|
`proxy send timeout` for this service.
|
|
|
|
## Notes / gotchas
|
|
- **Single worker by design.** The job registry (`JOBS`) is in-memory; the
|
|
Dockerfile runs gunicorn with `--workers 1 --threads 8`. Do not scale to
|
|
multiple container instances unless you replace the in-memory registry with
|
|
a shared store — polling `/api/jobs/<id>` would 404 on other instances.
|
|
- WeasyPrint renders in-process, so CPU-heavy conversions occupy worker
|
|
threads; `--timeout 1200` keeps long books from being killed by gunicorn.
|
|
- CJK fonts (`fonts-noto-cjk`) are installed in the image, so Chinese/Japanese
|
|
/Korean books render correctly.
|
|
- CLI mode also works inside the container for one-shots:
|
|
`docker exec <container> python app |