From 9b7f9585d8dc396df24b1637a130b7e85c04e30f Mon Sep 17 00:00:00 2001 From: namitad Date: Mon, 9 Oct 2023 21:49:00 +0530 Subject: [PATCH 1/8] fix: Update install.py to remove sam package run failure --- install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.py b/install.py index c8ce738..721301d 100644 --- a/install.py +++ b/install.py @@ -16,7 +16,7 @@ def main(): print() print ('packaging trapheus for use ...') try: - subprocess.run(package_command, shell=False, check=True) + subprocess.run(package_command, shell=True, check=True) except subprocess.CalledProcessError as e: print(f'Error: {e}') @@ -46,7 +46,7 @@ def main(): print() print('Deploying trapheus to AWS ...') try: - subprocess.run(deploy_command, shell=False, check=True) + subprocess.run(deploy_command, shell=True, check=True) except subprocess.CalledProcessError as e: print(f'Error: {e}') From b2b8a1fec80fe590561ba37d49c2d283dcad8716 Mon Sep 17 00:00:00 2001 From: sakthishanmugam <91444852+sakthishanmugam@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:20:40 +0700 Subject: [PATCH 2/8] Update template.yaml Graviton added for all lambda function --- template.yaml | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/template.yaml b/template.yaml index e4454b0..9a455ce 100644 --- a/template.yaml +++ b/template.yaml @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 ] , @@ -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 @@ -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 @@ -1224,4 +1266,4 @@ Resources: "identifier": "identifier-Y", "task": "create_snapshot", "isCluster": true - }' \ No newline at end of file + }' From fd515d4c02be5d56eb33065f2ab05a67c6a977f4 Mon Sep 17 00:00:00 2001 From: namitad Date: Tue, 10 Oct 2023 22:12:37 +0530 Subject: [PATCH 3/8] fixing possible security issues in install.py --- install.py | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/install.py b/install.py index 721301d..f196bc0 100644 --- a/install.py +++ b/install.py @@ -4,49 +4,70 @@ 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 = '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 = 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 = package_command + ' --region ' + region + package_command_list.append('--region') + package_command_list.append(region) + + deploy_command_list.append('--region') + deploy_command_list.append(region) + # deploy_command = deploy_command + ' --region ' + region print() print ('packaging trapheus for use ...') + print(package_command_list) try: - subprocess.run(package_command, shell=True, check=True) + subprocess.run(package_command_list, shell=False, check=True) except subprocess.CalledProcessError as e: print(f'Error: {e}') 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 = deploy_command + ' --stack-name ' + stack_name + deploy_command_list.append('--stack-name') + deploy_command_list.append(stack_name) + deploy_command_list.append('--parameter-overrides') + # deploy_command = deploy_command + ' --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 + # deploy_command = deploy_command + ' SenderEmail=' + sender_email + deploy_command_list.append('SenderEmail=' + sender_email) recipient_email = input('Enter recipeint email to send email TO in case of failure: ') if recipient_email: - deploy_command = deploy_command + ' RecipientEmail=' + 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 = 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 = 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 + # deploy_command = deploy_command + ' vpcId=' + vpc_id + deploy_command_list.append('vpcId=' + vpc_id) subnets = input('Enter comman seperated list of PRIVATE subnets: ') if subnets: - deploy_command = deploy_command + ' Subnets=' +subnets + # deploy_command = deploy_command + ' Subnets=' +subnets + deploy_command_list.append('Subnets=' +subnets) print() print('Deploying trapheus to AWS ...') + print(deploy_command_list) try: - subprocess.run(deploy_command, shell=True, check=True) + subprocess.run(deploy_command_list, shell=False, check=True) except subprocess.CalledProcessError as e: print(f'Error: {e}') From 87278809f2eda7762cabc813996854574b07cbe2 Mon Sep 17 00:00:00 2001 From: namitad Date: Tue, 10 Oct 2023 22:15:51 +0530 Subject: [PATCH 4/8] removing commented code --- install.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/install.py b/install.py index f196bc0..483f540 100644 --- a/install.py +++ b/install.py @@ -4,25 +4,20 @@ 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 package_command_list.append('--region') package_command_list.append(region) deploy_command_list.append('--region') deploy_command_list.append(region) - # deploy_command = deploy_command + ' --region ' + region print() print ('packaging trapheus for use ...') print(package_command_list) @@ -34,34 +29,26 @@ def main(): stack_name = input('Enter a stack name: ') if stack_name: - # deploy_command = deploy_command + ' --stack-name ' + stack_name deploy_command_list.append('--stack-name') deploy_command_list.append(stack_name) deploy_command_list.append('--parameter-overrides') - # deploy_command = deploy_command + ' --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 deploy_command_list.append('SenderEmail=' + sender_email) recipient_email = input('Enter recipeint 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 deploy_command_list.append('vpcId=' + vpc_id) subnets = input('Enter comman 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 ...') From a791b83cca74441de68cee3ab25b27e9e82de918 Mon Sep 17 00:00:00 2001 From: namitad Date: Tue, 10 Oct 2023 22:17:07 +0530 Subject: [PATCH 5/8] removing print statements and adding indentation fixes --- install.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/install.py b/install.py index 483f540..8f9ad59 100644 --- a/install.py +++ b/install.py @@ -4,10 +4,9 @@ def main(): - 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'] + 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_list.append('--s3-bucket') package_command_list.append(s3_bucket) @@ -20,7 +19,6 @@ def main(): deploy_command_list.append(region) print() print ('packaging trapheus for use ...') - print(package_command_list) try: subprocess.run(package_command_list, shell=False, check=True) except subprocess.CalledProcessError as e: @@ -52,7 +50,6 @@ def main(): deploy_command_list.append('Subnets=' +subnets) print() print('Deploying trapheus to AWS ...') - print(deploy_command_list) try: subprocess.run(deploy_command_list, shell=False, check=True) except subprocess.CalledProcessError as e: From 8484a01068ede19028aab668e576e3875bd42fa9 Mon Sep 17 00:00:00 2001 From: namitad Date: Wed, 11 Oct 2023 11:08:31 +0530 Subject: [PATCH 6/8] addressing review comments --- install.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/install.py b/install.py index 8f9ad59..c9a948c 100644 --- a/install.py +++ b/install.py @@ -2,6 +2,13 @@ import subprocess +def execute_subprocess(command_list): + print('Executing command list: ', command_list) + try: + subprocess.run(command_list, shell=False, check=True) + except subprocess.CalledProcessError as e: + print(f'Error: {e}') + def main(): package_command_list = ['sam', 'package', '--template-file', 'template.yaml', '--output-template-file', 'deploy.yaml'] @@ -18,11 +25,8 @@ def main(): deploy_command_list.append('--region') deploy_command_list.append(region) print() - print ('packaging trapheus for use ...') - try: - subprocess.run(package_command_list, 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: ') @@ -49,11 +53,8 @@ def main(): if subnets: deploy_command_list.append('Subnets=' +subnets) print() - print('Deploying trapheus to AWS ...') - try: - subprocess.run(deploy_command_list, 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__": From bed425f7063acb02abd10e13e9601a13a67eaf70 Mon Sep 17 00:00:00 2001 From: namitad Date: Wed, 11 Oct 2023 11:44:53 +0530 Subject: [PATCH 7/8] fixing typos --- install.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install.py b/install.py index c9a948c..7f161c3 100644 --- a/install.py +++ b/install.py @@ -3,11 +3,12 @@ import subprocess def execute_subprocess(command_list): - print('Executing command list: ', 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(): @@ -37,7 +38,7 @@ def main(): sender_email = input('Enter sender email to send email FROM in case of failure: ') if sender_email: deploy_command_list.append('SenderEmail=' + sender_email) - recipient_email = input('Enter recipeint email to send email TO in case of failure: ') + recipient_email = input('Enter recipient email to send email TO in case of failure: ') if recipient_email: deploy_command_list.append('RecipientEmail=' + recipient_email) slack_webhook_urls = input('Enter slack webhooks to publish failure notifications to: ') @@ -49,7 +50,7 @@ def main(): vpc_id = input('Enter vpc ID: ') if vpc_id: deploy_command_list.append('vpcId=' + vpc_id) - subnets = input('Enter comman seperated list of PRIVATE subnets: ') + subnets = input('Enter comma seperated list of PRIVATE subnets: ') if subnets: deploy_command_list.append('Subnets=' +subnets) print() From 4dbb8d9588dc0d808f5f084d2c5659488d0b06ff Mon Sep 17 00:00:00 2001 From: Rohit Kumar <112308320+stationeros@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:07:14 +0530 Subject: [PATCH 8/8] Adding safetensors --- labs/TrapheusAI/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/labs/TrapheusAI/requirements.txt b/labs/TrapheusAI/requirements.txt index ebbc1a8..7295227 100644 --- a/labs/TrapheusAI/requirements.txt +++ b/labs/TrapheusAI/requirements.txt @@ -15,3 +15,4 @@ streamlit-agraph streamlit-extras pandasai tk +safetensors