Skip to content

Commit

Permalink
Merge pull request #21 from zebrunner/develop
Browse files Browse the repository at this point in the history
2.9
  • Loading branch information
vdelendik authored Apr 30, 2024
2 parents 91a1d23 + 17e988c commit a47b439
Show file tree
Hide file tree
Showing 28 changed files with 630 additions and 109 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Suitable for personal usage and in big clusters:
* Fully **isolated** and **reproducible** environment

## Documentation
* [Prerequisites](docs/prerequisites.md)
* [Installation](docs/installation.md)
* [Cleanup](docs/cleanup.md)
* [Capabilities](docs/capabilities.md)
* [Errors](docs/errors.md)
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: backend
services:
scaler:
container_name: scaler
image: public.ecr.aws/zebrunner/scaler:2.8.1
image: public.ecr.aws/zebrunner/scaler:2.9
env_file:
- scaler.env
- data.env
Expand All @@ -12,7 +12,7 @@ services:
restart: always
router_1:
container_name: router_1
image: public.ecr.aws/zebrunner/router:2.8.1
image: public.ecr.aws/zebrunner/router:2.9
environment:
- EXTERNAL_PORT=$ROUTER_PORT_1
env_file:
Expand All @@ -28,7 +28,7 @@ services:
restart: always
router_2:
container_name: router_2
image: public.ecr.aws/zebrunner/router:2.8.1
image: public.ecr.aws/zebrunner/router:2.9
environment:
- EXTERNAL_PORT=$ROUTER_PORT_2
env_file:
Expand Down
31 changes: 31 additions & 0 deletions docs/cleanup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Cleanup

> Replace {Env} var in the next paragraph.
1. Autoscaling
* aws autoscaling delete-auto-scaling-group --auto-scaling-group-name e3s-{Env}-asg
* aws autoscaling delete-auto-scaling-group --auto-scaling-group-name e3s-{Env}-win-asg

2. Launch templates
* aws ec2 delete-launch-template --launch-template-name e3s-{Env}-launch-template
* aws ec2 delete-launch-template --launch-template-name e3s-{Env}-win-launch-template

3. Cluster
* aws ecs delete-cluster --cluster e3s-{Env}

4. Capacity provider
* aws ecs delete-capacity-provider --capacity-provider e3s-{Env}-capacityprovider
* aws ecs delete-capacity-provider --capacity-provider e3s-{Env}-win-capacityprovider

4. Listener
* aws elbv2 describe-load-balancers --names e3s-{Env}-alb
* aws elbv2 describe-listeners --load-balancer-arn
* aws elbv2 delete-listener --listener-arn

5. Target group
* aws elbv2 describe-target-groups --names e3s-{Env}-tg
* aws elbv2 delete-target-group --target-group-arn

