Files
marketplaces/docs/DEPLOYMENT.md
2026-01-18 18:57:06 +04:00

3.4 KiB

Dexar Market - Deployment Guide

Prerequisites

  • Ubuntu/Debian server with root access
  • Domain: dexarmarket.ru
  • Node.js 18+ installed

Quick Deployment

1. Build locally

npm install
npm run build

Output: dist/dexarmarket/browser/

VERIFY BUILD LOCALLY:

cd dist/dexarmarket/browser
ls -la

You MUST see index.html, chunk files, assets/ folder, etc.

2. Upload to server

scp -r dist/dexarmarket/browser/* user@your-server:/var/www/dexarmarket/browser/

3. Set permissions on server

sudo chown -R www-data:www-data /var/www/dexarmarket
sudo chmod -R 755 /var/www/dexarmarket
sudo nginx -t
sudo systemctl reload nginx

Initial Server Setup (one-time)

Install and configure Nginx

sudo apt update
sudo apt install nginx -y
sudo mkdir -p /var/www/dexarmarket/browser

Copy nginx.conf content to /etc/nginx/sites-available/dexarmarket:

sudo nano /etc/nginx/sites-available/dexarmarket

Then enable it:

sudo ln -s /etc/nginx/sites-available/dexarmarket /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d dexarmarket.ru -d www.dexarmarket.ru

Common Issues & Solutions

404 Error - Files Not Found

Check 1: Verify files on server

ls -la /var/www/dexarmarket/browser/

Should show: index.html, chunk-*.js, assets/, etc.

If empty:

# Re-upload files
scp -r dist/dexarmarket/browser/* user@your-server:/var/www/dexarmarket/browser/

Check 2: Verify permissions

namei -l /var/www/dexarmarket/browser/index.html

All directories need x (execute) permission.

Fix permissions:

sudo chown -R www-data:www-data /var/www/dexarmarket
sudo chmod -R 755 /var/www/dexarmarket

Check 3: Test nginx config

sudo nginx -t

Should say "syntax is ok" and "test is successful".

Check 4: View nginx error log

sudo tail -f /var/log/nginx/error.log

This shows the actual error!

502 Bad Gateway - API Issues

This means the API backend is down or unreachable.

Check 1: Is API accessible?

curl -v https://api.dexarmarket.ru:445/ping

Check 2: Port 445 problem Port 445 is unusual for HTTPS and may be blocked by firewalls. Standard HTTPS uses port 443.

Check 3: CORS issues The API must allow requests from https://dexarmarket.ru. Check API CORS configuration.

Check 4: SSL certificate

curl -k https://api.dexarmarket.ru:445/ping

If this works but without -k doesn't, SSL cert is invalid.

Final Verification Checklist

On server, run all these:

# 1. Files exist
ls -la /var/www/dexarmarket/browser/index.html

# 2. Nginx config is valid
sudo nginx -t

# 3. Nginx is running
sudo systemctl status nginx

# 4. Site is enabled
ls -la /etc/nginx/sites-enabled/ | grep dexarmarket

# 5. Test API from server
curl -v https://api.dexarmarket.ru:445/ping

# 6. Check logs
sudo tail -20 /var/log/nginx/error.log
sudo tail -20 /var/log/nginx/access.log

Debug Steps

If still having issues:

  1. Check browser console (F12 → Console tab) - shows JavaScript errors
  2. Check browser network tab (F12 → Network tab) - shows failed requests
  3. Check exact error message in nginx logs
  4. Test locally: cd dist/dexarmarket/browser && python3 -m http.server 8000