Files
arbitrade/DEPLOYMENT.md
T
zwitschi 1df4b11aef
CI / lint-test-build (push) Failing after 1m7s
Add HTML templates for dashboard, metrics, overview, and backtesting
- Introduced new HTML templates for the dashboard, metrics, overview, and backtesting functionalities.
- Implemented partial templates for metrics, overview, audit, controls, and charts to enhance modularity.
- Updated the Jinja2 template resolution logic to support different deployment environments.
- Added a health check template to display the service status.
- Included a test suite to verify the template resolution logic.
- Updated `pyproject.toml` to include new HTML templates in the package data.
2026-06-02 14:16:42 +02:00

5.1 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:

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 DB path to: DUCKDB_PATH=/app/data/arbitrade.duckdb

Required environment variables

  • APP_ENV=prod
  • APP_HOST=0.0.0.0
  • APP_PORT=9090
  • DUCKDB_PATH=/app/data/arbitrade.duckdb
  • LOG_LEVEL=INFO
  • LOG_JSON=true
  • KRAKEN_API_KEY=<set-in-coolify-secret>
  • KRAKEN_API_SECRET=<set-in-coolify-secret>
  • KRAKEN_API_KEY_PERMISSIONS=query,trade
  • FERNET_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.

  1. Open your Coolify project and select Create New Resource.
  2. Choose deployment source:
  • Public repo: use Public repository and provide HTTPS URL.
  • Private Gitea repo: use deploy key flow from the Gitea guide.
  1. Set repository URL for this project:
  • https://git.allucanget.biz/allucanget/arbitrade.git (public)
  • or SSH URL if private deploy key is used.
  1. Choose build pack:
  • Prefer Dockerfile for this repo, because Docker build behavior is explicitly defined.
  • Use Nixpacks only if you intentionally want auto-detected build logic.
  1. Configure branch and base directory:
  • Branch: your deploy branch (for example main)
  • Base directory: /
  1. Configure network:
  • Exposed port: 9090
  • Domain: set your Coolify domain/custom domain
  1. Configure environment variables and secrets from the Common Runtime Configuration section.
  2. Add persistent storage mount /app/data.
  3. Configure health check:
  • Path: /health
  • Ensure container includes curl or wget if using UI-defined checks.
  1. Click Deploy and verify:
  • Deployment logs complete successfully.
  • GET /health returns success.

Optional (Git webhook auto-deploy with Gitea):

  1. In Coolify resource, open Webhooks and copy Manual Git Webhook URL.
  2. Set webhook secret in Coolify.
  3. In Gitea repo settings, add webhook URL + same secret and enable Push events.
  4. 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
  1. Ensure CI publishes the image before first deployment.
  2. In Coolify, select Create New Resource.
  3. Choose Application deployment based on Docker Image.
  4. Set image reference:
  • Registry: git.allucanget.biz
  • Image: git.allucanget.biz/allucanget/arbitrade:latest
  1. Configure registry credentials in Coolify if your registry requires auth.
  2. Leave build/install/start commands empty unless you need overrides.
  3. Set network and health:
  • Exposed port: 9090
  • Health check path: /health
  1. Add environment variables and secrets from the Common Runtime Configuration section.
  2. Add persistent storage mount /app/data.
  3. Deploy and verify:
  • Logs show container start success.
  • GET /health returns success.

Update flow for new releases:

  • Push code and let CI publish a new latest image.
  • Trigger redeploy in Coolify for this resource.

Quick Troubleshooting

  • No available server from 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.html at 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 persistent mount exists at /app/data and DUCKDB_PATH points there.
  • Registry pull fails:
  • Re-check Docker registry credentials in Coolify.
  • App starts but unavailable externally:
  • Confirm exposed port is 9090 and domain is attached to this resource.