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.
- Host: GitHub
- URL: https://github.com/akramgalal/containerizing-multi-tier-java-application
- Owner: AkramGalal
- License: mit
- Created: 2025-08-31T16:43:57.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-20T22:58:32.000Z (9 months ago)
- Last Synced: 2025-09-20T23:35:04.930Z (9 months ago)
- Topics: docker, docker-compose, docker-container, mariadb, memcached, nginx, rabbitmq, tomcat
- Language: Dockerfile
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```
- Access the application from the localhost IP at `http:192.168.242.130`
