Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bbrooks/new relic staging fix #3916

Merged
merged 7 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,13 @@ jobs:
root: ~/project
paths:
- web/dist
- run:
name: persist build URL to workspace
command: echo "https://${CIRCLE_BUILD_NUM}-${GH_REPO_ID}-gh.circle-artifacts.com/0" > build-url.txt
- persist_to_workspace:
root: ~/project
paths:
- ./build-url.txt

# Lints the frontend code.
frontend lint:
Expand Down Expand Up @@ -827,6 +834,7 @@ jobs:
--OKTA_CLIENT_ID "$PREVIEW_OKTA_CLIENT_ID" \
--OKTA_API_KEY "$PREVIEW_OKTA_API_KEY" \
--JWT_SECRET "$PREVIEW_JWT_SECRET" \
--BUILD_URL "$(cat ../../build-url.txt)/backend.zip" \
--MONGO_INITDB_ROOT_USERNAME "$REVIEW_MONGO_INITDB_ROOT_USERNAME" \
--MONGO_INITDB_ROOT_PASSWORD "$PREVIEW_MONGO_INITDB_ROOT_PASSWORD" \
--MONGO_INITDB_DATABASE "$PREVIEW_MONGO_INITDB_DATABASE" \
Expand Down Expand Up @@ -864,6 +872,10 @@ jobs:
yarn install --frozen-lockfile --production=true
cd ..
zip -r /tmp/backend.zip api/*
- run:
name: Create Frontend Build Artifact Zip
working_directory: ~/project
command: |
zip -r /tmp/frontend.zip web/dist/*
- run:
name: persist build URL to workspace
Expand Down
2 changes: 2 additions & 0 deletions bin/preview-deploy/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ function configureUserData() {

sed -i'.backup' -e "s|__DATABASE_URL__|`echo $DATABASE_URL`|g" aws.user-data.sh

sed -i'.backup' -e "s|__BUILDURL__|`echo $BUILD_URL`|g" aws.user-data.sh

rm aws.user-data.sh.backup
}

Expand Down
5 changes: 4 additions & 1 deletion bin/preview-deploy/aws.user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export MONGO_INITDB_ROOT_PASSWORD="__MONGO_INITDB_ROOT_PASSWORD__"
export MONGO_INITDB_DATABASE="__MONGO_INITDB_DATABASE__"
export MONGO_DATABASE_USERNAME="__MONGO_DATABASE_USERNAME__"
export MONGO_DATABASE_PASSWORD="__MONGO_DATABASE_PASSWORD__"
export DATABASE_URL="__DATABASE_URL"
export DATABASE_URL="__DATABASE_URL__"
sudo sh -c "echo license_key: '__NEW_RELIC_LICENSE_KEY__' >> /etc/newrelic-infra.yml"
cd ~
mkdir -p /app/api/logs
Expand All @@ -29,6 +29,9 @@ touch /app/api/logs/Database-migration-out.log
touch /app/api/logs/Database-seeding-error.log
touch /app/api/logs/Database-seeding-out.log
touch /app/api/logs/cms-hitech-apd-api.logs
#Trouble Shooting
echo __BUILDURL__ |tee buildurl.txt
curl -o backend.zip -L __BUILDURL__

# Install nvm. Do it inside the ec2-user home directory so that user will have
# access to it forever, just in case we need to get into the machine and
Expand Down
4 changes: 2 additions & 2 deletions bin/prod-deploy/aws.user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ npm i -g pm2
npm i -g yarn@1.22.17
# Get the built API code
cd /app
echo __BUILDURL__
curl -o backend.zip -L __BUILDURL__
echo __BUILDURL__ |tee /home/ec2-user/buildurl.txt
curl -o backend.zip -L __BUILDURL__ |tee /home/ec2-user/backenddownload.txt
unzip backend.zip
# rm backend.zip
cd api
Expand Down