Skip to content

Commit

Permalink
Tforkner/3745 budget migration (#4364)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetif authored Oct 17, 2022
1 parent bc4ec69 commit 7eb859a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 11 additions & 9 deletions bin/prod-deploy/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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`
Expand Down
3 changes: 3 additions & 0 deletions bin/prod-deploy/aws.user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7eb859a

Please sign in to comment.