Skip to content

The system of broadcasting to the Collective Means of Displaying the Bauman Moscow State Technical University

Notifications You must be signed in to change notification settings

ZETOsfx/EventController

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Controller

🔥 This project is aimed at efficient administration of information broadcasting on collective display media.

🫡 We strive to provide a convenient and accessible experience for all users so that they can easily receive and share information in learning and work environments.

How to install on server

Installation is running on Ubuntu 22.04 LTS

  1. Install NodeJS with NVM
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

Next, install the latest version with long support

nvm install --lts
  1. Installing PostgreSQL and creating a database
sudo apt update
sudo apt -y install postgresql

Checking available locales

locale -a

Generate a new locale if it doesn't already exist And reload PostgreSQL

locale-gen en_US.UTF-8
systemctl restart postgresql

Let's change the user and start the client to work with PostgreSQL

sudo -u postgres psql

Create a database user

CREATE USER <username> WITH ENCRYPTED PASSWORD '<password>';

Create a database

CREATE DATABASE "<db_name>"
WITH OWNER "<username>"
ENCODING 'UTF8'
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
TEMPLATE template0;

One line command:

CREATE DATABASE "<db_name>" WITH OWNER "<username>" ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TEMPLATE template0;

Granting rights to the user

GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <username>;

Reload the database

systemctl restart postgresql
  1. Setting up EventController

Clone EventController to the server.

git clone https://github.com/ZETOsfx/EventController

Install the dependencies for the client and the application server & install pm2 globally

cd /path/to/folder/EventController/server && npm ci 
cd /path/to/folder/EventController/client && npm ci 
npm i pm2 -g

Create a server side config file

touch /path/to/folder/EventController/server/.env

Let's write the config for the operation of the server part. The following format is used here:

SERVER_PORT=<app_port>
SECRET='<server_app_secret>'
COOKIE_LIVE=<cookie_lifetime_in_ms>
TOKEN_KEY='<auth_token_secret>'
AGE_OF_EDITOR_CALLBACK=3

# DATABASE
DB_HOST_MIG='<db_host>'
DB_PORT=<db_port>
DB_USER="<db_username>"
DB_PASSWORD="<db_password>"
MAIN_DB="<name_of_main_db>"

API_URL=http://<host_ip_form>:<app_port>
NODE_ENV="production"

# FILE UPLOAD FOLDER
UPLOAD_PATH_ORIGIN='<path_to_dir>'
UPLOAD_PATH_IMAGINE='upload' 
DISK_FREE='<path_to_dir_1_level_upper>'

# MAIL DATA
EMAIL='<primary_email_for_bugreports>'
TARGET_EMAIL='<secondary_for_bugreports>'

REFRESH_TOKEN_MAIL='<refresh_token_oauth2>'
CLIENT_ID_MAIL='<client_id_oauth2>'
CLIENT_SECRET_MAIL='<client_secret_oauth2>'

Next, create a configuration file for ORM:

touch /path/to/folder/EventController/server/config/config.json

The following format is used here:

{  
	"development": {  
		"username": "root",  
		"password": null,  
		"database": "database_development",  
		"host": "127.0.0.1",  
		"dialect": "mysql"  
	},  
	"test": {  
		"username": "root",  
		"password": null,  
		"database": "database_test",  
		"host": "127.0.0.1",  
		"dialect": "mysql"  
	},  
	"production": {  
		"username": "root",  
		"password": null,  
		"database": "database_production",  
		"host": "127.0.0.1",  
		"dialect": "mysql"  
	}  
}

Similarly, we add the configuration for migration to the database.

touch /path/to/folder/EventController/server/config/default.json

Format:

{
	"db": {
		"user": "<username>",
		"password": "<password>",
		"host": "<host>",
		"port": <port>,
		"database": "<db_name>"
	}
}

Performing migration:

cd /path/to/folder/EventController/server 
npm run migrate up

In case of successful migration, there will be a single default profile in the database:

Login: admin
Password: 1

Start server

pm2 start /path/to/folder/EventController/server/server.js

Go to the authorization page and log in to this account.

In your browser: http://<host>:<port>
Click on SignIn button in the lower left corner of the screen.
Log in under Admin.

Congrats! Installation completed.


EventController team: funpin, zazacaca32, zetosfx © 2023

About

The system of broadcasting to the Collective Means of Displaying the Bauman Moscow State Technical University

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published