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

https://github.com/akramgalal/containerizing-multi-tier-java-application

This repository demonstrates the containerization of a multi-tier Java web application by creating Docker images for each microservice, i.e., load balancer (Nginx), application server, database (MariaDB), cashing engine (Memcached), and massage queue (RabbitMQ), then deploy them as containers.
https://github.com/akramgalal/containerizing-multi-tier-java-application

docker docker-compose docker-container mariadb memcached nginx rabbitmq tomcat

Last synced: 2 months ago
JSON representation

This repository demonstrates the containerization of a multi-tier Java web application by creating Docker images for each microservice, i.e., load balancer (Nginx), application server, database (MariaDB), cashing engine (Memcached), and massage queue (RabbitMQ), then deploy them as containers.

Awesome Lists containing this project

README

          

# Containerizing Multi-tier Java Web Application
This project demonstrates the containerization of a multi-tier Java web application by creating Docker images for each microservice, including:
- Load balancer (Nginx)
- Application server (Tomcat/Java)
- Database (MariaDB/MySQL)
- Caching engine (Memcached)
- Message queue (RabbitMQ)

The application is deployed as containers and orchestrated with Docker Compose.

## Project Setup
### 1. Create Docker Images for Microservices
### 1.1 Application Server (Tomcat)
- Use a Tomcat image matching your Java version (Java 11).
- Build the image from Dockerfile
```bash
docker build -t app:v1 .
```

### 1.2 Database (MySQL)
- Use MySQL image (version 8.0.33).
- Build the image from Dockerfile
```bash
docker build -t db:v1 .
```

### 1.3 Nginx Load Balancer
- Use the latest Nginx image.
- Create configuration file `nginx.conf`.
- Build the image from Dockerfile
```bash
docker build -t lb:v1 .
```

### 1.4 RabbitMQ
- Use the latest RabbitMQ image:
```bash
docker pull rabbitmq
```

### 1.5 Memcached
- Use the latest Memcached image:
```bash
docker pull memcached
```

## 2. Push Images to Docker Hub
1. Login to Docker Hub:
```bash
docker login -u
```
2. Tag images for Docker Hub:
```bash
docker tag
```
3. Push images:
```bash
docker push
```

## 3. Docker Compose Setup
- Create `docker-compose.yml`
- Start the multi-tier application using the docker compose file.
```bash
docker compose up -d
```

## 5. Testing
- Ensure all containers are running:
```bash
docker ps -a
```
Screenshot 2025-09-21 020407

- Access the application from the localhost IP at `http:192.168.242.130`

Screenshot 2025-09-21 020609