| Name | NEU ID | Email Address |
|---|---|---|
| Ishita Sequeira | 001403357 | [email protected] |
| Tejas Shah | 001449694 | [email protected] |
| Sumit Anglekar | 001475969 | [email protected] |
- Clone the git repository:
[email protected]:<username>/ fa2019-team-002-ami.gitUsernames that can be used are SumitAnglekar94, shah-tejas, ishitasequeira
https://www.iannoble.co.uk/how-to-install-packer/https://www.digitalocean.com/community/tutorials/how-to-install-and-get-started-with-packer-on-an-ubuntu-12-04-vps
- packer --version
- packer validate -var-file= centos-ami.json
- packer build -var-file= centos-ami.json
Once you run packer commands your AMI is created, check the UI and verify with the AMI id in the terminal
- Run the
terraform initcommand in the root "terraform directory" terraform planto check if all the required variables have their respective valuesterraform applyto run the entire terraform script to generate the ec2 instance. (This might take a while ~10mins)- Check the UI for the EC2 instance and confirm that it's up and running (2/2).
-
Before starting with deployment, make sure you have cleaned and install the repository so that you have all the dependencies as well.
-
Copying the created .war file from recipe/target/recipe.war to the given initialized ec2 instance
scp <path-to-source-file> centos@<ec2_instance_ip>:<destination_path>example:scp /home/sumit/Documents/cloud/ccwebapp/webapp/recipe/target/recipe.war [email protected]:~ -
Login to the centos
ssh [email protected] -
Make the Tomcat directory writeable
cd /opt/tomcat/sudo chmod -R 777 . -
Copy the .war file and deploy it in webapps
cd webappscp ~/recipe.war . -
Restart the postgres
sudo systemctl restart postgresql -
Restart tomcat
sudo systemctl restart tomcat -
Check the tomcat log if the application has been deployed and started correctly
sudo tail -f -n 100 /opt/tomcat/logs/catalina.log
Example:
1. Register a User (<instance_ip>:8080/v1/user)
eg: 54.147.44.242:8080/recipe/v1/user
2. Get User records (<instance_ip>:8080/v1/user/self)
eg: 54.147.44.242:8080/recipe/v1/user/self
3. Update User recordds (<instance_ip>:8080/v1/user/self)
eg: 54.147.44.242:8080/recipe/v1/user/self
4. Register a Recipe (<instance_ip>:8080/v1/recipe/)
eg: 54.147.44.242:8080/recipe/v1/recipe/
5. Get recipe Information (<instance_ip>:8080/v1/recipe/{id})
eg: 54.147.44.242:8080/recipe/v1/recipe/aac56c9f-9818-42f5-bbb7-f8816b79be3b
6. Get the newest recipe (<instance_ip>:8080/v1/recipes)
eg: 54.147.44.242:8080/recipe/v1/recipes
7. Changes in the recipe (PUT) (<instance_ip>:8080/v1/recipe/{id})
eg: 54.147.44.242:8080/recipe/v1/recipes
8. Delete a particular recipe (<instance_ip>:8080/v1/recipe/{id})
eg: 54.147.44.242:8080/recipe/v1/recipe/aac56c9f-9818-42f5-bbb7-f8816b79be3b
9. Register an Image (<instance_ip>:8080/v1/recipe/{id}/image)
eg: 54.147.44.242:8080/recipe/v1/recipe/0c4307ea-90da-49a9-aa4f-5b9864f4d674/image
10. Get an image (<instance_ip>:8080/v1/recipe/{recipeId}/image/{imageId})
eg: 54.147.44.242:8080/recipe/v1/recipe/0c4307ea-90da-49a9-aa4f-5b9864f4d674/image/aac56c9f-9818-42f5-bbb7-f8816b79be3b
11. Delete an image (<instance_ip>:8080/v1/recipe/{recipeId}/image/{imageId})
eg: 54.147.44.242:8080/recipe/v1/recipe/0c4307ea-90da-49a9-aa4f-5b9864f4d674/image/aac56c9f-9818-42f5-bbb7-f8816b79be3b
- Create policy for circleci IAM user to give access to create new AMI:
terraform plan -target module.application.aws_iam_user_policy_attachment.circleci_ec2_policy_attach -out run.planterraform apply run.plan - Trigger the circleci plan to build new AMI:
curl -u <CIRCLECI_TOKEN>: -d build_parameters[CIRCLE_JOB]=build https://circleci.com/api/v1.1/project/github/<ORGANIZATION>/csye6225-fall2019-ami/tree/<BRANCH> - Once the build is completed a new AMI will be created and registered with AWS.