cloudmason 0.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.github/workflows/CODEOWNERS +1 -0
  2. package/.github/workflows/main.yml +27 -27
  3. package/README.md +373 -25
  4. package/build.js +20 -20
  5. package/commands/delete.js +67 -28
  6. package/commands/helpers/cf.js +181 -117
  7. package/commands/helpers/common.js +82 -0
  8. package/commands/helpers/ec2.js +154 -40
  9. package/commands/helpers/params.js +231 -178
  10. package/commands/helpers/s3.js +186 -67
  11. package/commands/helpers/stacks/asg.yaml +420 -224
  12. package/commands/helpers/stacks/infra.yaml +102 -106
  13. package/commands/helpers/stacks.js +25 -25
  14. package/commands/index.html +22 -0
  15. package/commands/init_org.js +54 -61
  16. package/commands/inspect.js +40 -0
  17. package/commands/launch_app.js +80 -57
  18. package/commands/list_apps.js +21 -21
  19. package/commands/new_app.js +44 -50
  20. package/commands/new_instance.js +133 -186
  21. package/commands/reset_stack.js +27 -27
  22. package/commands/starter.js +21 -0
  23. package/commands/starters/asg_node/index.js +62 -0
  24. package/commands/starters/asg_node/mason.txt +1 -0
  25. package/commands/starters/asg_node/modules/appConfig.js +131 -0
  26. package/commands/starters/asg_node/package-lock.json +5877 -0
  27. package/commands/starters/asg_node/package.json +23 -0
  28. package/commands/starters/asg_node/public/css/favicon-16x16.png +0 -0
  29. package/commands/starters/asg_node/public/css/fonts/Lato-Bold.ttf +0 -0
  30. package/commands/starters/asg_node/public/css/fonts/Lato-Regular.ttf +0 -0
  31. package/commands/starters/asg_node/public/css/fonts/Montserrat-Var.ttf +0 -0
  32. package/commands/starters/asg_node/public/css/fonts/OpenSans.ttf +0 -0
  33. package/commands/starters/asg_node/public/css/fonts/bpmn.woff2 +0 -0
  34. package/commands/starters/asg_node/public/css/fonts/fonts.css +17 -0
  35. package/commands/starters/asg_node/public/css/index.css +9 -0
  36. package/commands/starters/asg_node/public/index.html +15 -0
  37. package/commands/starters/asg_node/public/js/index.js +5 -0
  38. package/commands/starters/asg_node/start.sh +4 -0
  39. package/commands/update_app.js +235 -272
  40. package/commands/update_stack.js +27 -0
  41. package/commands/utils.js +32 -32
  42. package/main.js +262 -220
  43. package/package.json +1 -28
  44. package/test.bat +16 -9
  45. package/commands/delete_app.js +0 -28
  46. package/commands/helpers/stacks/asg_draft.json +0 -321
