Deployment
Everything runs on one Linux server with Docker (4 vCPU and 8 GB recommended). This page takes the evaluation install to a real one: your domain, HTTPS, backups, updates, and what to do when it grows.
What runs
riders' phones ─┐ ┌─ PostgreSQL (PostGIS)
console users ─┼─ HTTPS ─ nginx ─┬─ API ┼─ Redis
merchants ─┤ │ └─ storage (proof photos, documents)
customers ─┘ └─ console (/, /m, /track)
Everything is in install/docker-compose.yml. The database and Redis are not
published at all; the API and the console listen on 127.0.0.1 only, and nginx
(or Caddy) in front of them terminates HTTPS.
1. Server and domain
- Ubuntu 22.04+ with Docker Engine and the compose plugin.
- Two names pointed at the server, for example
api.yourcourier.comandops.yourcourier.com(the console; the merchant portal isops.yourcourier.com/mand trackingops.yourcourier.com/track/…). - The console's address is also your public website (Console → Website). To
serve it as your main site, point
www.yourcourier.com(or the bare domain) at the console as well, or use that name for the console itself. Staff sign in at/loginon the same address.
2. Configuration
In install/.env:
PUBLIC_API_URL=https://api.yourcourier.com/api
PUBLIC_ADMIN_URL=https://ops.yourcourier.com
DEFAULT_COUNTRY=IN
./install.sh fills the secrets (JWT_*, APP_SECRET_KEY, DB_PASSWORD) on
the first run. Back up install/.env with the database: APP_SECRET_KEY
encrypts the provider keys you save in the console, and without it they
cannot be read.
The console has the API address built in. After changing PUBLIC_API_URL:
docker compose up -d --build admin
3. HTTPS
nginx with Let's Encrypt (certbot --nginx), two server blocks:
server {
server_name api.yourcourier.com;
client_max_body_size 15m; # proof-of-delivery photos, documents
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
server_name ops.yourcourier.com;
location / { proxy_pass http://127.0.0.1:3001; proxy_set_header Host $host; }
}
Payment gateways and WhatsApp call the API back
(https://api.yourcourier.com/api/payments/webhook/<provider>,
/api/webhooks/whatsapp): they need the public HTTPS address, so set
PUBLIC_BASE_URL=https://api.yourcourier.com/api in install/.env too.
4. Before the first real parcel
- An SMS provider under Providers (login codes and customer messages).
- Your market's settings under Markets: tax rate, weekend and holidays, what the door asks for (code, photo, call).
- Hubs and the post codes (or radius) each serves; a default rate card.
- The tracking link merchants share:
PUBLIC_WEB_URL=https://ops.yourcourier.comininstall/.envputs it in every customer message. - Storage for photos:
STORAGE_DRIVER=s3with an S3 or R2 bucket once you have more than a few thousand deliveries (local disk works to start). - Backups, below.
5. Backups
The database is the business: parcels, cash collected, the ledger, invoices.
docker compose exec -T postgres pg_dump -U postgres -Fc parcelkit > parcelkit-$(date +%F).dump
Run it daily (cron) and copy the file off the server. Keep install/.env with
it. To restore: pg_restore -U postgres -d parcelkit --clean parcelkit-….dump.
6. Updates
# new release unzipped beside the old one; copy install/.env across
docker compose up -d --build
docker compose exec -T backend node node_modules/typeorm/cli.js migration:run -d dist/database/data-source.js
docker compose restart backend # start on the new schema
Migrations only add; take a backup first all the same.
7. Growing
When one API process is not enough, install/docker-compose.multi.yml runs
several API replicas behind nginx (install/nginx-api.conf) and a separate
worker for the scheduled jobs (consignee messages, COD sweeps, withholding,
webhooks). Every scheduled job holds a lease in Redis, so two processes never
run the same job twice. Move PostgreSQL and Redis to managed services first;
the code does not change.
Measuring your own server
source/loadtest is the load test we run: riders out on delivery runs sending
their positions and handing parcels over, merchants booking through the API,
customers on the tracking page and dispatchers on the console, all at once.
Run it against a throwaway copy of your install on the same kind of server
(its README has the steps), raise the riders until a 95th percentile crosses
its limit, and you know your headroom.
Two settings matter when you grow: DB_POOL_SIZE (database connections per
API process, default 20) and, with several API containers, keeping
(containers × DB_POOL_SIZE) under PostgreSQL's max_connections.
Health
GET /api/health reports the database and Redis. Point your uptime monitor
at it.