To build php-apache Image
To split the application to microservices (php-apache | mysql | phpmyadmin)
To automate the build of the Dockerfile & the docker-compose.yml
To automate the infrastruction of building Jenkins EC2
To automate deploying the application
$ cd terraform
$ terraform init
$ terraform plan
$ terraforl apply -auto-approve
Make sure you are in the directory where the downloaded keypair located (in this example it is downloaded to the desktop)
$ ssh -i file.pem ec2-user@<Public IPv4 DNS>
Copy the lines in the sh script located in the terraform directory and save it
$ vim install.sh
$ chmod +x install.sh
$ ./install.sh
java -version
jenkins --version
docker --version
ansible --version
docker-compose --version
eksctl version
minikube version
k9s version
aws --version
Go to the browser the type the following then proceed with setting up jenkins
<ec2-Public IPv4 DNS>:8080
This job is to run the docker compose on the EC2, add the github repository url and github credentials then type the following in execute shell
ansible-playbook playbook-dcompose.yml
You will need to update the composer inside the running php-apache container first, get the container name by using ($ docker ps) and make sure you are in /var/www/html/
docker exec -it <PHP_APACHE_CONTAINER_NAME>
composer update
<ec2-Public IPv4 DNS>:5000
<ec2-Public IPv4 DNS>:4000