- Implemented integration tests for the execution writer to ensure trade orders and PnL are persisted correctly. - Created integration tests for the metrics calculator to summarize execution data accurately. - Added integration tests for the opportunity writer to verify event persistence. - Established PostgreSQL schema validation tests to ensure all expected tables, columns, and constraints exist. - Removed outdated unit tests that relied on DuckDB and replaced them with tests using PgStore.
5.2 KiB
Deployment Guide (Coolify)
This guide provides two supported deployment paths for Arbitrade on Coolify:
- Build directly from Git repository in Coolify.
- Deploy prebuilt container image:
git.allucanget.biz/allucanget/arbitrade:latest.
Reference docs:
- Coolify Applications
- Coolify Build Packs
- Coolify Dockerfile Build Pack
- Coolify Nixpacks Build Pack
- Coolify CI/CD (Git providers)
- Coolify Gitea integration
- Coolify environment variables
- Coolify persistent storage
- Coolify health checks
- Coolify Docker registry credentials
Common Runtime Configuration
Use these values in both deployment modes.
Port and health
- Container port:
9090 - Health check path:
/health - Protocol: HTTP
Persistent storage
- Add a persistent volume
- Mount path:
/app/data - Set PG connection:
PG_HOST=postgres,PG_PORT=5432,PG_DATABASE=arbitrade,PG_USER=arbitrade,PG_PASSWORD=arbitrade
Required environment variables
APP_ENV=prodAPP_HOST=0.0.0.0APP_PORT=9090PG_DATABASE=arbitradeLOG_LEVEL=INFOLOG_JSON=trueKRAKEN_API_KEY=<set-in-coolify-secret>KRAKEN_API_SECRET=<set-in-coolify-secret>KRAKEN_API_KEY_PERMISSIONS=query,tradeFERNET_KEY=<set-in-coolify-secret>
Notes:
- Store secrets in Coolify secret variables, not in Git.
- Keep Kraken key scope minimal (query + trade, no withdrawal).
Option A: Build in Coolify from Git Repository
Recommended when you want Coolify to build from source and optionally auto-deploy on commits.
-
Open your Coolify project and select Create New Resource.
-
Choose deployment source:
- Public repo: use
Public repositoryand provide HTTPS URL. - Private Gitea repo: use deploy key flow from the Gitea guide.
- Public repo: use
-
Set repository URL for this project:
https://git.allucanget.biz/allucanget/arbitrade.git(public)- or SSH URL if private deploy key is used.
-
Choose build pack:
- Prefer
Dockerfilefor this repo, because Docker build behavior is explicitly defined. - Use
Nixpacksonly if you intentionally want auto-detected build logic.
- Prefer
-
Configure branch and base directory:
- Branch: your deploy branch (for example
main) - Base directory:
/
- Branch: your deploy branch (for example
-
Configure network:
- Exposed port:
9090 - Domain: set your Coolify domain/custom domain
- Exposed port:
-
Configure environment variables and secrets from the Common Runtime Configuration section.
-
Add persistent storage mount
/app/data. -
Configure health check:
- Path:
/health - Ensure container includes
curlorwgetif using UI-defined checks.
- Path:
-
Click Deploy and verify:
- Deployment logs complete successfully.
GET /healthreturns success.
Optional (Git webhook auto-deploy with Gitea):
- In Coolify resource, open
Webhooksand copy Manual Git Webhook URL. - Set webhook secret in Coolify.
- In Gitea repo settings, add webhook URL + same secret and enable Push events.
- Push a commit and confirm Coolify triggers deploy.
Option B: Deploy Prebuilt Image from Container Registry
Recommended when CI publishes the image and Coolify only runs it.
Image:
git.allucanget.biz/allucanget/arbitrade:latest
-
Ensure CI publishes the image before first deployment.
-
In Coolify, select Create New Resource.
-
Choose Application deployment based on Docker Image.
-
Set image reference:
- Registry:
git.allucanget.biz - Image:
git.allucanget.biz/allucanget/arbitrade:latest
- Registry:
-
Configure registry credentials in Coolify if your registry requires auth.
-
Leave build/install/start commands empty unless you need overrides.
-
Set network and health:
- Exposed port:
9090 - Health check path:
/health
- Exposed port:
-
Add environment variables and secrets from the Common Runtime Configuration section.
-
Add persistent storage mount
/app/data. -
Deploy and verify:
- Logs show container start success.
GET /healthreturns success.
Update flow for new releases:
- Push code and let CI publish a new
latestimage. - Trigger redeploy in Coolify for this resource.
Quick Troubleshooting
No available serverfrom proxy:- Check health check path/port and app bind (
APP_HOST=0.0.0.0,APP_PORT=9090). - Verify health check is passing in Coolify.
TemplateNotFound: dashboard.htmlat runtime:- Ensure the deployed image/wheel includes package templates under
arbitrade/web/templates/*. - If you build from source, do not remove packaged template files under
src/arbitrade/web/templates. - DB resets after deploy:
- Confirm PostgreSQL is reachable at
PG_HOST. - Registry pull fails:
- Re-check Docker registry credentials in Coolify.
- App starts but unavailable externally:
- Confirm exposed port is
9090and domain is attached to this resource.