Appearance
Updating the platform
Updates bring fixes and new features. Follow the same steps every time, in order, and you can always go back if something goes wrong.
Update at a quiet time
Pick the hour with the least trading, usually early morning UTC on a weekday. Tell users in advance with an announcement.
Back up
Take a fresh database and files backup right before updating. See Backups & restore.
bash
/usr/local/bin/exchange-backup.shAlso note the current version, so you can return to it:
bash
cd /var/www/exchange
git rev-parse HEAD > ~/before-update.txtTurn on maintenance mode
In Admin → Settings → General, turn on Maintenance mode. Visitors see the maintenance page, and admins keep full access to test. See General settings.
Then stop new background work while files change:
bash
php artisan horizon:pauseGet the new code
bash
cd /var/www/exchange
git pull
# or unzip the new release archive over the folder, keeping .env, storage/ and socket-config.jsonInstall dependencies
bash
composer install --optimize-autoloader
npm ciIf the bridges or chart service changed, update them too:
bash
(cd chart-udf && npm ci)
cd bridges && npm install && for n in ethereum bnb tron polygon solana ton; do (cd $n && npm install); done; cd ..Update the database
bash
php artisan migrate --forceRead the output. If a migration fails, stop here and roll back.
Build the front-end
Rebuild both bundles and change the asset hash, exactly as in Building assets.
Make sure USER_ASSETS ends as "false" afterwards.
Clear caches
bash
php artisan optimize:clearThis clears cached configuration, routes, views and events, so the new code is used everywhere.
Restart background processes
Workers and long-running processes still run the old code until they restart:
bash
php artisan pm:watcher # applies changes to config/pm.php (new / changed services)
php artisan horizon:terminate # Horizon finishes its jobs, PM2 starts it again
pm2w restart storage/app/pm2/ecosystem.json # every background service (each finishes its current pass first)
pm2w restart bridge-ethereum bridge-bnb # each bridge that changed
sudo systemctl reload php8.3-fpm # clears PHP's code cacheWithout the restart, the workers still pick up the new code within an hour (they restart themselves hourly). You can also restart single services from Admin → Market services.
Test, then open
With maintenance still on, sign in as an admin and check:
- the home page, a trade page (chart, order book, Stable connection), your wallet
- a small test order, then cancel it
- the admin dashboard and System Monitor
Then turn Maintenance mode off.
Less downtime
- Build first, switch later. Build the new version in a second folder (for example
/var/www/exchange-new), with its ownvendorand compiled assets. Then run migrations, swap the folders (or a symlink that Nginx points to), and restart the processes. Users see only the last minute. - Check migrations before the window. Run
php artisan migrate --pretendon a copy of production to see what each migration will do. - Test on staging. Restore last night's backup onto a staging server and do the update there first.
Rolling back
If the new version has a serious problem:
Turn maintenance on.
Return to the old code:
bashgit checkout $(cat ~/before-update.txt) composer install --optimize-autoloaderIf migrations ran, restore the database backup you took before updating (see Restore, step 3). Running
migrate:rollbackisn't safe for every migration, and orders placed after the backup would be lost either way. That's why the update starts in maintenance mode.Rebuild the front-end, clear caches and restart processes, as above.
Turn maintenance off.
Don't restore while trading
Restoring a database backup removes everything that happened after it was taken: trades, deposits, withdrawals. Only restore while maintenance is on, and before reopening trading.
