You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+23-8
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,12 @@
1
1
# Ansible playbooks for launching and deploying a spring app
2
2
3
-
The playbooks are designed to dynamically work with almost any spring app, the infrastructure is also designed to be scalable, fault-tolerant and highly available.
3
+
The playbooks are designed to dynamically work with almost any spring app, the infrastructure is also built to be scalable, fault-tolerant and highly available.
4
+
5
+
The infrastructure is designed like the image below:
6
+
7
+

8
+
9
+

4
10
5
11
### Requirements:
6
12
@@ -26,14 +32,14 @@ region = us-west-1
26
32
[profile test-hello-app]
27
33
region = us-west-2
28
34
29
-
[profile prod-time-app]
35
+
[profile prod-time-app-east]
30
36
region = us-east-1
31
37
32
38
[profile prod-time-app-west]
33
39
region = us-west-1
34
40
35
41
```
36
-
Sample ~/.aws/config
42
+
Sample ~/.aws/credentials
37
43
```
38
44
[test-time-app]
39
45
aws_access_key_id =
@@ -44,11 +50,20 @@ aws_secret_access_key =
44
50
45
51
#### Deploy the infrastrcture and the spring app
46
52
- Configure the AMI for the user running the deployment, ec2,route53,sts,elasticloadbalancing,apigateway
47
-
- We need to specify a git url to clone and configure the number of app instaces for each ec2 instance.
48
-
the groups_vars/all file has all the default values
49
-
-run the full deploy: AWS_DEFAULT_PROFILE=prod-time-app ansible-playbook -i hosts full_deploy.yml, note the env variable, you can surely specify it in different ways
53
+
- We need to specify a git url for the app to clone, configure the number of app instaces for each ec2 instance in the groups_vars/all file, which has all the default values for our playbooks
54
+
- Run the full deploy: AWS_DEFAULT_PROFILE=prod-time-app-east ansible-playbook -i hosts full_deploy.yml, note the env variable, you can surely specify it in different ways
55
+
-During the play you will have two copy the public keys of the new instances to the git service, it will pause for two minutes, we can automate this for github or gitlab but for now its sufficient
50
56
- deploy to another region by changing the AWS_DEFAULT_PROFILE to the desired profile/region. AWS_DEFAULT_PROFILE=prod-time-app-west ansible-playbook -i hosts full_deploy.yml
51
-
- now as we have two regions running we can use route53 to load balance/health check on two elbs that have been created
52
-
- Please note, name of aws_profile cannot contain characters that are not letters, or digits or dash (-)
57
+
- now as we have two regions running we can use route53 to load balance/health check on two elbs that have been created, just run deploy_to_route53.yml with two env variables AWS_DEFAULT_PROFILE=prod-time-app-west and AWS_SECOND_PROFILE=prod-time-app-east
58
+
- Please note, the name of aws_profile cannot contain characters that are not letters, or digits or dash (-)
59
+
60
+
61
+
#### The full deploy
62
+
- The full deploy is the starting point to run the infrastructure and the app we specify
63
+
-1. Create the aws needed services and servers, add to our route53 zone with the desired dns name for the load balancer(s) that has been created
64
+
-2. Install python on the target machines (in a raw fashion)
65
+
-3. Install common packages as well as nginx, haproxy to load balance app instances inside the ec2 instance
66
+
-4. Deploy the App, clone it, package it, run it and test it
Copy file name to clipboardexpand all lines: full_deploy.yml
+2-1
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@
8
8
roles:
9
9
- { role: aws_ec2_key, tags: ['aws_set_key'], when: create_ec2_instances } # Populate or create they key to be assigned to our instances
10
10
- { role: aws_ec2_instances, tags: ['create_ec2_services'], when: create_ec2_instances } # At minimum, create two instances in two different 'available' Availablity-Zones
0 commit comments