Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
stationeros committed Oct 17, 2023
2 parents 27e7c33 + 14adeb1 commit 194b5a8
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 26 deletions.
57 changes: 32 additions & 25 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,60 @@

import subprocess

def execute_subprocess(command_list):
print(f'Executing command list: {command_list}')
try:
subprocess.run(command_list, shell=False, check=True)
except subprocess.CalledProcessError as e:
print(f'Error: {e}')
raise Exception(e)


def main():
package_command = 'sam package --template-file template.yaml --output-template-file deploy.yaml'
deploy_command = 'sam deploy --template-file deploy.yaml --capabilities CAPABILITY_NAMED_IAM '
package_command_list = ['sam', 'package', '--template-file', 'template.yaml', '--output-template-file', 'deploy.yaml']
deploy_command_list = ['sam', 'deploy', '--template-file', 'deploy.yaml', '--capabilities', 'CAPABILITY_NAMED_IAM']
s3_bucket = input('Enter the s3 bucket name created as part of pre-requisite: ')
if s3_bucket:
package_command = package_command + ' --s3-bucket ' + s3_bucket
package_command_list.append('--s3-bucket')
package_command_list.append(s3_bucket)
region = input('Enter the region [for instance, us-west-2]: ')
if region:
package_command = package_command + ' --region ' + region
deploy_command = deploy_command + ' --region ' + region
package_command_list.append('--region')
package_command_list.append(region)

deploy_command_list.append('--region')
deploy_command_list.append(region)
print()
print ('packaging trapheus for use ...')
try:
subprocess.run(package_command, shell=False, check=True)
except subprocess.CalledProcessError as e:
print(f'Error: {e}')
print ('packaging trapheus for use...')
execute_subprocess(package_command_list)


stack_name = input('Enter a stack name: ')
if stack_name:
deploy_command = deploy_command + ' --stack-name ' + stack_name
deploy_command = deploy_command + ' --parameter-overrides'
deploy_command_list.append('--stack-name')
deploy_command_list.append(stack_name)
deploy_command_list.append('--parameter-overrides')
sender_email = input('Enter sender email to send email FROM in case of failure: ')
if sender_email:
deploy_command = deploy_command + ' SenderEmail=' + sender_email
recipient_email = input('Enter recipeint email to send email TO in case of failure: ')
deploy_command_list.append('SenderEmail=' + sender_email)
recipient_email = input('Enter recipient email to send email TO in case of failure: ')
if recipient_email:
deploy_command = deploy_command + ' RecipientEmail=' + recipient_email
deploy_command_list.append('RecipientEmail=' + recipient_email)
slack_webhook_urls = input('Enter slack webhooks to publish failure notifications to: ')
if slack_webhook_urls:
deploy_command = deploy_command + ' --SlackWebhookUrls=' + slack_webhook_urls
deploy_command_list.append('--SlackWebhookUrls=' + slack_webhook_urls)
vpc = input('Are ypu using vpc[y/n]: ')
if vpc == 'y' or vpc == 'Y':
deploy_command = deploy_command + ' UseVPCAndSubnets=true'
deploy_command_list.append('UseVPCAndSubnets=true')
vpc_id = input('Enter vpc ID: ')
if vpc_id:
deploy_command = deploy_command + ' vpcId=' + vpc_id
subnets = input('Enter comman seperated list of PRIVATE subnets: ')
deploy_command_list.append('vpcId=' + vpc_id)
subnets = input('Enter comma seperated list of PRIVATE subnets: ')
if subnets:
deploy_command = deploy_command + ' Subnets=' +subnets
deploy_command_list.append('Subnets=' +subnets)
print()
print('Deploying trapheus to AWS ...')
try:
subprocess.run(deploy_command, shell=False, check=True)
except subprocess.CalledProcessError as e:
print(f'Error: {e}')
print('Deploying trapheus to AWS...')
execute_subprocess(deploy_command_list)


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions labs/TrapheusAI/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ streamlit-agraph
streamlit-extras
pandasai
tk
safetensors
44 changes: 43 additions & 1 deletion template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -211,6 +214,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -230,6 +236,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -249,6 +258,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -268,6 +280,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -287,6 +302,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -312,6 +330,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -335,6 +356,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -354,6 +378,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -373,6 +400,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -392,6 +422,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand All @@ -411,6 +444,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

VpcConfig:
!If [UseVPCAndSubnetsCondition, {
SecurityGroupIds: !Split [ "," , !GetAtt LambdaSecurityGroup.GroupId ] ,
Expand Down Expand Up @@ -470,6 +506,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

Environment:
Variables:
SNAPSHOT_EXPORT_TASK_ROLE: !GetAtt LambdaExecutionRole.Arn
Expand All @@ -491,6 +530,9 @@ Resources:
Layers:
- !Ref CommonLambdaLayer
Timeout: 900
Architectures:
- arm64 # Specify arm64 for Graviton architecture

Environment:
Variables:
SNAPSHOT_EXPORT_TASK_ROLE: !GetAtt LambdaExecutionRole.Arn
Expand Down Expand Up @@ -1224,4 +1266,4 @@ Resources:
"identifier": "identifier-Y",
"task": "create_snapshot",
"isCluster": true
}'
}'

0 comments on commit 194b5a8

Please sign in to comment.