SIBA22S Softala team
SIBA23K Softala team
SWP23K team
SWP24K team
Copyrights reserved. This Project is a collaborative work, which aims at building an information system that makes it possible to calculate and optimize teaching space and equipment usage for different lessons.
Backend side installation instructions
-
Install Mariadb version 10.x or newer
-
Install a Graphical SQL-editor: DBeaver or MySQL Workbench
-
Create in your chosen SQL editor a database scheme called casedb. Run 000__CreateALLdb.sql script to create files to the database
-
Clone the repository
git clone https://github.com/haagahelia/Siba_be.git
-
Change directory
cd Siba_be
-
Install needed packages
npm install
-
Create the .env file. Add .env to the root of the project
BE_API_URL_PREFIX=/api BE_SERVER_PORT=3001 DB_DRIVER_MODULE=mysql BE_DEVELOPMENT_PHASE=true DB_HOST=localhost DB_PORT=3306 MARIADB_USER=<<DB Username>> MARIADB_PASSWORD=<<DB password>> MARIADB_ROOT_PASSWORD=<<root password>> # Needed when running with Docker. Otherwise not needed. MARIADB_DATABASE=casedb DB_DEBUG=true DB_MULTIPLE_STATEMENTS=true DB_CONNECTION_POOL_MIN=1 DB_CONNECTION_POOL_MAX=7 SECRET_TOKEN=<<Secret token here for the JWT>> TOKEN_EXPIRATION_SECONDS=3600
The secret_token has to be something of the length and format of: A3fs9t395dsgSDf3fRsTse349. But not that one! Hardening process should change it for the real deployment of the backend. This particular one A3fs... should not be used even for testing! This is visible in the internet. It's just a dummy value to help randomizing the real one!
Be context aware! E.g. in the list above the ports are usually changed. And if you use a tunnel, then you target the tunnel port, not the real ports. Ask help! Usually one excel has all the dev time secrets for you.
-
Application launch
npm start
Attention! If it doesn't boot install:
npm install -g nodemon
-
Attention! Follow the Frontend repo installation guide as well
-
Follow installation steps from 1 to 5
-
Run this command to launch application
docker-compose -f docker-compose-be.yaml up -d
-
Edit the .env file to set your desired database name, root password, secondary user/password combination, and the host machine DB port
-
Run this command to launch application:
docker-compose -f docker-compose-db.yaml up -d
-
Alternatively run from command prompt:
docker run --detach --name mariadock --env MARIADB_USER=alternate_user --env MARIADB_PASSWORD=alternate_user_psw --env MARIADB_ROOT_PASSWORD=root_psw mariadb:latest
-
Access the container terminal:
docker exec -it mariadock bash
-
Access the DB directly using mysql terminal command:
mysql -u root -p
-
Continue the configuration of the local DB as described in the step by step guide located in Database/Documentation/local_mariadb_windows_installation.md
-
Reset the database data if needed by removing the created Docker volume:
docker volume rm db_project_mariadb_volume
Remove the container and restart it. Note! If the command doesn't work, check the right volume name from the Docker compose script or list all volumes with the following command:
docker volume ls
You can also check volumes with Docker Desktop.
Configuration of the local DB is described in the guide located in Database/Documentation/local_mariadb_windows_installation.md. The docker-compose file covered the process and make the application ready to use.
-
Follow installation steps from 1 to 5
-
Edit the docker-compose-dbbe.yaml file to have the right configuration according to your environment (database, username, password, root password)
-
Run this command to launch database and backend
docker-compose -f docker-compose-dbbe.yaml up -d
-
Some useful commands:
Access mariadb container terminal:
docker exec -it mariadock sh
Access mariadb container terminal:
docker exec -it siba_be_dock sh
Exit terminal inside container:
exit