Skip to content

Commit

Permalink
BHBC-1814: Promote Dev to Test (#795)
Browse files Browse the repository at this point in the history
BHBC-1814: Promote Dev to Test
  • Loading branch information
NickPhura authored Jun 21, 2022
1 parent daa3ff3 commit 19c25c6
Show file tree
Hide file tree
Showing 158 changed files with 8,535 additions and 48,353 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ jobs:
timeout: 120000
interval: 500

# Install Node - for `node` and `npm` commands
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: E2E Smoke tests
uses: cypress-io/github-action@v2
# let's give this action an ID so we can refer
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/deployStatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,12 @@ jobs:
timeout: 240000
interval: 500

# Install Node - for `node` and `npm` commands
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: E2E Smoke tests
uses: cypress-io/github-action@v2
# let's give this action an ID so we can refer
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/toDraft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Switch to Draft
# Scales down running PODS when switching to Draft
name: Draft Scale Down

on:
pull_request:
types: [converted_to_draft]

jobs:
scaleDownPods:
name: Scale down the pods for this PR
runs-on: ubuntu-latest
env:
BUILD_ID: ${{ github.event.number }}
steps:
# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.
- name: Log in to OpenShift
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Scale down
run: |
oc project af2668-dev
oc get deploymentconfig --selector env-id=$BUILD_ID -o name | awk '{print "oc scale --replicas=0 " $1}' | bash
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@ build-web: ## Builds all backend+web containers
@echo "==============================================="
@echo "Make: build-web - building web images"
@echo "==============================================="
@docker-compose -f docker-compose.yml build db db_setup api app n8n n8n_nginx n8n_setup
@docker-compose -f docker-compose.yml build db db_setup api app
## @docker-compose -f docker-compose.yml build db db_setup api app n8n n8n_nginx n8n_setup

run-web: ## Runs all backend+web containers
@echo "==============================================="
@echo "Make: run-web - running web images"
@echo "==============================================="
@docker-compose -f docker-compose.yml up -d db db_setup api app n8n n8n_nginx n8n_setup
@docker-compose -f docker-compose.yml up -d db db_setup api app
## @docker-compose -f docker-compose.yml up -d db db_setup api app n8n n8n_nginx n8n_setup
## Restart n8n as a workaround to resolve this known issue: https://github.com/n8n-io/n8n/issues/2155
@docker-compose restart n8n
## @docker-compose restart n8n

## ------------------------------------------------------------------------------
## Commands to shell into the target container
Expand Down
15 changes: 10 additions & 5 deletions api/.pipeline/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const phases = {
elasticsearchURL: 'https://elasticsearch-af2668-dev.apps.silver.devops.gov.bc.ca',
tz: config.timezone.api,
branch: branch,
logLevel: isStaticDeployment && 'info' || 'debug'
logLevel: (isStaticDeployment && 'info') || 'debug'
},
dev: {
namespace: 'af2668-dev',
Expand All @@ -80,15 +80,16 @@ const phases = {
(isStaticDeployment && (staticUrlsAPI.dev || defaultHost)) ||
`${name}-${changeId}-af2668-dev.apps.silver.devops.gov.bc.ca`,
appHost:
(isStaticDeployment && (staticUrls.dev || defaultHostAPP)) ||
(isStaticDeployment && (staticUrls.dev || defaultHostAPP)) ||
`${appName}-${changeId}-af2668-dev.apps.silver.devops.gov.bc.ca`,
backboneApiHost: 'https://api-dev-biohub-platform.apps.silver.devops.gov.bc.ca',
env: 'dev',
elasticsearchURL: 'https://elasticsearch-af2668-dev.apps.silver.devops.gov.bc.ca',
tz: config.timezone.api,
certificateURL: config.certificateURL.dev,
replicas: 1,
maxReplicas: 2,
logLevel: isStaticDeployment && 'info' || 'debug'
maxReplicas: 1,
logLevel: (isStaticDeployment && 'info') || 'debug'
},
test: {
namespace: 'af2668-test',
Expand All @@ -101,8 +102,10 @@ const phases = {
version: `${version}`,
tag: `test-${version}`,
host: staticUrlsAPI.test,
appHost: staticUrls.test,
backboneApiHost: 'https://api-test-biohub-platform.apps.silver.devops.gov.bc.ca',
env: 'test',
elasticsearchURL: 'https://elasticsearch-af2668-dev.apps.silver.devops.gov.bc.ca',
elasticsearchURL: 'http://es01:9200',
tz: config.timezone.api,
certificateURL: config.certificateURL.test,
replicas: 3,
Expand All @@ -120,6 +123,8 @@ const phases = {
version: `${version}`,
tag: `prod-${version}`,
host: staticUrlsAPI.prod,
appHost: staticUrls.prod,
backboneApiHost: 'https://api-biohub-platform.apps.silver.devops.gov.bc.ca',
env: 'prod',
elasticsearchURL: 'http://es01:9200',
tz: config.timezone.api,
Expand Down
4 changes: 4 additions & 0 deletions api/.pipeline/lib/api.deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ module.exports = (settings) => {
HOST: phases[phase].host,
CHANGE_ID: phases.build.changeId || changeId,
APP_HOST: phases[phase].appHost,
BACKBONE_API_HOST: phases[phase].backboneApiHost,
NODE_ENV: phases[phase].env || 'dev',
ELASTICSEARCH_URL: phases[phase].elasticsearchURL,
TZ: phases[phase].tz,
KEYCLOAK_ADMIN_USERNAME: 'sims-svc',
KEYCLOAK_SECRET: 'keycloak-admin-password',
KEYCLOAK_SECRET_ADMIN_PASSWORD: 'keycloak_admin_password',
DB_SERVICE_NAME: `${phases[phase].dbName}-postgresql${phases[phase].suffix}`,
CERTIFICATE_URL: phases[phase].certificateURL,
REPLICAS: phases[phase].replicas || 1,
Expand Down
44 changes: 27 additions & 17 deletions api/openshift/api.dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ metadata:
parameters:
- name: ENABLE_FILE_VIRUS_SCAN
value: 'true'
- name: CLAMAV_HOST
value: 'clamav'
- name: CLAMAV_PORT
value: '3310'
- name: NAME
value: biohubbc-api
- name: SUFFIX
Expand All @@ -20,6 +24,8 @@ parameters:
- name: APP_HOST
description: APP host for application frontend
value: ''
- name: BACKBONE_API_HOST
description: API host for BioHub Platform Backbone
- name: CHANGE_ID
description: Change id of the project. This will help to pull image stream
required: true
Expand Down Expand Up @@ -51,10 +57,10 @@ parameters:
value: 35r1iman
- name: KEYCLOAK_ADMIN_USERNAME
description: keycloak host admin username
value: biohubbc-svc
- name: KEYCLOAK_ADMIN_PASSWORD
description: keycloak host url
value: 'keycloak-admin-password'
- name: KEYCLOAK_SECRET
description: The name of the keycloak secret
- name: KEYCLOAK_SECRET_ADMIN_PASSWORD
description: The key of the admin password in the keycloak secret
- name: API_PORT_DEFAULT
value: '6100'
- name: API_PORT_DEFAULT_NAME
Expand Down Expand Up @@ -153,8 +159,14 @@ objects:
value: ${API_PORT_DEFAULT}
- name: APP_HOST
value: ${APP_HOST}
- name: BACKBONE_API_HOST
value: ${BACKBONE_API_HOST}
- name: ENABLE_FILE_VIRUS_SCAN
value: ${ENABLE_FILE_VIRUS_SCAN}
- name: CLAMAV_HOST
value: ${CLAMAV_HOST}
- name: CLAMAV_PORT
value: ${CLAMAV_PORT}
- name: DB_HOST
value: ${DB_SERVICE_NAME}
- name: DB_USER_API
Expand Down Expand Up @@ -185,8 +197,8 @@ objects:
- name: KEYCLOAK_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: keycloak_admin_password
name: ${KEYCLOAK_ADMIN_PASSWORD}
name: ${KEYCLOAK_SECRET}
key: ${KEYCLOAK_SECRET_ADMIN_PASSWORD}
- name: CHANGE_VERSION
value: ${CHANGE_ID}
- name: NODE_ENV
Expand Down Expand Up @@ -291,13 +303,6 @@ objects:
name: ${NAME}:${VERSION}
type: ImageChange
- type: ConfigChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0
- apiVersion: v1
stringData:
database-name: ''
Expand Down Expand Up @@ -350,7 +355,7 @@ objects:
wildcardPolicy: None
status:
ingress: null
- apiVersion: autoscaling/v1
- apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
annotations: {}
Expand All @@ -361,8 +366,13 @@ objects:
maxReplicas: '${{REPLICA_MAX}}'
minReplicas: '${{REPLICAS}}'
scaleTargetRef:
apiVersion: v1
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
name: ${NAME}${SUFFIX}
cpuUtilization:
targetPercentage: 95
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
Loading

0 comments on commit 19c25c6

Please sign in to comment.