diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e2d8b08..5104801 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,7 @@ on: branches: - dev - stage + - prod workflow_dispatch: inputs: @@ -14,7 +15,7 @@ on: options: - '' - '--no-cache' - + jobs: build: runs-on: ubuntu-latest @@ -32,30 +33,27 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} -# - name: Get last tag -# run: echo "TAG_LAST=$(git describe --tags --abbrev=0 --always)" >> $GITHUB_ENV - -# - name: "Build Changelog" -# id: build_changelog -# uses: mikepenz/release-changelog-builder-action@v5 -# with: -# toTag: "${{ github.ref }}" -# mode: "HYBRID" -# outputFile: "CHANGELOG.md" - -# - name: Print CHANGELOG.md -# run: cat CHANGELOG.md - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + + # see tdei_uw.env for why + - name: Override ENV_NAME_PARAM for prod deployments + if: github.ref_name == 'prod' + run: echo "ENV_NAME_PARAM=" >> "$GITHUB_ENV" + - name: Override ENV_NAME_PARAM for dev or stage deployments + if: github.ref_name != 'prod' + env: + ENV: ${{ vars.ENV }} + run: echo "ENV_NAME_PARAM=-${ENV}" >> "$GITHUB_ENV" - name: Build and push - run: | + run: | docker compose -f docker-compose.build.yml --env-file tdei_uw.env build --build-arg CODE_VERSION=${CODE_VERSION} ${{github.event.inputs.build_flag}} docker compose -f docker-compose.build.yml --env-file tdei_uw.env push env: ENV: ${{ vars.ENV }} CODE_VERSION: ${{ github.sha }} + ENV_NAME_PARAM: ${{ env.ENV_NAME_PARAM }} # hosts WS_DOCKER_REGISTRY: ${{ vars.WS_DOCKER_REGISTRY }} @@ -74,6 +72,7 @@ jobs: env: ENV: ${{ vars.ENV }} CODE_VERSION: ${{ github.sha }} + ENV_NAME_PARAM: ${{ env.ENV_NAME_PARAM }} # machine to deploy to AZURE_DOCKER_HOST_IP: ${{ vars.AZURE_DOCKER_HOST_IP }} diff --git a/frontend b/frontend index 275ae3e..1d68a3e 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit 275ae3e43b65007b3a54c752480304fe5dfa13c8 +Subproject commit 1d68a3e66ca8de46db2d2f3780f1f7fb072787ab diff --git a/tdei_uw.env b/tdei_uw.env index 2b74124..68116c3 100644 --- a/tdei_uw.env +++ b/tdei_uw.env @@ -1,3 +1,13 @@ +# +# Resources for dev and stage are often db-dev, db-stage, while prod resources +# are just "db", not "db-prod". This variable allows us to construct the +# environment-prefixed variable values without putting the "-" in ENV which is +# used elsewhere. +# +# **This variable should therefore be set to empty string on prod ** +# +ENV_NAME_PARAM=-${ENV} + ############################################################################### # Docker ############################################################################### @@ -18,18 +28,18 @@ WS_PLATFORM_PRIVACY_POLICY=https://sidewalks.washington.edu/privacy # Web ############################################################################### -WS_TDEI_FRONTEND_URL=https://portal-${ENV}.tdei.us/ -WS_TDEI_BACKEND_URL=https://portal-api-${ENV}.tdei.us/api/v1/ -WS_TDEI_API_URL=https://api-${ENV}.tdei.us/api/v1/ -WS_TDEI_OIDC_URL=https://account-{$ENV}.tdei.us/ +WS_TDEI_FRONTEND_URL=https://portal${ENV_NAME_PARAM}.tdei.us/ +WS_TDEI_BACKEND_URL=https://portal-api${ENV_NAME_PARAM}.tdei.us/api/v1/ +WS_TDEI_API_URL=https://api${ENV_NAME_PARAM}.tdei.us/api/v1/ +WS_TDEI_OIDC_URL=https://account${ENV_NAME_PARAM}.tdei.us/ WS_TDEI_OIDC_REALM=tdei -WS_FRONTEND_HOST=workspaces-${ENV}.sidewalks.washington.edu -WS_API_HOST=api.workspaces-${ENV}.sidewalks.washington.edu -WS_RAPID_HOST=rapid.workspaces-${ENV}.sidewalks.washington.edu -WS_PATHWAYS_EDITOR_HOST=pathways.workspaces-${ENV}.sidewalks.washington.edu -WS_OSM_HOST=osm.workspaces-${ENV}.sidewalks.washington.edu -WS_TASKS_HOST=tasks.workspaces-${ENV}.sidewalks.washington.edu +WS_FRONTEND_HOST=workspaces${ENV_NAME_PARAM}.sidewalks.washington.edu +WS_API_HOST=api.workspaces${ENV_NAME_PARAM}.sidewalks.washington.edu +WS_RAPID_HOST=rapid.workspaces${ENV_NAME_PARAM}.sidewalks.washington.edu +WS_PATHWAYS_EDITOR_HOST=pathways.workspaces${ENV_NAME_PARAM}.sidewalks.washington.edu +WS_OSM_HOST=osm.workspaces${ENV_NAME_PARAM}.sidewalks.washington.edu +WS_TASKS_HOST=tasks.workspaces${ENV_NAME_PARAM}.sidewalks.washington.edu WS_DEV_PORT=3000 @@ -56,15 +66,15 @@ WS_API_DB_NAME=workspaces WS_OSM_DB_HOST=${WS_POSM_DB_HOST} WS_OSM_DB_PORT=5432 -WS_OSM_DB_USER=workspaces-osm-${ENV} +WS_OSM_DB_USER=workspaces-osm${ENV_NAME_PARAM} WS_OSM_DB_PASS=${WS_OSM_DB_PASS} -WS_OSM_DB_NAME=workspaces-osm-${ENV} +WS_OSM_DB_NAME=workspaces-osm${ENV_NAME_PARAM} WS_TASKS_DB_HOST=${WS_POSM_DB_HOST} WS_TASKS_DB_PORT=5432 -WS_TASKS_DB_USER=workspaces-tasks-${ENV} +WS_TASKS_DB_USER=workspaces-tasks${ENV_NAME_PARAM} WS_TASKS_DB_PASS=${WS_TASKS_DB_PASS} -WS_TASKS_DB_NAME=workspaces-tasks-${ENV} +WS_TASKS_DB_NAME=workspaces-tasks${ENV_NAME_PARAM} ############################################################################### # Mail