deployment - Paaspop/Paaspop-Server GitHub Wiki

Deployment guide

Down here you'll read about deployment for localhost development and for production

Localhost

Start with pulling the git repository. After pulling the project you'll notice a .env.copy in the following folders:

  • adminpanel
  • nginx
  • uwebsockets

Copy these to .env and make sure the debug mode is set to true.

After this go into each folder individually and run the following command to install the needed packages:

npm install

After the packages are installed run the following command to install nodemon:

npm install -g nodemon

After nodemon is installed correctly install sass-loader:

npm install -g sass-loader

This will make sure that when you work on the project you don't have to restart the project for each change you make.

To start each project run

npm start

in each folder to start the different parts of the project. This should result in something like this:

uWebsockets:
image

Client app:
image

Admin panel:
image

MongoDB

Please don't forget to install MongoDB. This can be downloaded from here.

Logging in the admin panel

If you have not removed the adminSeeder.js from /adminpanel/server/db/seeders you can login using:

Username: admin or admin2
Password: admin

What does debug do?

  1. Debug mode enables a lot of console logs to see what is happening in each part of the program.
  2. Debug mode makes sure the client-app makes API calls to localhost:5454. Otherwhise it would make a call on the docker network in production mode.

Production mode

.env

To install the project for production mode start of by pulling the git repository. After pulling the project you'll notice a .env.copy in the following folders:

  • adminpanel
  • clientapp
  • uwebsockets

Copy these to .env and change the following values:

  • adminpanel
    • DEBUG_MODE=false
    • NODE_ENV='production'
    • ADMIN_TOKEN= RANDOM GENERATED 32 CHARACTER TOKEN
    • GAME_TOKEN= RANDOM GENERATED 32 CHARACTER TOKEN
    • POINTS_TOKEN= RANDOM GENERATED 32 CHARACTER TOKEN
    • WEBSOCKET_AUTOCONNECT=true
  • clientapp
    • VUE_APP_DEBUG_MODE=false
  • uwebsockets
    • ADMIN_TOKEN= adminpanel -> ADMIN_TOKEN
    • GAME_TOKEN= adminpanel -> GAME_TOKEN
    • DEBUG=false

For the random generated tokens I like to use this website: Passwords generator

With the following settings:
image

Admin seeder

If you have not removed the adminSeeder.js from /adminpanel/server/db/seeders, change the default admin/admin username and logins from this file.

Docker

If you have updated the .env files and the adminSeeder.js you can start the docker compose file.

Enter the following command to start everything:

docker-compose up --build -d

This should set the whole project in motion.