diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e2d8b08..1b50875 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,17 @@ 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 - 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: "${{ vars.ENV == 'prod' && '' || -${ENV} }}" # hosts WS_DOCKER_REGISTRY: ${{ vars.WS_DOCKER_REGISTRY }} @@ -74,6 +62,7 @@ jobs: env: ENV: ${{ vars.ENV }} CODE_VERSION: ${{ github.sha }} + ENV_NAME_PARAM: "${{ vars.ENV == 'prod' && '' || -${ENV} }}" # machine to deploy to AZURE_DOCKER_HOST_IP: ${{ vars.AZURE_DOCKER_HOST_IP }} 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