Skip to content

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.

3 minutesReferenceDevOpsVerified against the platform code

Ports ​

PortServiceReachable fromSet by
80, 443Nginx: the exchange, /chart.io, and socket.yourdomain.comInternetNginx config
5432PostgreSQLThis server onlyDB_PORT
6379Redis (queues, cache, sessions)This server onlyREDIS_PORT
6001Soketi WebSocket serverThis server only (Nginx proxies it)port in socket-config.json
8081Chart service (chart-udf)This server only (Nginx proxies /chart.io)TRADINGVIEW_CHART_PORT
8000Ethereum bridgeThis server onlybridges/ethereum/eth-config.js
8001BNB Smart Chain bridgeThis server onlybridges/bnb/bnb-config.js
8002Tron bridgeThis server onlybridges/tron/tron-config.js
8003Polygon bridgeThis server onlybridges/polygon/polygon-config.js
8006Solana bridgeThis server onlybridges/solana/solana-config.js
8007TON bridgeThis server onlyAPP_TON_PORT
9000Rust matching engine (optional)This server onlyFixed in rust-matching-engine/src/main.rs
8332Bitcoin Core RPC (if you offer BTC)This server onlyBITCOIND_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 enable

PM2 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 nameCommandPlan
horizonphp artisan horizonAll
soketsoketi start --config=socket-config.jsonAll
chartnode chart-udf/src/app.jsAll
market-watcherphp artisan market-watcher:stats-persistentAll
order-processorphp artisan market:order-processAll
stop-triggerphp artisan orders:trigger-stops --workerAll
trading-botsphp artisan bots:runAll
liquidity-binancephp artisan liquidity:binance (one per shard with PM_LIQUIDITY_SHARDS: liquidity-binance-1, -2, ...)All
liquidity-customphp artisan liquidity:customAll
futures-mark-pricephp artisan futures:mark-price5
futures-processorphp artisan market-watcher:liquidation5
futures-limit-processorphp artisan futures:limit-order-process5
futures-tpsl-processphp artisan futures:tpsl-process5
peer-order-processorphp artisan peer-order:watcher5
options-processorphp artisan options-watcher:process5

"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 save

Per-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 nameCommand
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 nameStart withPurpose
bridge-ethereum, bridge-bnb, bridge-tron, bridge-polygon, bridge-solana, bridge-tonpm2w start <network>/app.js --name bridge-<network> (from bridges/)Blockchain bridges
matching-enginepm2w 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 ​

WhatWhere
Platform errors and warningsstorage/logs/laravel-YYYY-MM-DD.log
System Monitorstorage/logs/system-monitor.log
Any PM2 processpm2w 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-logrotate

The 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.

Owner documentation for the CryptoTech exchange platform.