Skip to content

2. Setup

Tamer Hamad Faour edited this page Nov 25, 2024 · 1 revision

Project Setup

This document provides step-by-step instructions to set up the project locally.


Prerequisites

Before starting, make sure you have the following installed on your machine:

  1. Docker:
  2. Docker Compose:
    • Docker Compose is included with Docker Desktop. Verify the installation by running:
      docker-compose --version
  3. PostgreSQL:
    • A running instance of PostgreSQL. You can install it locally or use a cloud-hosted service.

Setup Instructions

1. Clone the Repository

Clone the project repository and navigate into the project directory:

git clone https://github.com/TamerOnLine/MystroTamer-FastAPI-Docker.git
cd MystroTamer-FastAPI-Docker

2. Configure Environment Variables

Create a .env file in the root directory and add the required environment variables. Here's an example .env file:

POSTGRES_USER=your_db_user
POSTGRES_PASSWORD=your_db_password
POSTGRES_DB=your_db_name
POSTGRES_HOST=db
POSTGRES_PORT=5432
SECRET_KEY=your_secret_key

Make sure to replace the placeholder values with your actual configuration.

3. Build and Run Docker Containers

Build and run the application using Docker Compose:

docker-compose up --build

This will:

  • Build the necessary Docker images.
  • Start the application and its dependencies.

4. Access the Application

Once the containers are running, you can access the application at:

http://localhost:8000

Useful Commands

Stop and Remove Containers

docker-compose down

Restart Containers with a Fresh Build

docker-compose up --build

View Container Logs

docker-compose logs

Troubleshooting

If you encounter issues during the setup process, consider the following solutions:

1. Ensure Docker is Running

Verify that Docker is installed and running on your system:

docker --version

2. Check Docker Compose Logs

Inspect the logs for error messages:

docker-compose logs

3. Verify PostgreSQL Connection

Ensure the PostgreSQL instance is running and accessible with the credentials provided in the .env file.


Additional Resources


Support

If you continue to experience issues, please open a ticket in the GitHub Issues section with detailed information about the problem.