Clone the repo from the github locally on your machine:
git clone git@github.com:LaFosseAcademy/debug-assignment-cdo-MaryPetrichenko.git - Navigate to the AWS Console, sign in and choose the region United States (N.Virginia)
- Create EC2 instance using default free tier values:
- Application and OS Images: Amazon Linux
- Use your default key pair login or create a new one if needed
- Instance type: t2.micro
- Allow SSH traffic from, HTTPS traffic from the internet, HTTP traffic from the internet
- Go to the directory debug-assignment-cdo-MaryPetrichenko/terraform
cd debug-assignment-cdo-MaryPetrichenko/terraform- Pass in your credentials running commands:
export AWS_ACCESS_KEY_ID=<YOUR_ACCESS_KEY>
export AWS_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_KEY>To make sure it works run:
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY- Copy the ami id from the aws EC2 instance newly created. Change the following in the main.tf file:
ami = "<ami-id-from-aws-instance>"- To create and start the server run the following commands:
terraform init
terraform validate
terraform apply-
Cope the Public IPv4 address from the EC2 instance newly created.
-
Open the ansible/ansible_hosts file and update the IP address of the host:
[production]
prod ansible_host=<YOUR_IP_ADDRESS>- Navigate to the ansible folder and run the following commands:
ansible-playbook playbooks/docker-install.yml
ansible-playbook playbooks/docker-run.yml -
Access the app using IPv4 DNS of the EC2 instance and port 3000.
-
The link to acces deployed app can be as following:
- http://<Your_IPv4_DNS>:3000/tour-de-france/cyclists - to access all cyclists
- http://<Your_IPv4_DNS>:3000/tour-de-france/cyclists/type/:type - to access cyclists of particular type
- http://<Your_IPv4_DNS>:3000/tour-de-france/cyclists/:id - to access cyclist by his/her id
- http://<Your_IPv4_DNS>:3000/tour-de-france/teams - to access information on teams
- http://<Your_IPv4_DNS>:3000/tour-de-france/teams/:id - to access information on team by its id
The application is using two docker images:
- marypetrichenko/tour-de-france-mvc:0.0.1.RELEASE
- marypetrichenko/tour-de-france-db:0.0.1.RELEASE
The images were prebuild and are accessible from the docker hub. Docker-compose.yml file points the docker images from the hub. The images are downloaded automatically on the first run.
Currently deployed application can be accessed via the following link: http://ec2-100-25-37-10.compute-1.amazonaws.com:3000/tour-de-france/ Other endpoints are given in the previous sections.