Skip to content

ddarnold/Online_Tutoring_Platform

Repository files navigation

THUtorium

An online tutoring platform exclusively for THU students from THU students.

Docker

Prerequisites

Before running the application, ensure you have the following installed:

  • Docker Engine: Make sure Docker is installed and running on your machine.
  • Docker Compose: Docker Compose is also required. It typically comes with Docker Desktop, but you can install it separately if needed.

Running the Application with Docker Compose

To run both the backend and frontend applications using Docker Compose, follow these steps:

  1. Navigate to the root directory of the project:

    cd ~/path/to/Online_Tutoring_Platform
  2. Run the Compose command:

    docker-compose up --build --detach

Running Backend, Frontend, or Database Individually

  • Running only the Backend (will start the database and webrtc server as dependencies):

    docker-compose up --build --detach backend
  • Running only the Frontend:

    docker-compose up --build --detach frontend
  • Running only the Database:

    docker-compose up --build --detach database
  • Running only the webrtc server:

    docker-compose up --build --detach webrtc-server

Stopping Containers

  • Stopping all containers:

    docker-compose down
  • Stopping only the Backend:

    docker-compose stop backend
  • Stopping only the Frontend:

    docker-compose stop frontend
  • Stopping only the Database:

    docker-compose stop database
  • Stopping only the webrtc server:

    docker-compose stop webrtc-server

Running the code

  • .env file: An .env file, required for creating the database and backend container, is included in the repository as an example.
  • Running Backend Locally: If you run the backend from an IDE, ensure the database is started first (!!IMPORTANT!!), ideally from the docker container. Identical environment variables should be set in the IDE to match those in Docker. In the intellij IDE, these can be set in the 'Edit Configurations' section.
  • Local Database URL: If the backend runs outside a Docker container, make sure the databaseUrl points to your local database (e.g., localhost).
  • JWT_SECRET_KEY:The secret key must be an HMAC hash string of 256 bits; otherwise, the token generation will throw an error.

Database Data Persistence

  • The database used in this application is configured to be persistent by utilizing Docker volumes.
  • In the docker-compose.yml file, a named volume (postgres_data) is created and mapped to the PostgreSQL container’s data directory (/var/lib/postgresql/data)
  • Additionally, the data is stored in a folder named database in the repository.
  • This setup ensures that all database data remains intact even when the container is stopped or removed, allowing for seamless data management across container lifecycles.

Ports Used

About

Development of a platform that brings students together with tutors.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages