Appearance
Ports & processes
Everything the platform runs on the server in one place: what each process is, which port it uses, who starts it, and which ports must stay closed to the internet.
Ports
| Port | Service | Reachable from | Set by |
|---|---|---|---|
| 80, 443 | Nginx: the exchange, /chart.io, and socket.yourdomain.com | Internet | Nginx config |
| 5432 | PostgreSQL | This server only | DB_PORT |
| 6379 | Redis (queues, cache, sessions) | This server only | REDIS_PORT |
| 6001 | Soketi WebSocket server | This server only (Nginx proxies it) | port in socket-config.json |
| 8081 | Chart service (chart-udf) | This server only (Nginx proxies /chart.io) | TRADINGVIEW_CHART_PORT |
| 8000 | Ethereum bridge | This server only | bridges/ethereum/eth-config.js |
| 8001 | BNB Smart Chain bridge | This server only | bridges/bnb/bnb-config.js |
| 8002 | Tron bridge | This server only | bridges/tron/tron-config.js |
| 8003 | Polygon bridge | This server only | bridges/polygon/polygon-config.js |
| 8006 | Solana bridge | This server only | bridges/solana/solana-config.js |
| 8007 | TON bridge | This server only | APP_TON_PORT |
| 9000 | Rust matching engine (optional) | This server only | Fixed in rust-matching-engine/src/main.rs |
| 8332 | Bitcoin Core RPC (if you offer BTC) | This server only | BITCOIND_PORT |
Close everything except 80, 443 and SSH
The bridges, Soketi, the chart service and the matching engine listen on all interfaces and have no password of their own. A firewall that allows only SSH, HTTP and HTTPS is essential:
bash
sudo ufw default deny incoming
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enablePM2 processes
All of these run under the web server user's PM2 (see Installation → Prepare PM2). Check them with pm2w status.
Started automatically by pm:watcher
All background services are defined once in config/pm.php. php artisan pm:ecosystem writes them to the PM2 file storage/app/pm2/ecosystem.json (memory limit, 15 s graceful stop, crash back-off per service), and the scheduler's pm:watcher starts whatever is missing every minute:
| PM2 name | Command | Plan |
|---|---|---|
horizon | php artisan horizon | All |
soket | soketi start --config=socket-config.json | All |
chart | node chart-udf/src/app.js | All |
market-watcher | php artisan market-watcher:stats-persistent | All |
order-processor | php artisan market:order-process | All |
stop-trigger | php artisan orders:trigger-stops --worker | All |
trading-bots | php artisan bots:run | All |
liquidity-binance | php artisan liquidity:binance (one per shard with PM_LIQUIDITY_SHARDS: liquidity-binance-1, -2, ...) | All |
liquidity-custom | php artisan liquidity:custom | All |
futures-mark-price | php artisan futures:mark-price | 5 |
futures-processor | php artisan market-watcher:liquidation | 5 |
futures-limit-processor | php artisan futures:limit-order-process | 5 |
futures-tpsl-process | php artisan futures:tpsl-process | 5 |
peer-order-processor | php artisan peer-order:watcher | 5 |
options-processor | php artisan options-watcher:process | 5 |
"Plan 5" processes run only when APP_PLAN=5. Services switched off in Admin → Market services stay off. soket and chart are never started a second time if a copy started some other way already answers on their port.
To start everything by hand (fresh server, without waiting for the scheduler):
bash
php artisan pm:ecosystem
pm2w start storage/app/pm2/ecosystem.json
pm2w savePer-market liquidity (old layout)
With PM_LIQUIDITY_MODE=per-market, pm:market-watcher runs one process per market instead of the two liquidity runners:
| PM2 name | Command |
|---|---|
LIQ-<MARKET> (for example LIQ-BTCUSDT) | market:run-liquidity <market>, or market:custom-token-liquidity <market> for custom-token markets |
In the default shared mode pm:watcher removes leftover LIQ-* processes.
Started by you, once
| PM2 name | Start with | Purpose |
|---|---|---|
bridge-ethereum, bridge-bnb, bridge-tron, bridge-polygon, bridge-solana, bridge-ton | pm2w start <network>/app.js --name bridge-<network> (from bridges/) | Blockchain bridges |
matching-engine | pm2w start target/release/rust-cex --name matching-engine (from rust-matching-engine/) | Matching engine, optional |
After starting them, run pm2w save so they come back after a reboot.
Don't use queue.json or marketwatcher.json
The project root also has queue.json and marketwatcher.json. They are older start files: they start Horizon with php8.1 and the old market-watcher:stats command under the names horizon and marketwatcher. Both processes are now started by pm:watcher, so these files would only create conflicting copies. socket.json and chart.json still work, but soket and chart are in the ecosystem file now: pm:watcher replaces a copy started from them once with its own definition.
Logs
| What | Where |
|---|---|
| Platform errors and warnings | storage/logs/laravel-YYYY-MM-DD.log |
| System Monitor | storage/logs/system-monitor.log |
| Any PM2 process | pm2w logs <name>, files in /var/www/.pm2/logs/ (the PM2 home from PM_PATH) |
| Nginx | /var/log/nginx/access.log, /var/log/nginx/error.log |
| PHP-FPM | /var/log/php8.3-fpm.log |
| PostgreSQL | /var/log/postgresql/ |
PM2 logs grow without limit by default. Install log rotation once:
bash
pm2w install pm2-logrotateThe project's clearlogs.sh empties a few PM2 logs under /root/.pm2, an older layout. With PM2 running as www-data the logs live in /var/www/.pm2/logs, so use pm2w flush instead.
