Table of Contents | ||||
---|---|---|---|---|
|
I. Server Requirements
xChat supports all platforms: Windows, MacOS, Linux.
...
2GB of RAM - recommend 4GB
40GB of HDD
1 CPU core - recommend 2 cores at least
3 domains / sub domains
api.[your-domain]
and point to server IP addressadmin.[your-domain]
and point to server IP address[your-domain]
and point to server IP address
II. Software Requirements
MongoDBv3 >= v4.62 - To install please download mongoDB
Redis serverv2 >=v5.8x - To install please download and setup Redis
Nginx
v1.3
with http_auth_module is enabledPM2 is a daemon process manager that will help you manage and keep your application online 24/7
Yarn or npm to manage nodeJS package
Typescript 4.2.3 or higher - To install run
npm install typscript@latest
...
Expand | ||
---|---|---|
| ||
Testing
From command line / terminal please run these commands to check
1. NodeJS
Code Block |
---|
$ node -v v14.16.0 |
2. MongoDB
Code Block |
---|
$ mongo --version MongoDB shell version v4.0.7 git version: 1b82c812a9c0bbf6dc79d5400de9ea99e6ffa025 allocator: system modules: none build environment: distarch: x86_64 target_arch: x86_64 |
3. Redis Server
Code Block |
---|
$ redis-server --version Redis server v=5.0.4 sha=00000000:0 malloc=libc bits=64 build=d4ba11298acbb366 |
4. FFMPEG
Code Block |
---|
$ ffmpeg -version fmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 |
5. NGINX
Code Block |
---|
$ nginx -v nginx version: nginx/1.10.3 |
6. Graphicsmagick
Code Block |
---|
$ gm GraphicsMagick 1.3.31 2018-11-17 Q16 http://www.GraphicsMagick.org/ Copyright (C) 2002-2018 GraphicsMagick Group. Additional copyrights and licenses apply to this software. See http://www.GraphicsMagick.org/www/Copyright.html for details. Usage: gm command [options ...] .... |
7. Pm2
Code Block |
---|
$ pm2 -v [PM2] Spawning PM2 daemon with pm2_home=/Users/xxx/.pm2 [PM2] PM2 Successfully daemonized 4.4.0 |
8. Yarn
Code Block |
---|
$ yarn -v 1.22.4 |
III. Setup and Test It Locally
1. API
Ensure
node v14.x
,MongoDB
,Redis server
,FFMPEG
,Graphicsmagick
andyarn
are runningCD to your API folder
Run
yarn
to install nodeJS dependencies
...
Open browsers and run
http://localhost:9000
it should show success message orCannot GET /
2. Frontend Web
Ensure
nodejs
andyarn
are runningFrom frontend root directory run
yarn
command to install nodejs dependencies
...
Then you can open browser
http://localhost:8081
to see the web
3. Admin Web
Similar Frontend web, same steps.
You should change default port with
8082
then openhttp://localhost:8082
to see your admin app
IV. Setup Production Environment with NGINX
1. API
Make sure you have installed nodeJS dependencies by
yarn
commandIn API root directory, copy
config > development.json
toconfig > production.json
Open
.env
file and changeNODE_ENV
toproduction
PORT
to 8080Change your base url, logoUrl… to your production Url
...
Run
pm2 start server/www.js --name=api
to run API under background
2. Frontend Web
Make sure you have installed nodeJS dependencies by
yarn
commandEdit your API url and socket Url in
config > shared.ts
Run
yarn build
...
Run
pm2 start yarn --interpreter bash --name xchat-web
to run application under port 8081
3. Admin Web
Similar Frontend web, same steps.
You should change default port to 8082 by
export PORT=8082
or change port inserver > index.ts
fileRun
pm2 start yarn --interpreter bash --name xchat-admin
to run app under port 8082
4. Setup NGINX
Config ports api, web, admin as following
...
Open browser and access:
http://yourdomain.com
to access web frontendOpen browser and access:
http://admin.yourdomain.com
to access web admin
5. Check applications are running under pm2
Run
pm2 ls
to see your applicationsRun
pm2 stop [id]
to stop app orpm2 reload [id]
to reloadRun applications in start up by
pm2 startup
thenpm2 save
6. Set up NGINX with HTTPS
Check here to setup https with nginx
Setup https with Certbot nginx
7. Migration
From API root directory run
node server/migrate
to seed default values for settings and usersDefault Admin:
admin@example.com
Default Password:
admin
You can change default values in server > migrations folder