Skip to content

Commit

Permalink
rolling back alb changes to develop
Browse files Browse the repository at this point in the history
  • Loading branch information
alokamsurendra committed Aug 22, 2024
1 parent 683737e commit 26e6759
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 327 deletions.
169 changes: 6 additions & 163 deletions deployments/aws/templates/ai-unlimited/ai-unlimited-with-alb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ Metadata:
- AiUnlimitedSchedulerVersion
- AiUnlimitedSchedulerHttpPort
- AiUnlimitedSchedulerGrpcPort
- AiUnlimitedUiPort
- AiUnlimitedUiVersion
- Label:
default: Persistent volume
Parameters:
Expand Down Expand Up @@ -151,29 +149,16 @@ Parameters:
MinValue: 0
MaxValue: 65535

AiUnlimitedUiPort:
Description: port to access the AI Unlimited UI.
Type: Number
Default: 80
ConstraintDescription: must be a valid ununsed port between 0 and 65535.
MinValue: 0
MaxValue: 65535

AiUnlimitedVersion:
Description: Which version of AI Unlimited to deploy, uses container version tags, defaults to "latest"
Type: String
Default: latest
Default: v0.2.23

AiUnlimitedSchedulerVersion:
Description: Which version of AI Unlimited Scheduler to deploy, uses container version tags, defaults to "latest"
Type: String
Default: latest

AiUnlimitedUiVersion:
Description: Which version of AI Unlimited UI to deploy, uses container version tags, defaults to "latest"
Type: String
Default: latest

RootVolumeSize:
Description: size of the root disk to the AI Unlimited server.
Type: Number
Expand Down Expand Up @@ -395,8 +380,6 @@ Conditions:
- !Ref IamRoleName
- ""

PortIsNotEighty: !Not [!Equals [!Ref AiUnlimitedUiPort, 80]]

