Skip to content

Commit

Permalink
Deployment updates for STAGE delete (#3542)
Browse files Browse the repository at this point in the history
* Deployment updates for STAGE delete

* Add CHANGELOG

* Minor tweaks

* Update init-trackers.js from prod-stage to prod-test
  • Loading branch information
yuanzhou authored Oct 7, 2024
1 parent 1e6df85 commit 1798cf8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-stage-deployment-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Delete STAGE environment and spin up new portal instance on TEST
2 changes: 0 additions & 2 deletions compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.7"

services:
portal-ui:
build: ../context
Expand Down
8 changes: 4 additions & 4 deletions compose/example.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This variable to be used by DEV/TEST/PROD deployments
# This variable to be used by DEV and PROD deployments
LOG_STREAM=DEV

# Following variables to be used by STAGE deployment only
# Following variables to be used by TEST deployment only
# due to the fact we have two instances
LOG_STREAM_STAGE=STAGE
LOG_STREAM_STAGE_PROD=STAGE-PROD
LOG_STREAM_TEST=TEST
LOG_STREAM_TEST_PROD=TEST-PROD
6 changes: 2 additions & 4 deletions compose/hubmap.stage.yml → compose/hubmap.test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.7"

services:
portal-ui:
hostname: portal-ui
Expand All @@ -20,7 +18,7 @@ services:
options:
awslogs-region: us-east-1
awslogs-group: portal-ui-docker-logs
awslogs-stream: ${LOG_STREAM_STAGE}
awslogs-stream: ${LOG_STREAM_TEST}

# Service names need to be kept in sync with gateway:
# https://github.com/hubmapconsortium/gateway/blob/f2c2d5d/nginx/conf.d-stage/prod-portal-ui.conf
Expand All @@ -44,7 +42,7 @@ services:
options:
awslogs-region: us-east-1
awslogs-group: portal-ui-docker-logs
awslogs-stream: ${LOG_STREAM_STAGE_PROD}
awslogs-stream: ${LOG_STREAM_TEST_PROD}

networks:
# This is the network created by gateway to enable communicaton between multiple docker-compose projects
Expand Down
2 changes: 0 additions & 2 deletions compose/hubmap.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.7"

services:
portal-ui:
hostname: portal-ui
Expand Down
2 changes: 1 addition & 1 deletion context/app/static/js/helpers/init-trackers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getUserGroups, getUserType } from './trackers';
function initTrackers() {
const version = `portal-ui-react@${PACKAGE_VERSION}`;
const environment = sentryEnv;
const shouldReport = ['prod', 'prod-stage'].includes(environment);
const shouldReport = ['prod', 'prod-test'].includes(environment);

initializeFaro({
url: 'https://faro-collector-prod-us-east-0.grafana.net/collect/77a0efade67edd876ae6c63ebb2d825c',
Expand Down
14 changes: 7 additions & 7 deletions etc/build/redeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -o errexit

die() { set +v; echo "$*" 1>&2 ; exit 1; }

[ "$#" -eq 2 ] || die "usage: $0 USERNAME [ dev | test | stage]"
[ "$#" -eq 2 ] || die "usage: $0 USERNAME [dev | test]"
USER="$1"
TARGET="$2"

Expand All @@ -19,8 +19,8 @@ cd /opt/hubmap/portal-ui/compose
echo 'portal running?' \`docker ps | grep portal-ui\`
COMPOSE_CONFIG=hubmap.yml
[ "$TARGET" = "stage" ] && COMPOSE_CONFIG=hubmap.stage.yml
# hubmap.stage.yml includes two portal instances.
[ "$TARGET" = "test" ] && COMPOSE_CONFIG=hubmap.test.yml
# hubmap.test.yml includes two portal instances.
echo 'stopping...'
docker-compose -f \$COMPOSE_CONFIG down
Expand All @@ -33,10 +33,10 @@ docker rmi hubmap/portal-ui:latest
echo 'starting...'
docker-compose -f \$COMPOSE_CONFIG up -d
# We don't understand why the prod-stage instance is getting the wrong configuration.
# We don't understand why the prod-test instance is getting the wrong configuration.
# We hope turning it off-and-on will help, but this is not a good situation.
if [ "$TARGET" = "stage" ]; then
echo 'Restart the hubmap-auth container... for STAGE only'
if [ "$TARGET" = "test" ]; then
echo 'Restart the hubmap-auth container... for TEST only'
docker restart hubmap-auth
fi
Expand All @@ -48,4 +48,4 @@ EOF

echo "Visit --> http://portal.$TARGET.hubmapconsortium.org/"

[ "$TARGET" = "stage" ] && echo "Visit --> http://portal-prod.stage.hubmapconsortium.org/"
[ "$TARGET" = "test" ] && echo "Visit --> http://portal-prod.test.hubmapconsortium.org/"

0 comments on commit 1798cf8

Please sign in to comment.