Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tope19/microservices-with-symfony

This project consists of two microservices, "users" and "notifications", communicating via a message bus. The services are orchestrated using Docker Compose.
https://github.com/tope19/microservices-with-symfony

Last synced: about 15 hours ago
JSON representation

This project consists of two microservices, "users" and "notifications", communicating via a message bus. The services are orchestrated using Docker Compose.

Awesome Lists containing this project

README

        

# Microservices Application with Docker

This project consists of two microservices, "users" and "notifications", communicating via a message bus. The services are orchestrated using Docker Compose.

## Overview

The microservices architecture allows for scalable, decoupled, and independently deployable components, enabling efficient development and maintenance of complex systems. In this setup, the "users" service handles user data submission, while the "notifications" service processes and logs the received data.

## Symfony

Symfony is a PHP web application framework used for building the microservices in this project. It provides a robust set of tools and features for developing scalable and maintainable applications.

## Docker Compose Configuration

The `docker-compose.yml` file defines the services and their configurations:

### Services

- **Redis**: Acts as the message broker for communication between microservices.
- **Users Service**: Handles user data submission via POST requests and dispatches events to the message broker.
- **Notifications Service**: Consumes events from the message broker and logs the received data.

### Ports

- **Users Service**: Exposed on port 8000.
- **Notifications Service**: Exposed on port 8001.

### Volumes

- Both services mount volumes for log storage to persist logs outside the containers.

## Task Description

The microservices application follows these requirements:

1. **User Service**:
- Exposes an endpoint `POST /users` to receive user data (`{"email","firstName","lastName"}`) and stores it in the database.
- Upon data submission, generates an event and sends it through the message broker to the "notifications" service.

2. **Notifications Service**:
- Consumes events from the message broker.
- Logs the received data in a log file.

3. **Test Coverage**:
- The codebase is covered with unit, integration, and functional tests to ensure reliability and correctness.

## Instructions

### Setup and Testing

1. **Clone the Repository**:
```bash
git clone https://github.com/Tope19/microservices-with-symfony

2. **Navigate to the Project Directory**:
```bash
cd microservices

docker-compose build
docker-compose up -d

# For Users Service
docker-compose exec users php bin/phpunit test

docker-compose down

### API Endpoints
http://localhost:8000/api/v1/users/create