Three-tier Architecture of Blogging site(WordPress, MySQL, Docker network) using Docker Automation that docker-compose.
Global Blogging Made Easy with Docker and WordPress.
- Set-up:
I use AWS EC2 Instance(AMI- Amazon linux) as Operating System for Docker and then i Install docker-compose on it.
- What is Three-tier Architecture:
- For Blogging Site I use "WordPress".
- For DataBase to the Wordpress I use "MySQL".
- For Network I use own customised "Docker network".
Docker-comopse work on Docker Engine, So we need to install Docker & Start Docker Services
Install Docker Command:
yum install docker
Start Docker service Command:
systemctl start docker
docker-compose helps to make Automation in Docker Container, docker-compose is use for Automation, we creates Automation file by using yaml language, docker-compose file must be in YAML language.
"docker-compose.yml" is standard file name for docker-compose file.
- Following steps for installation:
For download docker-compose search on google "docker-compose standalone":
docker-compose Standalone Install Link- Docker-compose-download-link
curl downloads the Docker Compose binary for Linux into the /usr/local/bin/ directory:
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
Following command gives the downloaded docker-compose file executable permissions:
chmod +x /usr/local/bin/docker-compose
chmod: This is the command to change file permissions in Unix-like operating systems.
+x: This option adds execute permissions to the file. It allows the user to run the file as a program.
/usr/local/bin/docker-compose: This is the path to the docker-compose file.
To check Docker-compse install or not use command:
docker-compse version
Create two directories One for mysql data base volume & Second for docker-compose code:-
This is code written in yaml language: (docker-compose DSL is Yaml)
To view docker-compose file:
To Run Docker-compose file the command is:
docker-compose up -d
We use (-d) detached because it helps us to run or launch Container in background
- Three-tier Architecture created with the help of Docker-compose
Command will tell us which file is used to lauch container:
docker-compose ls
Command that give us info about running container from docker-compose file:
docker-compose ps
Command used to see logs of container:
docker-compose logs
To access this docker-compose setup -->>instance public IP+Port no.(Change EC2 instance inbound rule)
This interface shows on Google:-