This guide will walk you through the setup of a multi-service application using Docker Compose. The architecture involves several services that work together to create a fully functional application stack.
Here’s an overview of the services involved in the setup:
This document provides a detailed overview of running the demo using docker compose.
This document provides a detailed overview of each service defined in the Docker Compose configuration. Each service plays a specific role in the application architecture.
- Purpose: Provides the user interface for interacting with the application.
- Dockerfile Path:
./frontend-service.dockerfile - Build Context:
./frontend - Port Mapping:
80:3000(Host Port: Container Port) - Dependencies:
- Broker Service
- Mailhog
- MongoDB
- Postgres
- RabbitMQ
- Listener Service
- Authentication Service
- Logger Service
- Mailer Service
- Purpose: Handles message brokering between various services.
- Dockerfile Path:
./broker-service.dockerfile - Build Context:
./broker-service - Port Mapping:
8080:80(Host Port: Container Port) - Dependencies: RabbitMQ
- Purpose: Manages application logs and stores them in MongoDB.
- Dockerfile Path:
./logger-service.dockerfile - Build Context:
./logger-service - Dependencies: MongoDB
- Purpose: Manages the sending of emails using Mailhog.
- Dockerfile Path:
./mail-service.dockerfile - Build Context:
./mail-service - Environment Variables:
MAIL_DOMAIN: localhostMAIL_HOST: mailhogMAIL_PORT: 1025MAIL_ENCRYPTION: noneMAIL_USERNAME: ""MAIL_PASSWORD: ""FROM_NAME: Mohan RajFROM_ADDRESS: mohan18.welcome@example.com
- Dependencies: Mailhog
- Purpose: Manages user authentication and connects to the Postgres database.
- Dockerfile Path:
./authentication-service.dockerfile - Build Context:
./authentication-service - Port Mapping:
8081:80(Host Port: Container Port) - Environment Variables:
DSN:host=postgres port=5432 user=postgres password=password dbname=users sslmode=disable timezone=UTC connect_timeout=5
- Dependencies: Postgres
- Purpose: Listens for events and interacts with the Logger Service.
- Dockerfile Path:
./listener-service.dockerfile - Build Context:
./listener-service - Environment Variables:
LOG_SERVICE_URL:http://logger-service/log
- Dependencies: RabbitMQ
- Purpose: The database for storing user information.
- Image:
postgres:15.4 - Port Mapping:
5432:5432(Host Port: Container Port) - Environment Variables:
POSTGRES_USER: postgresPOSTGRES_PASSWORD: passwordPOSTGRES_DB: users
- Volumes:
./db-data/postgres/:/var/lib/postgresql/data/
- Purpose: Stores logs from the Logger Service.
- Image:
mongo:6.0.3 - Port Mapping:
27017:27017(Host Port: Container Port) - Environment Variables:
MONGO_INITDB_DATABASE: logsMONGO_INITDB_ROOT_USERNAME: adminMONGO_INITDB_ROOT_PASSWORD: password
- Volumes:
./db-data/mongo/:/data/db
- Purpose: Simulates an email server for development.
- Image:
mailhog/mailhog:v1.0.1 - Port Mapping:
1025:1025(SMTP)8025:8025(Web Interface)
- Purpose: Provides a message queue for communication between services.
- Image:
rabbitmq:3.11-alpine - Port Mapping:
5672:5672(Host Port: Container Port) - Volumes:
./db-data/rabbitmq/:/var/lib/rabbitmq/
This overview outlines the key aspects of each service in your Docker Compose setup, including their purposes, configurations, and dependencies. Each service is designed to fulfill a specific role, and together they form a comprehensive system that can handle various application needs.