@@ -1,321 +0,0 @@
1
- {
2
- "AWSTemplateFormatVersion": "2010-09-09",
3
- "Description": "ASG Cloudformation Template",
4
- "Parameters": {
5
- "AppName": {
6
- "Type": "String",
7
- "Description": "Application Name"
8
- },
9
- "InstanceName": {
10
- "Type": "String",
11
- "Description": "Application Name"
12
- },
13
- "InstanceRootDomain": {
14
- "Type": "AWS::Route53::HostedZone::Id",
15
- "Description": "Hosted Zone"
16
- },
17
- "InstanceDomain": {
18
- "Type": "String",
19
- "Description": "Full domain/subdomain name to associate with the ALB"
20
- },
21
- "ACMDomainCert": {
22
- "Type": "String",
23
- "Description": "ARN of AWS ACM Certificate"
24
- },
25
- "VpcId": {
26
- "Type": "AWS::EC2::VPC::Id",
27
- "Description": "Org VPC"
28
- },
29
- "InstanceSubnets": {
30
- "Type": "List<AWS::EC2::Subnet::Id>",
31
- "Description": "Subnets to deploy in"
32
- },
33
- "MinEc2Instances": {
34
- "Type": "Number",
35
- "Description": "Minimum number of Ec2 instances"
36
- },
37
- "MaxEc2Instances": {
38
- "Type": "Number",
39
- "Description": "Max number of Ec2 instances"
40
- }
41
- },
42
- "Resources": {
43
- "AppALB": {
44
- "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
45
- "Properties": {
46
- "Name": "${AppName}-${InstanceName}",
47
- "Scheme": "internet-facing",
48
- "Type": "application",
49
- "IpAddressType": "ipv4",
50
- "SecurityGroups": "AppALBSecurityGroup",
51
- "Subnets": "InstanceSubnets"
52
- }
53
- },
54
- "AppALBHTTPSListener": {
55
- "Type": "AWS::ElasticLoadBalancingV2::Listener",
56
- "Properties": {
57
- "Certificates": [
58
- {
59
- "CertificateArn": "ACMDomainCert"
60
- }
61
- ],
62
- "DefaultActions": [
63
- {
64
- "Type": "forward",
65
- "ForwardConfig": {
66
- "TargetGroups": [
67
- {
68
- "TargetGroupArn": "AppALBTargetGroup",
69
- "Weight": 999
70
- }
71
- ],
72
- "TargetGroupStickinessConfig": {
73
- "DurationSeconds": 900,
74
- "Enabled": false
75
- }
76
- }
77
- }
78
- ],
79
- "LoadBalancerArn": "AppALB",
80
- "Port": 443,
81
- "Protocol": "HTTPS"
82
- }
83
- },
84
- "AppALBHTTPRedirectListener": {
85
- "Type": "AWS::ElasticLoadBalancingV2::Listener",
86
- "Properties": {
87
- "DefaultActions": [
88
- {
89
- "RedirectConfig": {
90
- "Port": "443",
91
- "Protocol": "HTTPS",
92
- "StatusCode": "HTTP_301"
93
- },
94
- "Type": "redirect"
95
- }
96
- ],
97
- "LoadBalancerArn": "AppALB",
98
- "Port": 80,
99
- "Protocol": "HTTP"
100
- }
101
- },
102
- "AppALBSecurityGroup": {
103
- "Type": "AWS::EC2::SecurityGroup",
104
- "Properties": {
105
- "VpcId": "VpcId",
106
- "GroupName": "AppALBSecurityGroup",
107
- "GroupDescription": "Allow http to client host",
108
- "SecurityGroupIngress": [
109
- {
110
- "IpProtocol": "tcp",
111
- "FromPort": 80,
112
- "ToPort": 80,
113
- "CidrIp": "0.0.0.0/0"
114
- },
115
- {
116
- "IpProtocol": "tcp",
117
- "FromPort": 443,
118
- "ToPort": 443,
119
- "CidrIp": "0.0.0.0/0"
120
- }
121
- ]
122
- }
123
- },
124
- "AppALBSecurityGroupEgress": {
125
- "Type": "AWS::EC2::SecurityGroupEgress",
126
- "Properties": {
127
- "GroupId": "AppALBSecurityGroup",
128
- "Description": "Allow ALB to communicate with Ec2",
129
- "IpProtocol": "tcp",
130
- "FromPort": 8080,
131
- "ToPort": 8080,
132
- "DestinationSecurityGroupId": "AppEc2SecurityGroup"
133
- }
134
- },
135
- "AppALBRouteRecord": {
136
- "Type": "AWS::Route53::RecordSet",
137
- "Properties": {
138
- "Type": "A",
139
- "Name": "InstanceDomain",
140
- "AliasTarget": {
141
- "DNSName": "AppALB.DNSName",
142
- "EvaluateTargetHealth": true,
143
- "HostedZoneId": "AppALB.CanonicalHostedZoneID"
144
- },
145
- "HostedZoneName": "${InstanceRootDomain}.",
146
- "Region": "AWS::Region",
147
- "SetIdentifier": "AWS::Region"
148
- }
149
- },
150
- "AppASG": {
151
- "Type": "AWS::AutoScaling::AutoScalingGroup",
152
- "Properties": {
153
- "AutoScalingGroupName": "AppASG",
154
- "AvailabilityZones": {
155
- "Fn::GetAZs": ""
156
- },
157
- "DesiredCapacity": "MinEc2Instances",
158
- "MinSize": "MinEc2Instances",
159
- "MaxSize": "MaxEc2Instances",
160
- "TargetGroupARNs": "AppALBTargetGroup",
161
- "LaunchTemplate": {
162
- "LaunchTemplateId": "AppEc2LaunchTemplate",
163
- "Version": "AppEc2LaunchTemplate.LatestVersionNumber"
164
- }
165
- },
166
- "UpdatePolicy": {
167
- "AutoScalingRollingUpdate": {
168
- "MinInstancesInService": "1",
169
- "MaxBatchSize": "1",
170
- "PauseTime": "PT15M",
171
- "WaitOnResourceSignals": "true"
172
- }
173
- }
174
- },
175
- "AppALBTargetGroup": {
176
- "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
177
- "Properties": {
178
- "Name": "${AppName}-TargetGroup",
179
- "HealthCheckIntervalSeconds": 30,
180
- "HealthCheckPath": "/",
181
- "HealthCheckTimeoutSeconds": 5,
182
- "HealthyThresholdCount": 3,
183
- "Matcher": {
184
- "HttpCode": "200,300,302"
185
- },
186
- "Port": 8080,
187
- "Protocol": "HTTP",
188
- "TargetType": "instance",
189
- "UnhealthyThresholdCount": 2,
190
- "VpcId": "VpcId"
191
- }
192
- },
193
- "AppEc2LaunchTemplate": {
194
- "Type": "AWS::EC2::LaunchTemplate",
195
- "Properties": {
196
- "LaunchTemplateName": "AppEc2LaunchTemplate",
197
- "LaunchTemplateData": {
198
- "IamInstanceProfile": {
199
- "Name": {
200
- "Ref": "AppEc2Profile"
201
- }
202
- },
203
- "UserData": "Y2QgL2hvbWUvZWMyLXVzZXIKbnBtIHJ1biBzdGFydCAu",
204
- "ImageId": "ami-0f46d2cab016f434b",
205
- "DisableApiTermination": "true",
206
- "InstanceType": "t2.small",
207
- "SecurityGroupIds": "AppEc2SecurityGroup"
208
- }
209
- }
210
- },
211
- "AppEc2SecurityGroup": {
212
- "Type": "AWS::EC2::SecurityGroup",
213
- "Properties": {
214
- "VpcId": "VpcId",
215
- "GroupName": "AppEc2SecurityGroup",
216
- "GroupDescription": "Allow http to client host",
217
- "SecurityGroupEgress": [
218
- {
219
- "IpProtocol": "-1",
220
- "CidrIp": "0.0.0.0/0"
221
- }
222
- ]
223
- }
224
- },
225
- "AppEc2SecurityGroupIngress": {
226
- "Type": "AWS::EC2::SecurityGroupIngress",
227
- "Properties": {
228
- "GroupId": "AppEc2SecurityGroup",
229
- "Description": "Allow 8080 from ALB",
230
- "IpProtocol": "-1",
231
- "SourceSecurityGroupId": "AppALBSecurityGroup"
232
- }
233
- },
234
- "AppBucket": {
235
- "Type": "AWS::S3::Bucket",
236
- "Properties": {
237
- "BucketName": "InstanceDomain",
238
- "VersioningConfiguration": {
239
- "Status": "Enabled"
240
- }
241
- }
242
- },
243
- "AppBucketPolicy": {
244
- "Type": "AWS::S3::BucketPolicy",
245
- "Properties": {
246
- "Bucket": "AppBucket",
247
- "PolicyDocument": {
248
- "Version": "2012-10-17",
249
- "Statement": [
250
- {
251
- "Effect": "Allow",
252
- "Principal": {
253
- "AWS": [
254
- "AppEc2Role.Arn"
255
- ]
256
- },
257
- "Action": [
258
- "s3:GetObject"
259
- ],
260
- "Resource": [
261
- "arn:aws:s3:::${AppBucket}",
262
- "arn:aws:s3:::${AppBucket}/*"
263
- ]
264
- }
265
- ]
266
- }
267
- }
268
- },
269
- "AppEc2Role": {
270
- "Type": "AWS::IAM::Role",
271
- "Properties": {
272
- "AssumeRolePolicyDocument": {
273
- "Version": "2012-10-17",
274
- "Statement": [
275
- {
276
- "Effect": "Allow",
277
- "Principal": {
278
- "Service": [
279
- "ec2.amazonaws.com"
280
- ]
281
- },
282
- "Action": [
283
- "sts:AssumeRole"
284
- ]
285
- }
286
- ]
287
- },
288
- "Path": "/${AppName}",
289
- "Policies": [
290
- {
291
- "PolicyName": "root",
292
- "PolicyDocument": {
293
- "Version": "2012-10-17",
294
- "Statement": [
295
- {
296
- "Effect": "Allow",
297
- "Action": [
298
- "s3:GetObject",
299
- "s3:ListBucket"
300
- ],
301
- "Resource": [
302
- "arn:aws:s3:::${AppBucket}",
303
- "arn:aws:s3:::${AppBucket}/*"
304
- ]
305
- }
306
- ]
307
- }
308
- }
309
- ]
310
- }
311
- },
312
- "AppEc2Profile": {
313
- "Type": "AWS::IAM::InstanceProfile",
314
- "Properties": {
315
- "InstanceProfileName": "AppEc2Profile",
316
- "Path": "/${AppName}",
317
- "Roles": "AppEc2Role"
318
- }
319
- }
320
- }
321
- }