Production
How to ship your Sova application — release binary and Docker Compose.
The deploy/ folder is a template for app repos, not a container of the framework itself.
Local release
bash
export SOVA_ENV=production
cargo build --release -p your_app
./target/release/your_app
# or
cargo sovax serve -p your_appUse [production.*] in sova.toml (Configuration). Secrets stay in env (DATABASE_URL, SMTP, …), not in git.
- DevTools off in production (default for release /
SOVA_PROFILE=production) - Behind a reverse proxy:
trust_proxy = true app.listen(port)binds0.0.0.0
Docker Compose (app template)
Copy the template into your application repository (the crate that depends on sova), then build that app:
bash
# from the Sova repo (or download the raw files)
cp deploy/Dockerfile deploy/docker-compose.yml deploy/sova.toml \
deploy/.env.example deploy/.dockerignore /path/to/myapp/
cd /path/to/myapp
mv .env.example .env
# edit docker-compose.yml → build.args.APP_BIN = your binary name
docker compose up --build -d
curl -sS http://127.0.0.1:3000/
docker compose logs --tail=50
docker compose down| File | In your app |
|---|---|
Dockerfile | multi-stage cargo build --release of your crate |
docker-compose.yml | app service (+ optional Postgres, commented) |
sova.toml | mounted at /app/sova.toml |
.env.example | copy to .env for secrets |
.dockerignore | keeps target/ out of the build context |
App checklist
- Binary crate with
Cargo.toml+src/(whatcargo sovax newscaffolds). APP_BINin compose matches[[bin]]/ package name.- Load config in
main:
rust
let mut app = App::new();
let _ = app.configure(); // reads ./sova.toml (in the image: /app/sova.toml)
app.listen(3000).await?;Presets App::web() / App::api() already call configure().
- Uncomment the
dbblock in compose when you need Postgres; setDATABASE_URLin.env. - Publish your image from your CI (
docker build/ GHCR) — Sova does not publish a framework runtime image for you toFROM.
Image layout (what the template builds)
- builder —
rust:*-bookworm,cargo build --releasein the app context - runtime — slim Debian, non-root user, binary +
sova.toml,EXPOSE 3000
