https://github.com/pratikshinde55/docker-three_tier-architecture
Three Tier Architecture using Docker. Create Blogging Site using WordPress, MySQL as DataBase for WordPress and Docker custom Network.
https://github.com/pratikshinde55/docker-three_tier-architecture
aws-ec2 docker docker-container docker-network docker-network-driver mysql-database wordpress
Last synced: about 2 months ago
JSON representation
Three Tier Architecture using Docker. Create Blogging Site using WordPress, MySQL as DataBase for WordPress and Docker custom Network.
- Host: GitHub
- URL: https://github.com/pratikshinde55/docker-three_tier-architecture
- Owner: Pratikshinde55
- Created: 2023-09-24T13:12:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-01T07:43:07.000Z (about 1 year ago)
- Last Synced: 2025-09-21T17:46:03.666Z (7 months ago)
- Topics: aws-ec2, docker, docker-container, docker-network, docker-network-driver, mysql-database, wordpress
- Homepage:
- Size: 63.5 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Three Tier Architecture using Docker
Create Blogging Site using Docker manual method.
- Set-up:
I use AWS EC2 Instance for this work. The EC2 Amazon machine is Amazon-linux.
- What is Three-tier Architecture:
1. For Blogging Site I use "WordPress".
2. For DataBase to the Wordpress I use "MySQL".
3. For Network I use own customised "Docker network".
## Step: 1 [Install Docker & Start Docker Services]
Launch EC2 instance and install docker inside and start docker Service:
Docker install command:
yum install docker -y
Start Docker Service command:
systemctl enable docker --now
Check Docker Status:
systemctl status docker

## Step: 2 [Create Custom Docker Network]
create own net name as "psnet"
Subnet range `10.0.0.1/16` in CIDR format.

Command for check docker network list:
docker network ls
Docker network create command:
docker network create --driver bridge --subnet 10.0.0.1/16 psnet
## Step: 3 [Launch MySQL Container using own Network]
Create database with own driver (database- container name)...also provide required enviromental variable

Launch MySQL container using custom networks & adding environmental variables & Attach Host folder(Mount volume) Default folder of MySQL storage is `/var/lib/mysql`:
docker run -dit --name database --network psnet -v /mydata:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=pratik55 -e MYSQL_DATABASE=mydatabase -e MYSQL_USER=jack -e MYSQL_PASSWORD=jack11 mysql
Inspect command for check:(here we see our Subnet range`(10.0.0.1/16)` to our given database container)
docker inspect database


Here, check provided Subnet range.
## Step: 4 [Launch Wordpress Container using own Newtwork]
Launch wordpress and uase PATTING to make outside world connection,As port number of container is `80`.
Command for check list port numbers on system:
netstat -tnlp

Lanuch Wordpress container using custom network:
docker run -dit --name mywordpress --network psnet -p 1234:80 wordpress
Wordpress store all iformation of login with database info place in `/var/www/html` there is file that `wp-config.php` (here we can also able to attach Host folder that mount volume)
docker run -dit --name mywordpress -v /wordstorage:/var/www/html --network psnet -p 1234:80 wordpress
Can also check MYWORDPRESS has our subnet range by command on above screenshots.(step no.3)
docker inspect mywordpress
## Step: 5 [Edit Inbound rule/ Firewall]
EC2 Intance has Firewall which cannot be connected by outside world, so we can modify Inbound rule(All traffic allowed)

Substeps:
1. EC2 Dashboard
2. Celect securtity option
3. Go inside Security groups
4. Select "edit inbound rule"
5. Delete defult rule and new rule
6. custom TCP ->> "ALL TRAFIC", ANYWHERE IPv4
7. Save rule
## Step: 6 [Access Wordpress from Browser]
Instance public + our port number that provide in wordpress contanier.
To access wordpresss from browser,need EC2 instance public IP Address+Port no. given to wordpresss container.

To get wordpress interface on google ,provide details that provided in the form of enviromental variable during "database" caintainer launch
http://65.2.146.158:1234 <<------- see interface(This site does not work as instance is terminated now)


## Step: 7 [Fill Info]
Create username and password to create blog on wordpress:


## Step: 8 [Create Blog page]
On Wordpress Dashboard->create Post->Add Content->Publish->Copy link and paste in the browser.



### This is Three Tier Architecture using Docker Overview:
1. WordPress-Blogging Site
2. MySQL-Database
3. PSNet-Own Bridge driver