The project consists of several services, including a chat service, user service, notification service, group chat service, and an API gateway. It utilizes technologies like Java (Spring Boot likely, given pom.xml files), MongoDB, RabbitMQ, PostgreSQL, and Redis. The application can be run locally using Docker Compose or deployed to a Kubernetes cluster (Minikube for local development).
Before you begin, ensure you have the following installed:
- Java (JDK)
- Maven
- Docker & Docker Compose
- kubectl
- Minikube (for Kubernetes deployment)
git clone <your-repository-url>All services are Maven-based. To build all services and create the necessary JAR files:
mvn clean install -DskipTests
mvn package -DskipTestsThis command should be run at the root of the project where the main pom.xml is located, which will then build the sub-modules (services).
You have two main options for running the application:
This method uses Docker Compose to build images for each service and run them along with backing services like MongoDB and RabbitMQ as defined in docker-compose.yml and service-specific compose files.
- Start the application:
This script builds the JARs and starts the application using Docker Compose. It uses the
./start.sh
docker-compose.ymlfile located in the E2E tests directory.
Note: This will use MailHog for email testing instead of GMail. If you want to use GMail, you will need to override SPRING_MAIL properties in the
docker-compose.ymlfile or with environment variables, or use kubernetes cluster as it is set up to use GMail.
Make sure you have Minikube running. You can start it with:
minikube startApply the Kubernetes manifests to your Minikube cluster:
kubectl apply -f k8s/Get access to the gateway service:
minikube service apigateway-service --urlThe test.sh script is provided for running tests, end-to-end tests using the Docker Compose setup.
./test.shThe k8s-test.sh script is designed to run tests against a Kubernetes deployment.
./k8s-test.shNote: This script requires a running Kubernetes cluster using Minikube. It will also start a
mailhogcontainer for email testing.
Note: This runs against current manifests in
k8s/and usemailhogfor email testing (by applying the manifests ine2e-tests/e2e-k8s/), to run tests against a specific PR, use./k8s-test.sh <pr_number>.
This script:
- Applies Kubernetes manifests from
./k8s/. - Starts
mailhogusing Docker Compose. - Applies Kubernetes manifests from
./e2e-tests/e2e-k8s/to use themailhogservice instead of GMail - Builds the
e2e-testsmodule. - Runs
mvn verifywith aBASE_URLpointing to theapi-gatewayservice in the Kubernetes cluster. - Stops the
mailhogcontainer. - Re-applies the main Kubernetes manifests.
The deploy.sh script facilitates deployment to Kubernetes.
- It takes a Pull Request number as an argument, which is used to tag Docker images (e.g.,
pr-123). - It applies these manifests to your Kubernetes cluster using
kubectl apply -f -using images built from the PR.
Usage:
./deploy.sh <pr_number>The project includes the following services:
api-gateway: (Located ingateway/) Entry point for client requests.chat-service: (Located inchat-service/) Handles chat functionalities.group-chat-service: (Located ingroupChatService/) Manages group chat features.notification-service: (Located innotification-service/) Responsible for sending notifications.user-service: (Located inuserService/) Manages user accounts and authentication.e2e-tests: (Located ine2e-tests/) Contains end-to-end tests for the application.
Datastores & Message Brokers:
- MongoDB: NoSQL database.
- RabbitMQ: Message broker.
- PostgreSQL: SQL database.
- Redis: In-memory data store.
Kubernetes manifest files are located in the k8s/ directory, with subdirectories for each service and component.
Additional test-specific Kubernetes manifests can be found in e2e-tests/e2e-k8s/.