Resources:
AiUnlimitedVolume:
DeletionPolicy: !Ref PersistentVolumeDeletionPolicy
Expand Down Expand Up @@ -438,12 +421,9 @@ Resources:
- prepare_new_storage
- !Ref AWS::NoValue
- bind_storage
- create_init_api_key
- mount_storage
- install_docker
- configure_workspaces_ui_service
- configure_ai_unlimited_service
- start_workspaces_ui_service
- start_ai_unlimited_service
- configure_ai_unlimited_scheduler_service
- start_ai_unlimited_scheduler_service
Expand All @@ -459,12 +439,6 @@ Resources:
command: !Sub |
#!/bin/bash -xe
/usr/sbin/mkfs -t ext4 /dev/nvme1n1
create_init_api_key:
commands:
run_command:
command: !Sub |
#!/bin/bash -xe
echo "TD_VCD_INIT_API_KEY=$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 64)" > /tmp/init_api_key.txt
bind_storage:
commands:
fstab:
Expand Down Expand Up @@ -503,49 +477,6 @@ Resources:
docker:
enabled: "true"
ensureRunning: "true"
configure_workspaces_ui_service:
files:
/usr/lib/systemd/system/workspaces-ui.service:
content: !Sub |
[Unit]
Description=workspaces-ui
After=docker.service
Requires=docker.service
StartLimitInterval=200
StartLimitBurst=10
[Service]
TimeoutStartSec=0
Restart=always
RestartSec=2
ExecStartPre=-/bin/bash -c '/usr/bin/docker network create -d bridge ai_unlimited || true'
ExecStartPre=-/usr/bin/mkdir -p /etc/td/workspaces-ui
EnvironmentFile=/tmp/init_api_key.txt
ExecStartPre=-/usr/bin/docker stop %n || true
ExecStartPre=-/usr/bin/docker rm %n || true
ExecStartPre=/usr/bin/docker pull teradata/ai-unlimited-workspaces-ui:${ AiUnlimitedUiVersion }
ExecStart=/usr/bin/docker run \
-e accept_license=Y \
-e PLATFORM=aws \
-e TD_VCD_UI_PORT=${ AiUnlimitedUiPort } \
-e TD_VCD_API_PORT=3282 \
-e TD_VCD_AUTH_PORT=3000 \
-e TD_VCD_INIT_API_KEY \
-p ${ AiUnlimitedUiPort }:80 \
--network ai_unlimited \
--rm --name %n teradata/ai-unlimited-workspaces-ui:${ AiUnlimitedUiVersion }
[Install]
WantedBy=multi-user.target
group: root
mode: "000400"
owner: root
start_workspaces_ui_service:
services:
systemd:
workspaces-ui:
enabled: "true"
ensureRunning: "true"
configure_ai_unlimited_service:
files:
/usr/lib/systemd/system/ai-unlimited.service:
Expand All @@ -562,14 +493,13 @@ Resources:
Restart=always
RestartSec=2
ExecStartPre=-/usr/bin/mkdir -p /etc/td/ai-unlimited
EnvironmentFile=/tmp/init_api_key.txt
ExecStartPre=-/usr/bin/docker stop %n || true
ExecStartPre=-/usr/bin/docker exec %n stop || true
ExecStartPre=-/usr/bin/docker rm %n || true
ExecStartPre=-/bin/bash -c '/usr/bin/docker network create -d bridge ai_unlimited || true'
ExecStartPre=/usr/bin/docker pull teradata/ai-unlimited-workspaces:${ AiUnlimitedVersion }
ExecStart=/usr/bin/docker run \
-e accept_license=Y \
-e PLATFORM=aws \
-e TD_VCD_INIT_API_KEY \
-v /etc/td/ai-unlimited:/etc/td \
-p ${ AiUnlimitedHttpPort }:3000 \
-p ${ AiUnlimitedGrpcPort }:3282 \
Expand Down Expand Up @@ -601,7 +531,7 @@ Resources:
TimeoutStartSec=0
Restart=always
RestartSec=2
ExecStartPre=-/usr/bin/docker stop %n || true
ExecStartPre=-/usr/bin/docker exec %n stop || true
ExecStartPre=-/usr/bin/docker rm %n || true
ExecStartPre=/usr/bin/docker pull teradata/ai-unlimited-scheduler:latest
ExecStart=/usr/bin/docker run \
Expand Down Expand Up @@ -638,10 +568,6 @@ Resources:
GroupSet:
- !GetAtt AiUnlimitedSecurityGroup.GroupId
- !GetAtt AiUnlimitedSchedulerSecurityGroup.GroupId
- !If
- HASKEYANDCIDRORPREFIXLISTORSECGROUP
- !GetAtt SecurityGroupIngress.GroupId
- !Ref AWS::NoValue
AssociatePublicIpAddress: !If
- HASPUBLICIP
- true
Expand Down Expand Up @@ -718,21 +644,6 @@ Resources:
- HASSECURITYGROUP
- !Ref SecurityGroup
- !Ref AWS::NoValue
- FromPort: !Ref AiUnlimitedUiPort
IpProtocol: tcp
ToPort: !Ref AiUnlimitedUiPort
CidrIp: !If
- HASCIDR
- !Ref AccessCIDR
- !Ref AWS::NoValue
SourcePrefixListId: !If
- HASPREFIXLIST
- !Ref PrefixList
- !Ref AWS::NoValue
SourceSecurityGroupId: !If
- HASSECURITYGROUP
- !Ref SecurityGroup
- !Ref AWS::NoValue
Condition: HASCIDRORPREFIXLISTORSECGROUP

LoadBalancerSchedulerSecurityGroup:
Expand Down Expand Up @@ -793,18 +704,6 @@ Resources:
Certificates:
- CertificateArn: !Ref ACMCertificate

AiUnlimitedUIListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref AiUnlimitedUITargetGroup
LoadBalancerArn: !Ref LoadBalancer
Port: !Ref AiUnlimitedUiPort
Protocol: HTTPS
Certificates:
- CertificateArn: !Ref ACMCertificate

AiUnlimitedGRPCListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
Expand Down Expand Up @@ -919,44 +818,6 @@ Resources:
Port: !Ref AiUnlimitedGrpcPort
VpcId: !Ref Vpc

AiUnlimitedUITargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckIntervalSeconds: 30
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 15
Matcher:
HttpCode: "200"
Name: !Join
- '-'
- - !Select
- 4
- !Split
- '-'
- !Select
- 2
- !Split
- /
- !Ref AWS::StackId
- td-aiu
- ui
- api
Port: !Ref AiUnlimitedUiPort
Protocol: HTTP
TargetGroupAttributes:
- Key: stickiness.enabled
Value: true
- Key: stickiness.type
Value: app_cookie
- Key: stickiness.app_cookie.cookie_name
Value: TDWUNLIMITEDHTTPSSESSION
- Key: deregistration_delay.timeout_seconds
Value: "20"
Targets:
- Id: !Ref AiUnlimitedServer
Port: !Ref AiUnlimitedUiPort
VpcId: !Ref Vpc

AiUnlimitedSchedulerHTTPTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Expand Down Expand Up @@ -1049,10 +910,6 @@ Resources:
FromPort: !Ref AiUnlimitedGrpcPort
ToPort: !Ref AiUnlimitedGrpcPort
SourceSecurityGroupId: !GetAtt LoadBalancerAiUnlimitedSecurityGroup.GroupId
- IpProtocol: tcp
FromPort: !Ref AiUnlimitedUiPort
ToPort: !Ref AiUnlimitedUiPort
SourceSecurityGroupId: !GetAtt LoadBalancerAiUnlimitedSecurityGroup.GroupId
- !If
- HASSECURITYGROUP
- IpProtocol: tcp
Expand All @@ -1067,13 +924,6 @@ Resources:
ToPort: !Ref AiUnlimitedGrpcPort
SourceSecurityGroupId: !Ref SecurityGroup
- !Ref AWS::NoValue
- !If
- HASSECURITYGROUP
- IpProtocol: tcp
FromPort: !Ref AiUnlimitedUiPort
ToPort: !Ref AiUnlimitedUiPort
SourceSecurityGroupId: !Ref SecurityGroup
- !Ref AWS::NoValue

AiUnlimitedSchedulerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Expand Down Expand Up @@ -1360,10 +1210,7 @@ Outputs:

AiUnlimitedUiAccess:
Description: Loadbalancer access endpoint for AI Unlimited UI Access
Value: !If
- PortIsNotEighty
- !Sub "https://${ DnsName }:${ AiUnlimitedUiPort }/landing"
- !Sub "https://${ DnsName }"
Value: !Sub https://${ DnsName }:${ AiUnlimitedHttpPort }

AiUnlimitedApiAccess:
Description: Loadbalancer access endpoint for AI Unlimited API Access
Expand All @@ -1375,10 +1222,6 @@ Outputs:
- ', '
- - !GetAtt AiUnlimitedSecurityGroup.GroupId
- !GetAtt AiUnlimitedSchedulerSecurityGroup.GroupId
- !If
- HASKEYANDCIDRORPREFIXLISTORSECGROUP
- !GetAtt SecurityGroupIngress.GroupId
- !Ref AWS::NoValue

LoadBalancerSecurityGroups:
Description: AI Unlimited Load Balancer Security Group
Expand All @@ -1400,4 +1243,4 @@ Outputs:
PersistentVolumeId:
Description: Id of the new persistent volume created for AI Unlimited
Value: !Ref AiUnlimitedVolume
Condition: USENEWPERSISTENTVOLUME
Condition: USENEWPERSISTENTVOLUME
Loading

0 comments on commit 26e6759

Please sign in to comment.