Skip to content

User guide for production setup

Arthur Werbrouck edited this page May 23, 2024 · 4 revisions

pigeonHole setup

Dependencies

Ensure you have the following installed on your system:

  • Java 17
  • Docker
  • npm

Project Structure

The project is composed of four main parts:

  • Express Server
  • Backend Application
  • Frontend Application
  • Database

Environment Setup

  1. Fill in the .env.template file with your specific configuration and rename it to .env.
  2. Run envBuilder.py to set up the environment variables.

Running the Project

Database

For running the production version with nginx support, use:

docker-compose -f docker-compose.prod.yaml up -d --build

Backend

Navigate to backend/app/ and execute the following commands:

cd /home/selab2/pigeon/backend/app
./gradlew clean build --no-daemon
rm -rf gradle.log
nohup java -jar build/libs/pidgeon-0.0.1-SNAPSHOT.jar &> gradle.log &

To view the logs run

tail -f gradle.log

Frontend

Navigate to the frontend directory and execute:

npm install
npm run build

Express Server

Navigate to backend/web-bff/app and execute:

npm install
pm2 start ./bin/www.js --name "express-server"

To view the logs run

pm2 logs express-server --lines 30

To stop it run

pm2 stop express-server

Troubleshooting

If you encounter any issues while running the project, try the following:

  • If the docker-compose command fails, you might need admin privileges. Try running the command with sudo.

  • If you have issues connecting to the database, ensure there is only one server running on port 5432. You can check this by running the following command on Linux:

sudo lsof -i :5432
  • If the above steps don't resolve the issue, try deleting the Docker volume and rerunning the docker-compose command. This will create a fresh volume. You can delete the volume with the following command:
docker volume rm <project_directory_name>_postgres-data

Replace <project_directory_name> with the name of your project directory.