Base on create-colyseus-app
Starting from a new install of Ubuntu 20.04
sudo apt-get update
sudo apt-get upgrade
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm install 14.17.5
sudo npm install -g typescript
sudo npm install -g ts-node
sudo apt install nginx
sudo systemctl status nginx
sudo npm install pm2@latest -g
npm install / yarn
pm2 start run-ts.sh --name SERVER
pm2 dashboard
Add to /etc/nginx/sites-available
server {
listen 80;
server_name *** YOR DOMAIN NAME ***;
location / {
proxy_pass http://localhost:2567;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
}
Test and restart
sudo nginx -t
sudo systemctl restart nginx
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d *** YOR DOMAIN NAME ***
index.ts
: main entry point, register an empty room handler and attach@colyseus/monitor
MyRoom.ts
: an empty room handler for you to implement your logicloadtest/example.ts
: scriptable client for the loadtest tool (seenpm run loadtest
)package.json
:scripts
:npm start
: runsts-node index.ts
npm run loadtest
: runs the@colyseus/loadtest
tool for testing the connection, using theloadtest/example.ts
script.
dependencies
:colyseus
@colyseus/monitor
express
devDependencies
ts-node
typescript
@colyseus/loadtest
tsconfig.json
: TypeScript configuration file
MIT