Prerequisites • Installation Steps • Additional Commands
Ensure you have the following installed before proceeding:
- Git
- Docker
- Docker Compose
- SSL certificates for Nginx (e.g., using Let's Encrypt)
Note:
Make sure to place your SSL certificates in the/etc/letsencryptdirectory on your host machine. This directory should be mounted into thereverse-proxycontainer as specified in thedocker-compose.ymlfile:volumes: - /etc/letsencrypt:/etc/letsencrypt:roThis allows the Nginx container to access the certificates for HTTPS configuration.
# Clone this repository
git clone https://github.com/tranduckhuy/time-swap.git
# Navigate to the backend directory
cd time-swapThe 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.
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.
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 -dThis 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.
docker-compose downdocker-compose up --build -ddocker-compose logs -fdocker psYour backend is now up and running! 🚀
