If you haven't configured your environment variables yet, review the Configuration page first.
Self-Hosting
Complete instructions for deploying OFFER-HUB Orchestrator on your own infrastructure using Docker.
Run OFFER-HUB Orchestrator on your own server with full control over data, uptime, and configuration. This guide covers everything from initial setup to ongoing maintenance using Docker.
Prerequisites
Before you begin, make sure your host machine meets the following requirements:
- Docker v20.10 or later
- Docker Compose v2.0 or later
- PostgreSQL 15+ (or managed service like Supabase, Neon, Railway)
- Redis 7+ (or managed service like Upstash, Railway)
- A registered domain name (recommended for production)
- At least 2 GB of RAM and 20 GB of disk space
Verify that Docker is installed and running:
docker --version && docker compose versionOn older installations you may need to use docker-compose (with a hyphen) instead of docker compose.
Architecture Overview
The OFFER-HUB deployment consists of:
Docker Setup
Project Structure
Create a deployment directory:
mkdir offer-hub-deploy && cd offer-hub-deployYour directory will contain:
docker-compose.yml
Create a docker-compose.yml file:
The nginx service is optional for development but strongly recommended for production. It handles TLS termination and reverse-proxying.
Using External Services
If you prefer managed databases, remove postgres and redis services and update the environment:
Building from Source
To build images locally instead of pulling pre-built ones:
git clone https://github.com/OFFER-HUB/offer-hub-orchestrator.git && cd offer-hub-orchestratordocker build -t offerhub/orchestrator:latest .Environment Variables
Create a .env file in the same directory as your docker-compose.yml.
Required Variables
| Variable | Description |
|---|---|
NODE_ENV | Runtime environment: development, staging, production |
DATABASE_URL | PostgreSQL connection string |
REDIS_URL | Redis connection string |
OFFERHUB_MASTER_KEY | Master key for creating API keys |
WALLET_ENCRYPTION_KEY | 64 hex chars - AES-256-GCM key for wallet encryption |
TRUSTLESS_API_KEY | Trustless Work API key for escrow |
PLATFORM_USER_ID | Platform user ID for escrow operations |
PUBLIC_BASE_URL | Your Orchestrator's public URL |
Optional Variables
| Variable | Default | Description |
|---|---|---|
PORT | 4000 | HTTP server port |
LOG_LEVEL | info | Logging level: debug, info, warn, error |
PAYMENT_PROVIDER | crypto | Payment mode: crypto or airtm |
STELLAR_NETWORK | testnet | Stellar network: testnet or mainnet |
STELLAR_USDC_ISSUER | Testnet issuer | USDC asset issuer address |
Never commit your .env file to version control. Treat every value as a secret.
Example .env File
Generating Secure Keys
Running in Production
Starting the Stack
Once your .env file is ready, bring everything up in detached mode:
docker compose up -dWatch the logs to confirm all services start cleanly:
docker compose logs -fRunning Database Migrations
Apply Prisma migrations before the first launch (or after pulling a new version):
docker compose exec orchestrator npx prisma migrate deployAlways back up your database before running migrations in production.
Setting NODE_ENV
Make sure NODE_ENV=production is set in your .env file. This enables:
- Optimised builds and minification
- Stricter error handling
- Disabled development-only logging
- Production-level security defaults
TLS / HTTPS
For production deployments you should terminate TLS at the reverse proxy. If you use the nginx service from the Compose file above, place your certificate and key in the certs/ directory and update nginx.conf accordingly.
Example nginx.conf:
Let's Encrypt with Certbot is the easiest way to obtain free TLS certificates.
Health Checks
The Orchestrator exposes a /health endpoint that returns the current service status. The Docker Compose file already configures a health check against it.
Manual Check
curl http://localhost:4000/healthExpected response:
Container Health Status
Docker reports health status directly:
docker compose psA healthy deployment shows (healthy) next to each service. If a service is (unhealthy), inspect its logs:
docker compose logs orchestrator --tail 50Monitoring Tips
- Point an uptime monitor (e.g. UptimeRobot, Betterstack) at
/health. - Set up alerts for non-
200responses or response times above 2 seconds. - Monitor disk usage — logs, database, and Docker images can accumulate over time.
- Track Redis memory usage — BullMQ jobs can grow if not cleaned up.
Background Jobs
The Orchestrator uses BullMQ for background job processing:
| Queue | Purpose |
|---|---|
blockchain-monitor | Monitor Stellar for incoming deposits |
transaction-submit | Submit signed Stellar transactions |
webhook-delivery | Send webhooks to registered endpoints |
balance-sync | Reconcile on-chain and off-chain balances |
Monitor job queues:
Updating
Pulling the Latest Images
docker compose pullApplying the Update
docker compose up -d --remove-orphansThis pulls the newest images, recreates only the containers that changed, and removes any services no longer defined in the Compose file.
Full Update Workflow
The recommended update procedure:
- Back up your database before any update.
- Pull the latest images.
- Run migrations.
- Restart the stack.
Rolling Back
If something goes wrong, roll back to a specific image tag:
Then restart:
docker compose up -dCheck the GitHub Releases page for available tags and changelogs.
Security Checklist
Before going to production, verify:
-
NODE_ENV=productionis set -
OFFERHUB_MASTER_KEYis a strong, unique value -
WALLET_ENCRYPTION_KEYis backed up securely - Database uses SSL (
?sslmode=require) - Redis uses TLS (
rediss://) - HTTPS is enabled with valid certificates
- Firewall only exposes ports 80/443
- Database is not publicly accessible
- Redis is not publicly accessible
- Webhook secrets are configured
Troubleshooting
Orchestrator won't start
Database connection errors
Webhook delivery failing
Next Steps
- Configuration — Full environment variable reference
- Quick Start — Make your first API call
- API Reference — Explore all endpoints
- Webhooks — Set up event notifications