Docker - IP-2025/waves-of-the-fallen GitHub Wiki

DockerBackend

This project uses Docker to containerize both the backend and the database. Follow the steps below to get the application up and running in your local environment.

Prerequisites

  • Ensure Docker is installed and running on your system.
  • Installation
  • Recommended: Docker Compose (usually included with Docker Desktop).

To verify Docker is installed, run:

docker --version
docker compose version

Docker Compose

  • The Docker images for both the backend and database are built and managed using Docker Compose.
  • For Docker Compose to work correctly, a .env file is required in the backend/ directory. This file contains important environment variables such as the database URL, ports, and secrets.

[!CAUTION] Never commit a .env file.

  • The repository includes a .env-template file that can be used as a starting point.
# Navigate to the backend directory
cd backend

# Copy the template to create your .env file
cp .env-template .env
  • to start the docker containers run in the backend/ dir this command:
docker compose up --build
  • after the containers have started correctly you can check them in docker-desktop or:
docker ps

Docker Containers

The docker compose will create 3 docker containers:

  1. For the nodejs express backend
  2. For the postgreSQL databse
  3. For pgamdin (tool to look into dbs)

PgAdmin

  • pgAdmin is a web-based tool to manage PostgreSQL databases.
  • Then open your browser at http://localhost:5050/ and log in.
  • the login information can be adjusted and found inside of the .env
  • after logging in create a connection to the db by:
  1. pressing on Add new Server
  2. give the database a name in the general tab
  3. in the connections tab enter Hostname, Password and Username all these values can be found in the .env