-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from cancervariants/staging
Staging
- Loading branch information
Showing
12 changed files
with
162 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Module for deploying staging EB environment.""" | ||
import boto3 | ||
import time | ||
|
||
elasticbeanstalk = boto3.client('elasticbeanstalk') | ||
servicecatalog = boto3.client('servicecatalog') | ||
terminate_time = 12 | ||
eb_app_name = "GeneNormalization" | ||
eb_env_name = "GeneNormalization-dev-env" | ||
sc_product_id = "prod-mmw6ymv2ntzl2" | ||
print(f'Launching new Service Catalog Product for staging environment:' | ||
f' {eb_app_name}') | ||
sc_product_artifacts = \ | ||
servicecatalog.list_provisioning_artifacts(ProductId=sc_product_id) | ||
for artifact in sc_product_artifacts['ProvisioningArtifactDetails']: | ||
if artifact['Active']: | ||
provisioning_artifact_id = artifact['Id'] | ||
try: | ||
eb_provisioned_product = servicecatalog.provision_product( | ||
ProductId=sc_product_id, | ||
ProvisioningArtifactId=provisioning_artifact_id, | ||
ProvisionedProductName=eb_env_name, | ||
ProvisioningParameters=[ | ||
{ | ||
'Key': 'Env', | ||
'Value': eb_app_name | ||
}, | ||
{ | ||
'Key': 'EnvType', | ||
'Value': 'dev' | ||
}, | ||
{ | ||
'Key': 'TerminateTime', | ||
'Value': str(terminate_time) | ||
} | ||
] | ||
) | ||
eb_provisioned_product_Id = \ | ||
eb_provisioned_product['RecordDetail']['ProvisionedProductId'] | ||
product_status = servicecatalog.describe_provisioned_product( | ||
Id=eb_provisioned_product_Id) | ||
eb_provisioned_product_status = \ | ||
product_status['ProvisionedProductDetail']['Status'] | ||
while eb_provisioned_product_status == "UNDER_CHANGE": | ||
time.sleep(10) | ||
product_status = servicecatalog.describe_provisioned_product( | ||
Id=eb_provisioned_product_Id) | ||
eb_provisioned_product_status = \ | ||
product_status['ProvisionedProductDetail']['Status'] | ||
print(eb_provisioned_product_status) | ||
except: # noqa: E722 | ||
print("The EB environment is already running...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Module for terminating staging EB environment.""" | ||
import boto3 | ||
import json | ||
import time | ||
|
||
client = boto3.client('lambda') | ||
servicecatalog = boto3.client('servicecatalog') | ||
eb_env_name = "GeneNormalization-dev-env" | ||
data = {"sc_provisioned_name": eb_env_name} | ||
client.invoke(FunctionName='igm-inf-terminate-provisioned-product', | ||
Payload=json.dumps(data)) | ||
time.sleep(10) | ||
provisioned_product = \ | ||
servicecatalog.describe_provisioned_product(Name=eb_env_name) | ||
eb_provisioned_product_Id =\ | ||
provisioned_product['ProvisionedProductDetail']['Id'] | ||
product_status = servicecatalog.describe_provisioned_product( | ||
Id=eb_provisioned_product_Id) | ||
eb_provisioned_product_status =\ | ||
product_status['ProvisionedProductDetail']['Status'] | ||
while eb_provisioned_product_status == "UNDER_CHANGE": | ||
time.sleep(10) | ||
try: | ||
product_status = servicecatalog.describe_provisioned_product( | ||
Id=eb_provisioned_product_Id) | ||
eb_provisioned_product_status = \ | ||
product_status['ProvisionedProductDetail']['Status'] | ||
except: # noqa: E722 | ||
eb_provisioned_product_status = "PRODUCT NOT FOUND" | ||
print(eb_provisioned_product_status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
__version__ = "0.1.22" | ||
"""Gene normalizer version""" | ||
__version__ = "0.1.23" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.