Skip to content

Latest commit

 

History

History
115 lines (79 loc) · 3.09 KB

File metadata and controls

115 lines (79 loc) · 3.09 KB


TimeSwap

Backend Setup Guide (C# with Docker)

PrerequisitesInstallation StepsAdditional Commands

TimeSwap Backend Setup Guide

Prerequisites

Ensure you have the following installed before proceeding:

Note:
Make sure to place your SSL certificates in the /etc/letsencrypt directory on your host machine. This directory should be mounted into the reverse-proxy container as specified in the docker-compose.yml file:

volumes:
  - /etc/letsencrypt:/etc/letsencrypt:ro

This allows the Nginx container to access the certificates for HTTPS configuration.

Installation Steps

Clone the Repository

# Clone this repository
git clone https://github.com/tranduckhuy/time-swap.git

# Navigate to the backend directory
cd time-swap

Environment Setup

Base Configuration

The backend uses a base.yml file to manage common environment variables and a docker-compose.override.yml file for environment variables specific to each container. Make sure these files are properly configured before proceeding.

Check base.yml file and docker-compose.override.yml file for environment variables

You’ll find environment variables like the following examples:

ConnectionStrings__CoreDbConnection: Host=timeswapdb;Port=5432;Database=TimeSwapApi;Username=${CORE_DB_USER};Password=${CORE_DB_PASSWORD}
JWTSettings__SecretKey: ${JWT_SECRET}
JWTSettings__ValidAudience: ${JWT_AUDIENCE}
JWTSettings__ValidIssuer: ${JWT_ISSUER}
JWTSettings__ExpiryInSecond: ${JWT_EXPIRY}

...
- FrontendUrl=${FRONTEND_URL}
...

Note: Replace placeholder values with your actual configuration.

Start Backend Services

Run the following command to start the backend services using Docker Compose:

# Build and start the services
$ docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

This will start:

  • Authentication Service from ghcr.io/tranduckhuy/timeswap-auth:latest
  • API Service from ghcr.io/tranduckhuy/timeswap-api:latest
  • Nginx for reverse proxy management

Note: Ensure your base.yml and docker-compose.override.yml is correctly set up if you need custom overrides.

Additional Commands

Stop Services

docker-compose down

Rebuild and Restart Services

docker-compose up --build -d

Check Logs

docker-compose logs -f

Verify Running Containers

docker ps

Your backend is now up and running! 🚀