5. Load balancer
* aws elbv2 describe-load-balancers --names e3s-{Env}-alb
* aws elbv2 delete-load-balancer --load-balancer-arn
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"KeyName": "{key-name}",
"EbsOptimized": true,
"SecurityGroupIds": [
"{e3s-agent-security-group-id}"
"{e3s-agent-sg-id}"
],
"BlockDeviceMappings": [
{
Expand All @@ -22,7 +22,7 @@
},
"DisableApiTermination": false,
"InstanceInitiatedShutdownBehavior": "terminate",
"UserData": "{base64 encoded data for linux or windows}",
"UserData": "{base64 encoded data for linux}",
"IamInstanceProfile": {
"Arn": "arn:aws:iam::{Account}:instance-profile/e3s-{Env}-agent-role"
},
Expand Down
30 changes: 30 additions & 0 deletions docs/cli-input/cluster/e3s-listener.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"LoadBalancerArn": "",
"Protocol": "HTTPS",
"Port": 443,
"SslPolicy": "ELBSecurityPolicy-2016-08",
"Certificates": [
{
"CertificateArn": ""
}
],
"DefaultActions": [
{
"Type": "forward",
"TargetGroupArn": "",
"Order": 1,
"ForwardConfig": {
"TargetGroups": [
{
"TargetGroupArn": "",
"Weight": 1
}
],
"TargetGroupStickinessConfig": {
"Enabled": false,
"DurationSeconds": 3600
}
}
}
]
}
9 changes: 9 additions & 0 deletions docs/cli-input/cluster/e3s-load-balancer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Subnets": ["{Subnets}"],
"SecurityGroups": [
"{e3s-sg-id}"
],
"Scheme": "internet-facing",
"Type": "application",
"IpAddressType": "ipv4"
}
18 changes: 18 additions & 0 deletions docs/cli-input/cluster/e3s-target-group.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Protocol": "HTTP",
"ProtocolVersion": "HTTP1",
"Port": 4444,
"VpcId": "{VpcId}",
"HealthCheckProtocol": "HTTP",
"HealthCheckPort": "traffic-port",
"HealthCheckEnabled": true,
"HealthCheckPath": "/",
"HealthCheckIntervalSeconds": 30,
"HealthCheckTimeoutSeconds": 5,
"HealthyThresholdCount": 5,
"UnhealthyThresholdCount": 5,
"Matcher": {
"HttpCode": "200"
},
"TargetType": "instance"
}
37 changes: 37 additions & 0 deletions docs/cli-input/cluster/e3s-windows-asg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"MixedInstancesPolicy": {
"LaunchTemplate": {
"LaunchTemplateSpecification": {
"LaunchTemplateName": "e3s-{Env}-win-launch-template",
"Version": "$Latest"
},
"Overrides": [
{
"InstanceType": "c5a.2xlarge",
"WeightedCapacity": "1"
},
{
"InstanceType": "c5a.4xlarge",
"WeightedCapacity": "2"
}
]
},
"InstancesDistribution": {
"OnDemandAllocationStrategy": "prioritized",
"OnDemandPercentageAboveBaseCapacity": 100
}
},
"MinSize": 0,
"MaxSize": 30,
"DesiredCapacity": 0,
"DefaultCooldown": 10,
"AvailabilityZones": [ "{Zones}" ],
"HealthCheckType": "EC2",
"HealthCheckGracePeriod": 10,
"VPCZoneIdentifier": "{Subnets}",
"TerminationPolicies": [
"AllocationStrategy"
],
"NewInstancesProtectedFromScaleIn": true,
"ServiceLinkedRoleARN": "arn:aws:iam::{Account}:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling"
}
13 changes: 13 additions & 0 deletions docs/cli-input/cluster/e3s-windows-capacityprovider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"autoScalingGroupProvider": {
"autoScalingGroupArn": "arn:aws:autoscaling:{Region}:{Account}:autoScalingGroup:{Uuid}:autoScalingGroupName/e3s-{Env}-win-asg",
"managedScaling": {
"status": "ENABLED",
"targetCapacity": 100,
"minimumScalingStepSize": 1,
"maximumScalingStepSize": 100,
"instanceWarmupPeriod": 300
},
"managedTerminationProtection": "DISABLED"
}
}
41 changes: 41 additions & 0 deletions docs/cli-input/cluster/e3s-windows-launch-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"LaunchTemplateData": {
"ImageId": "{zebrunner-agent-ami-windows}",
"KeyName": "{key-name}",
"EbsOptimized": true,
"SecurityGroupIds": [
"{e3s-agent-sg-id}"
],
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": {
"VolumeSize": 100,
"VolumeType": "gp3",
"DeleteOnTermination": true,
"Encrypted": false
}
}
],
"Monitoring": {
"Enabled": true
},
"DisableApiTermination": false,
"InstanceInitiatedShutdownBehavior": "terminate",
"UserData": "{base64 encoded data for windows}",
"IamInstanceProfile": {
"Arn": "arn:aws:iam::{Account}:instance-profile/e3s-{Env}-agent-role"
},
"HibernationOptions": {
"Configured": false
},
"MetadataOptions": {
"HttpTokens": "required",
"HttpPutResponseHopLimit": 1,
"HttpEndpoint": "enabled"
},
"EnclaveOptions": {
"Enabled": false
}
}
}
104 changes: 104 additions & 0 deletions docs/cli-input/roles/e3s-deploy-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "withoutConstraints",
"Effect": "Allow",
"Action": [
"ecs:CreateCapacityProvider"
],
"Resource": "*"
},
{
"Sid": "ec2",
"Effect": "Allow",
"Action": [
"ec2:CreateLaunchTemplate",
"ec2:CreateLaunchTemplateVersion",
"ec2:DeleteLaunchTemplate",
"ec2:DeleteLaunchTemplateVersion",
"ec2:RunInstances"
],
"Resource": [
"*"
],
"Condition": {
"StringLike": {
"ec2:Region": "us-east-?"
}
}
},
{
"Sid": "iamForAutoscaling",
"Effect": "Allow",
"Action": [
"iam:PassRole"
],
"Resource": [
"arn:aws:iam::{Account}:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling"
]
},
{
"Sid": "iamForLaunchTemplates",
"Effect": "Allow",
"Action": [
"iam:PassRole"
],
"Condition": {
"StringEquals": {
"iam:PassedToService": "ec2.amazonaws.com"
}
},
"Resource": [
"arn:aws:iam::{Account}:role/e3s-{Env}-agent-role"
]
},
{
"Sid": "autoscaling",
"Effect": "Allow",
"Action": [
"autoscaling:CreateAutoScalingGroup",
"autoscaling:DeleteAutoScalingGroup",
"autoscaling:PutScalingPolicy",
"autoscaling:PutScheduledUpdateGroupAction",
"autoscaling:CreateOrUpdateTags"
],
"Resource": "arn:aws:autoscaling:*:{Account}:autoScalingGroup:*:autoScalingGroupName/e3s-*"
},
{
"Sid": "ecs",
"Effect": "Allow",
"Action": [
"ecs:CreateCluster",
"ecs:DeleteCluster",
"ecs:PutClusterCapacityProviders",
"ecs:DeleteCapacityProvider"
],
"Resource": [
"arn:aws:ecs:*:{Account}:cluster/e3s-*",
"arn:aws:ecs:*:{Account}:capacity-provider/e3s-*"
]
},
{
"Sid": "elbv2",
"Effect": "Allow",
"Action": [
"elasticloadbalancing:CreateLoadBalancer",
"elasticloadbalancing:DeleteLoadBalancer",
"elasticloadbalancing:CreateListener",
"elasticloadbalancing:DeleteListener",
"elasticloadbalancing:CreateTargetGroup",
"elasticloadbalancing:DeleteTargetGroup",
"elasticloadbalancing:RegisterTargets",
"elasticloadbalancing:DeregisterTargets",
"elasticloadbalancing:ModifyTargetGroupAttributes",
"elasticloadbalancing:ModifyListener"
],
"Resource": [
"arn:aws:elasticloadbalancing:*:{Account}:loadbalancer/app/e3s-*",
"arn:aws:elasticloadbalancing:*:{Account}:targetgroup/e3s-*",
"arn:aws:elasticloadbalancing:*:{Account}:listener/app/e3s-*"
]
}
]
}
29 changes: 29 additions & 0 deletions docs/cli-input/roles/e3s-manage-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "autoscaling",
"Effect": "Allow",
"Action": [
"autoscaling:UpdateAutoScalingGroup",
"autoscaling:SetInstanceProtection"
],
"Resource": "arn:aws:autoscaling:*:{Account}:autoScalingGroup:*:autoScalingGroupName/e3s-*"
},
{
"Sid": "ec2",
"Effect": "Allow",
"Action": [
"ec2:TerminateInstances"
],
"Resource": [
"*"
],
"Condition": {
"StringLike": {
"ec2:Region": "us-east-?"
}
}
}
]
}
Loading

0 comments on commit a47b439

Please sign in to comment.