From 7eb859afc48d31b53956021f4499ece7479d79cb Mon Sep 17 00:00:00 2001 From: Tiffany Date: Mon, 17 Oct 2022 14:54:27 -0400 Subject: [PATCH] Tforkner/3745 budget migration (#4364) --- bin/prod-deploy/aws.sh | 20 +++++++++++--------- bin/prod-deploy/aws.user-data.sh | 3 +++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bin/prod-deploy/aws.sh b/bin/prod-deploy/aws.sh index 0876ba0538..eeabd1f568 100755 --- a/bin/prod-deploy/aws.sh +++ b/bin/prod-deploy/aws.sh @@ -51,6 +51,9 @@ set -e function deployAPItoEC2() { + # Configure AWS CLI with defaults + configureAWS + # Adds the URL to the build artifacts to the user data file, so we can # download it when the EC2 instance starts up addBuildUrlToUserData @@ -59,9 +62,6 @@ function deployAPItoEC2() { # EC2 run-instances user data file addEcosystemToUserData - # Configure AWS CLI with defaults - configureAWS - # Get the instance IDs of the current API EC2 production instances, so we can # delete them later PREV_INSTANCE_INFOS=$(findExistingInstances) @@ -142,9 +142,9 @@ function addBuildUrlToUserData() { sed -i'.backup' -e "s|__MONGO_DATABASE__|`echo $MONGO_DATABASE`|g" aws.user-data.sh - sed -i'.backup' -e "s|__MONGO_URL__|`echo $MONGO_URL`|g" aws.user-data.sh + sed -i'.backup' -e "s|__MONGO_URL__|\"`echo $MONGO_URL`\"|g" aws.user-data.sh - sed -i'.backup' -e "s|__MONGO_ADMIN_URL__|`echo $MONGO_ADMIN_URL`|g" aws.user-data.sh + sed -i'.backup' -e "s|__MONGO_ADMIN_URL__|\"`echo $MONGO_ADMIN_URL`\"|g" aws.user-data.sh sed -i'.backup' -e "s|__NEW_RELIC_LICENSE_KEY__|`echo $NEW_RELIC_LICENSE_KEY`|g" aws.user-data.sh @@ -212,8 +212,8 @@ function addEcosystemToUserData() { OKTA_API_KEY: '$OKTA_API_KEY', JWT_SECRET: '$JWT_SECRET', MONGO_DATABASE: '$MONGO_DATABASE', - MONGO_URL: '$MONGO_URL' - + MONGO_URL: '$MONGO_URL', + LD_API_KEY: '$LD_API_KEY' }, },{ name: 'Database migration', @@ -230,7 +230,8 @@ function addEcosystemToUserData() { OKTA_API_KEY: '$OKTA_API_KEY', JWT_SECRET: '$JWT_SECRET', MONGO_DATABASE: '$MONGO_DATABASE', - MONGO_URL: '$MONGO_URL' + MONGO_URL: '$MONGO_URL', + LD_API_KEY: '$LD_API_KEY' } },{ name: 'Database seeding', @@ -247,7 +248,8 @@ function addEcosystemToUserData() { OKTA_API_KEY: '$OKTA_API_KEY', JWT_SECRET: '$JWT_SECRET', MONGO_DATABASE: '$MONGO_DATABASE', - MONGO_URL: '$MONGO_URL' + MONGO_URL: '$MONGO_URL', + LD_API_KEY: '$LD_API_KEY' } }] };" | base64 -w 0` diff --git a/bin/prod-deploy/aws.user-data.sh b/bin/prod-deploy/aws.user-data.sh index c0121d160c..ddcf8dadbc 100644 --- a/bin/prod-deploy/aws.user-data.sh +++ b/bin/prod-deploy/aws.user-data.sh @@ -221,7 +221,10 @@ yarn install --frozen-lockfile --non-interactive --production --network-timeout yarn add --force knex yarn add newrelic cp node_modules/newrelic/newrelic.js api/newrelic.js + cd api +yarn build + sed -i 's|My Application|eAPD API|g' newrelic.js sed -i 's|license key here|__NEW_RELIC_LICENSE_KEY__|g' newrelic.js sed -i "1 s|^|require('newrelic');\n|" main.js