Skip to content

Commit

Permalink
feat: disabled production deploy for now; updated app title and defau…
Browse files Browse the repository at this point in the history
…lt content
  • Loading branch information
catherine meng authored and catherine meng committed Jul 7, 2022
1 parent ee2b8ae commit 3771844
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .github/openshift/networkPolicies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Template
metadata:
name: ${NAME}
annotations:
description: "Nr-Forest-Client"
description: "NR-Forest-Client"
tags: "nrfl"
iconClass: icon-js
objects:
Expand Down
170 changes: 85 additions & 85 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,88 +281,88 @@ jobs:
allow_issue_writing: false
fail_action: false

deploy-prod:
name: PROD Deployment
needs:
- zap-backend
- zap-frontend
runs-on: ubuntu-latest
environment:
name: prod
env:
ZONE: prod
PREV: test
steps:
- uses: actions/checkout@v2
- name: Deploy
run: |
# Login to OpenShift and select project
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }}
oc project ${{ secrets.OC_NAMESPACE }}
# Clear stale images for import/replacement
if [ $(oc get is -l app=${{ env.NAME }}-${{ env.ZONE }} -o name | grep -v database | wc -l) -gt 0 ]; then
oc delete is -l app=${{ env.NAME }}-${{ env.ZONE }}
fi
# Cancel db backup rollout if exists
if [ $(oc get dc -l app=backup-container -o name | wc -l) -gt 0 ]; then
oc rollout cancel dc/${{ env.NAME }}-${{ env.ZONE }}-dbbackup 2> /dev/null \
|| true && echo "No rollout in progress"
fi
# Create frontend config (Remove the old one if exists)
oc delete configmap ${{ env.NAME }}-${{ env.ZONE }}-frontend 2> /dev/null \
|| true && echo "No existing frontend config"
oc create configmap ${{ env.NAME }}-${{ env.ZONE }}-frontend \
--from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"
# Process and apply deployment templates
oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.PREV }}-backend \
-p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
-p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
-p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
-p EMAIL_API_URL='https://ches.apps.silver.devops.gov.bc.ca/api/v1' \
-p NODE_ENV='production' | oc apply -f -
oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.PREV }}-frontend | oc apply -f -
# Follow any active rollouts (see deploymentconfigs)
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w
# Remove completed build runs, build pods and deployment pods
for p in $(oc get po | grep "Completed" | awk '{print $1}')
do
oc delete po ${p}
done
# Restart db backup rollout if exists
if [ $(oc get dc -l app=backup-container -o name | wc -l) -gt 0 ]; then
oc rollout latest dc/${{ env.NAME }}-${{ env.ZONE }}-dbbackup 2> /dev/null \
|| true && echo "Rollout in progress"
oc logs -f dc/${{ env.NAME }}-${{ env.ZONE }}-dbbackup
fi
- name: Promote Backend Image to PROD
uses: shrink/actions-docker-registry-tag@v2
with:
registry: ghcr.io
repository: ${{ github.repository }}
token: ${{ secrets.GHCR_TOKEN }}
target: ${{ env.PREV }}-backend
tags: |
prod-backend
- name: Promote Frontend Image to PROD
uses: shrink/actions-docker-registry-tag@v2
with:
registry: ghcr.io
repository: ${{ github.repository }}
token: ${{ secrets.GHCR_TOKEN }}
target: ${{ env.PREV }}-frontend
tags: |
prod-frontend
# deploy-prod:
# name: PROD Deployment
# needs:
# - zap-backend
# - zap-frontend
# runs-on: ubuntu-latest
# environment:
# name: prod
# env:
# ZONE: prod
# PREV: test
# steps:
# - uses: actions/checkout@v2
# - name: Deploy
# run: |
# # Login to OpenShift and select project
# oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }}
# oc project ${{ secrets.OC_NAMESPACE }}

# # Clear stale images for import/replacement
# if [ $(oc get is -l app=${{ env.NAME }}-${{ env.ZONE }} -o name | grep -v database | wc -l) -gt 0 ]; then
# oc delete is -l app=${{ env.NAME }}-${{ env.ZONE }}
# fi

# # Cancel db backup rollout if exists
# if [ $(oc get dc -l app=backup-container -o name | wc -l) -gt 0 ]; then
# oc rollout cancel dc/${{ env.NAME }}-${{ env.ZONE }}-dbbackup 2> /dev/null \
# || true && echo "No rollout in progress"
# fi

# # Create frontend config (Remove the old one if exists)
# oc delete configmap ${{ env.NAME }}-${{ env.ZONE }}-frontend 2> /dev/null \
# || true && echo "No existing frontend config"
# oc create configmap ${{ env.NAME }}-${{ env.ZONE }}-frontend \
# --from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"

# # Process and apply deployment templates
# oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
# oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
# -p PROMOTE=${{ github.repository }}:${{ env.PREV }}-backend \
# -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# -p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# -p EMAIL_API_URL='https://ches.apps.silver.devops.gov.bc.ca/api/v1' \
# -p NODE_ENV='production' | oc apply -f -
# oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
# -p PROMOTE=${{ github.repository }}:${{ env.PREV }}-frontend | oc apply -f -

# # Follow any active rollouts (see deploymentconfigs)
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w

# # Remove completed build runs, build pods and deployment pods
# for p in $(oc get po | grep "Completed" | awk '{print $1}')
# do
# oc delete po ${p}
# done

# # Restart db backup rollout if exists
# if [ $(oc get dc -l app=backup-container -o name | wc -l) -gt 0 ]; then
# oc rollout latest dc/${{ env.NAME }}-${{ env.ZONE }}-dbbackup 2> /dev/null \
# || true && echo "Rollout in progress"
# oc logs -f dc/${{ env.NAME }}-${{ env.ZONE }}-dbbackup
# fi

# - name: Promote Backend Image to PROD
# uses: shrink/actions-docker-registry-tag@v2
# with:
# registry: ghcr.io
# repository: ${{ github.repository }}
# token: ${{ secrets.GHCR_TOKEN }}
# target: ${{ env.PREV }}-backend
# tags: |
# prod-backend

# - name: Promote Frontend Image to PROD
# uses: shrink/actions-docker-registry-tag@v2
# with:
# registry: ghcr.io
# repository: ${{ github.repository }}
# token: ${{ secrets.GHCR_TOKEN }}
# target: ${{ env.PREV }}-frontend
# tags: |
# prod-frontend
4 changes: 1 addition & 3 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
<div>
<MainHeader />
<b-container>
<NewFormSubmission />
Hello World
</b-container>
</div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import MainHeader from "./common/MainHeader.vue";
import NewFormSubmission from "./pages/NewFormSubmission.vue";
export default defineComponent({
name: "App",
components: {
MainHeader,
NewFormSubmission,
},
data() {
return {};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/common/MainHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
alt="Go to the Government of British Columbia website"
/>
</a>
<h1>FSA - Old Growth</h1>
<h1>FSA - Forest Client</h1>
</div>
</header>
</template>
Expand Down

0 comments on commit 3771844

Please sign in to comment.