This repository was cloned from my professor's repo to complete the first assignment for CLO835 In this Assignment we deployed containerized application. The web application takes in employee details and stores it in a database. Both the app and the database are being run as containers running on an EC2 instance.
Instructions
- Go to the terraformCode folder and run tf to create the EC2 instance, two ECR repositories and the security group.
- From the repository, run the ecr.yml file to create docker images which will get pushed to the ECR repositories
- Log in to EC2 instance, pull the docker images, run the sql container and then the webapp container.
- Use the public IP of the ec2 instance to access the web app.
sudo apt-get update -y sudo apt-get install mysql-client -y
pip3 install -r requirements.txt sudo python3 app.py
docker build -t my_db -f Dockerfile_mysql .
docker build -t my_app -f Dockerfile .
docker run -d -e MYSQL_ROOT_PASSWORD=pw my_db
docker inspect <container_id>
export DBHOST=127.0.0.1
export DBPORT=3307
export DBHOST=172.17.0.2
export DBPORT=3306
export DBUSER=root
export DATABASE=employees
export DBPWD=pw
export APP_COLOR=blue
docker run -p 8080:8080 -e DBHOST=$DBHOST -e DBPORT=$DBPORT -e DBUSER=$DBUSER -e DBPWD=$DBPWD my_app