diff --git a/dcicutils/beanstalk_utils.py b/dcicutils/beanstalk_utils.py index 2b4533727..7c086410f 100755 --- a/dcicutils/beanstalk_utils.py +++ b/dcicutils/beanstalk_utils.py @@ -25,8 +25,8 @@ FOURSIGHT_URL = 'https://foursight.4dnucleome.org/' # magic CNAME corresponds to data.4dnucleome -MAGIC_CNAME = 'fourfront-webprod.9wzadzju3p.us-east-1.elasticbeanstalk.com' -GOLDEN_DB = "fourfront-webprod.co3gwj7b7tpq.us-east-1.rds.amazonaws.com" +MAGIC_CNAME = 'fourfront-green.us-east-1.elasticbeanstalk.com' +GOLDEN_DB = 'fourfront-production.co3gwj7b7tpq.us-east-1.rds.amazonaws.com' REGION = 'us-east-1' @@ -48,7 +48,7 @@ def delete_db(db_identifier, take_snapshot=True, allow_delete_prod=False): dict: boto3 response from delete_db_instance """ # safety. Do not allow accidental programmatic deletion of webprod DB - if 'webprod' in db_identifier and not allow_delete_prod: + if 'prod' in db_identifier and not allow_delete_prod: raise Exception('Must set allow_delete_prod to True to delete RDS instance' % db_identifier) client = boto3.client('rds') timestamp = datetime.strftime(datetime.utcnow(), "%Y-%m-%d") @@ -246,7 +246,9 @@ def get_beanstalk_real_url(env): if env in urls: return urls[env] - if 'webprod' in env: + # TODO (C4-91): Reconsider environment names. + # This code is too fragile. + if 'webprod' in env or 'blue' in env or 'green' in env: data_env = whodaman() if data_env == env: @@ -590,6 +592,8 @@ def update_bs_config(envname, template=None, keep_env_vars=False, def create_bs(envname, load_prod, db_endpoint, es_url, for_indexing=False): """ + XXX: Will not work currently, do NOT use on production + Create a beanstalk environment given an envname. Use customized options, configuration template, and environment variables. If adding new env vars, make sure to overwrite them here. diff --git a/dcicutils/ff_utils.py b/dcicutils/ff_utils.py index b73e457cb..82862dd03 100644 --- a/dcicutils/ff_utils.py +++ b/dcicutils/ff_utils.py @@ -23,6 +23,10 @@ 'elasticbeanstalk-fourfront-webdev-wfoutput'] +# TODO (C4-92): Centralize this information, it is repeated in other repos +PRODUCTION_ENVS = ['fourfront-blue', 'fourfront-green'] + + ################################## # Widely used metadata functions # ################################## @@ -1062,8 +1066,11 @@ def unified_authentication(auth=None, ff_env=None): """ # first see if key should be obtained from using ff_env if not auth and ff_env: - # webprod and webprod2 both use the fourfront-webprod bucket for keys - use_env = 'fourfront-webprod' if 'webprod' in ff_env else ff_env + # webprod, webprod2 and blue/green all use the fourfront-webprod bucket for keys + if 'webprod' in ff_env or ff_env in PRODUCTION_ENVS: + use_env = 'fourfront-webprod' + else: + use_env = ff_env auth = s3_utils.s3Utils(env=use_env).get_access_keys() # see if auth is directly from get_access_keys() use_auth = None diff --git a/pyproject.toml b/pyproject.toml index 80f543ac4..e9962a957 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "0.9.5" +version = "0.9.6" description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["William Ronchetti "] license = "MIT"