Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): deploy frontend #69

Merged
merged 74 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
efc8b4b
Update frontend dockerfile, deploy workflow, and pr-open workflow.
fergmac Sep 26, 2024
0acf52e
Comment out build step. Revert backend template memory update.
fergmac Sep 26, 2024
be60101
Pass in params to frontend deployment template.
fergmac Sep 26, 2024
3ce3cae
Uncomment build step.
fergmac Sep 26, 2024
6f07a67
Params typo.
fergmac Sep 26, 2024
29fe4a8
Update frontend image.
fergmac Sep 26, 2024
306c933
Adjust frontend dockerfile.
fergmac Sep 26, 2024
4e1db4a
Add echo to dockerfile.
fergmac Sep 26, 2024
2ec6cf9
Docker log.
fergmac Sep 26, 2024
2ba5ee0
Update logging.
fergmac Sep 26, 2024
85af674
Remove cmd from dockerfile.
fergmac Sep 26, 2024
5870b77
Add caddy to dockerfile.
fergmac Sep 26, 2024
cef6a27
Adjust caddy permissions.
fergmac Sep 26, 2024
4902dfd
Update caddy image.
fergmac Sep 26, 2024
e7dc819
Add Caddyfile and update dockerfile.
fergmac Sep 26, 2024
13e3f04
Format Caddyfile and add vars to frontend deployment template.
fergmac Sep 26, 2024
c3845c5
Add caddy command to dockerfile.
fergmac Sep 27, 2024
af6d592
Add run to caddy command.
fergmac Sep 27, 2024
553dbde
Update caddy path.
fergmac Sep 27, 2024
829399b
Caddy 2 config flag update.
fergmac Sep 27, 2024
3b03e65
Add env var to dockerfile.
fergmac Sep 27, 2024
bf061fc
clean up.
fergmac Sep 27, 2024
032fbf1
Add caddy web server.
fergmac Oct 8, 2024
0fb33cd
Use non root user for caddy.
fergmac Oct 8, 2024
a968fa1
Remove caddy cmd.
fergmac Oct 8, 2024
316ec0d
Override openshift version in init.
fergmac Oct 9, 2024
3664a97
Remove uneeded jobs. Update deployer action.
fergmac Oct 9, 2024
f9ed118
Try oc version
DerekRoberts Oct 9, 2024
3e973bb
Temporarily comment out builds
DerekRoberts Oct 9, 2024
7ca5942
More oc versions
DerekRoberts Oct 9, 2024
3ac8e8d
Test deploy frontend
DerekRoberts Oct 9, 2024
2472424
Test deploy frontend
DerekRoberts Oct 9, 2024
b22bd80
Test deploy frontend
DerekRoberts Oct 9, 2024
38a61c1
Keep at Frontend
DerekRoberts Oct 9, 2024
a11b4da
Keep at Frontend
DerekRoberts Oct 9, 2024
4f8e4d1
Fix Caddyfile
DerekRoberts Oct 9, 2024
8f56155
Docker compose changes
DerekRoberts Oct 9, 2024
2dabd5f
Caddy updates.
fergmac Oct 10, 2024
18c3c2f
Junk
DerekRoberts Oct 10, 2024
c5fdad4
Tests workflow
DerekRoberts Oct 10, 2024
3856faf
Steal Fergus' work
DerekRoberts Oct 10, 2024
8c4a8e8
Compose healthchecks
DerekRoberts Oct 10, 2024
14f9391
Backend health and readiness probes
DerekRoberts Oct 10, 2024
927e5e8
Docker compose tweaks.
fergmac Oct 10, 2024
51a7b55
Uncomment deployment security context.
fergmac Oct 10, 2024
afa7b7b
Update caddy health check.
fergmac Oct 10, 2024
edf3386
Update port.
fergmac Oct 10, 2024
080b85b
Update security context.
fergmac Oct 10, 2024
a2818fa
Update security context.
fergmac Oct 10, 2024
0c3fb1b
Update caddyfile backend url.
fergmac Oct 10, 2024
20773ce
Update deployment ports.
fergmac Oct 10, 2024
4173e1b
Update port.
fergmac Oct 10, 2024
2d4773a
Add name suffix to deployment template.
fergmac Oct 10, 2024
d812f08
Update deployment name suffix.
fergmac Oct 10, 2024
bbe40ab
Fix name suffix formatting.
fergmac Oct 10, 2024
25d3930
Revert container port.
fergmac Oct 10, 2024
bf491d5
Update readiness and liveness ports.
fergmac Oct 10, 2024
04c07f9
Add -frontend to suffix when missing.
fergmac Oct 10, 2024
15737ab
Fix route.
fergmac Oct 10, 2024
0a1e90a
Container port update.
fergmac Oct 10, 2024
ef30d84
Add path.
fergmac Oct 10, 2024
39cb670
Remove port.
fergmac Oct 10, 2024
4525616
Add -backend post fix in deployment template.
fergmac Oct 10, 2024
a79e090
Hard code backend image.
fergmac Oct 10, 2024
f65e010
Test backend deploy.
fergmac Oct 11, 2024
f2dcfd7
Remove path from readiness and health check.
fergmac Oct 11, 2024
0f26d96
Update probe ports.
fergmac Oct 11, 2024
89adf00
Update probe paths.
fergmac Oct 11, 2024
50a02d9
Adjust backend deploy route.
fergmac Oct 11, 2024
82bbc18
Readd path.
fergmac Oct 11, 2024
49067a0
Remove path again.
fergmac Oct 11, 2024
118e423
Revert probe changes.
fergmac Oct 11, 2024
a787be2
Comment out probes.
fergmac Oct 11, 2024
85e54fc
Uncomment build and deploy jobs.
fergmac Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 59 additions & 48 deletions .github/workflows/.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Initialize
uses: bcgov-nr/[email protected].0
uses: bcgov-nr/[email protected].1
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
oc_version: "4.14.37"
file: common/openshift.init.yml
overwrite: true
parameters:
Expand All @@ -54,23 +55,13 @@ jobs:
# environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
# - name: Deploy Frontend
# uses: bcgov-nr/[email protected]
# with:
# oc_namespace: ${{ vars.OC_NAMESPACE }}
# oc_server: ${{ vars.OC_SERVER }}
# oc_token: ${{ secrets.OC_TOKEN }}
# file: frontend/openshift.deploy.yml
# overwrite: true
# parameters:
# -p TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }}

- name: Database
uses: bcgov-nr/[email protected].0
uses: bcgov-nr/[email protected].1
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
oc_version: "4.14.37"
file: database/postgresql.dc.yml
overwrite: true
parameters:
Expand All @@ -92,39 +83,59 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Deploy Backend
uses: bcgov-nr/[email protected]
uses: bcgov-nr/[email protected]
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
oc_version: "4.14.37"
file: backend/openshift.deploy.yml
parameters:
-p NAME_SUFFIX=-dev-${{ github.event.number }}
-p ENV_NAME=dev
-p E_LICENSING_URL=${{ vars.E_LICENSING_URL }}
-p DB_REPLICATE=${{ vars.DB_REPLICATE }}
-p DJANGO_DEBUG=${{ vars.DJANGO_DEBUG }}
-p ENABLE_ADDITIONAL_DOCUMENTS=${{ vars.ENABLE_ADDITIONAL_DOCUMENTS }}
-p S3_PRIVATE_BUCKET=${{ vars.S3_PRIVATE_BUCKET }}
-p S3_PRIVATE_HOST=${{ vars.S3_PRIVATE_HOST }}
-p S3_WELL_EXPORT_BUCKET=${{ vars.S3_WELL_EXPORT_BUCKET }}
-p SSO_AUDIENCE=${{ vars.SSO_AUDIENCE }}
-p SSO_AUTH_HOST=${{ vars.SSO_AUTH_HOST }}
-p SSO_CLIENT=${{ vars.SSO_CLIENT }}
-p SSO_IDP_HINT=${{ vars.SSO_IDP_HINT }}
-p SSO_PORT=${{ vars.SSO_PORT }}
-p SSO_PUBKEY=${{ vars.SSO_PUBKEY }}
-p SSO_REALM=${{ vars.SSO_REALM }}
-p SSO_TEST_AUDIENCE=${{ vars.SSO_TEST_AUDIENCE }}
-p SSO_TEST_CLIENT=${{ vars.SSO_TEST_CLIENT }}
-p GDAL_LIBRARY_PATH=${{ vars.GDAL_LIBRARY_PATH }}
-p GEOS_LIBRARY_PATH=${{ vars.GEOS_LIBRARY_PATH }}
-p S3_AQUIFER_BUCKET=${{ vars.S3_AQUIFER_BUCKET }}
-p S3_REGISTRANT_BUCKET=${{ vars.S3_REGISTRANT_BUCKET }}
-p S3_PRIVATE_ROOT_BUCKET=${{ vars.S3_PRIVATE_ROOT_BUCKET }}
-p S3_PRIVATE_AQUIFER_BUCKET=${{ vars.S3_PRIVATE_AQUIFER_BUCKET }}
-p S3_PRIVATE_REGISTRANT_BUCKET=${{ vars.S3_PRIVATE_REGISTRANT_BUCKET }}
-p S3_PRIVATE_WELL_BUCKET=${{ vars.S3_PRIVATE_WELL_BUCKET }}
-p ENABLE_AQUIFERS_SEARCH=${{ vars.ENABLE_AQUIFERS_SEARCH }}
-p EMAIL_NOTIFICATION_RECIPIENT=${{ vars.EMAIL_NOTIFICATION_RECIPIENT }}
-p GEOCODER_ADDRESS_API_BASE=${{ vars.GEOCODER_ADDRESS_API_BASE }}

frontend:
name: Frontend
needs: [ init, database, backend ]
# environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Deploy Frontend
uses: bcgov-nr/[email protected]
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
file: backend/openshift.backend.yml
parameters:
-p NAME_SUFFIX=-dev-${{ github.event.number }}
-p ENV_NAME=dev
-p E_LICENSING_URL=${{ vars.E_LICENSING_URL }}
-p DB_REPLICATE=${{ vars.DB_REPLICATE }}
-p DJANGO_DEBUG=${{ vars.DJANGO_DEBUG }}
-p ENABLE_ADDITIONAL_DOCUMENTS=${{ vars.ENABLE_ADDITIONAL_DOCUMENTS }}
-p S3_PRIVATE_BUCKET=${{ vars.S3_PRIVATE_BUCKET }}
-p S3_PRIVATE_HOST=${{ vars.S3_PRIVATE_HOST }}
-p S3_WELL_EXPORT_BUCKET=${{ vars.S3_WELL_EXPORT_BUCKET }}
-p SSO_AUDIENCE=${{ vars.SSO_AUDIENCE }}
-p SSO_AUTH_HOST=${{ vars.SSO_AUTH_HOST }}
-p SSO_CLIENT=${{ vars.SSO_CLIENT }}
-p SSO_IDP_HINT=${{ vars.SSO_IDP_HINT }}
-p SSO_PORT=${{ vars.SSO_PORT }}
-p SSO_PUBKEY=${{ vars.SSO_PUBKEY }}
-p SSO_REALM=${{ vars.SSO_REALM }}
-p SSO_TEST_AUDIENCE=${{ vars.SSO_TEST_AUDIENCE }}
-p SSO_TEST_CLIENT=${{ vars.SSO_TEST_CLIENT }}
-p GDAL_LIBRARY_PATH=${{ vars.GDAL_LIBRARY_PATH }}
-p GEOS_LIBRARY_PATH=${{ vars.GEOS_LIBRARY_PATH }}
-p S3_AQUIFER_BUCKET=${{ vars.S3_AQUIFER_BUCKET }}
-p S3_REGISTRANT_BUCKET=${{ vars.S3_REGISTRANT_BUCKET }}
-p S3_PRIVATE_ROOT_BUCKET=${{ vars.S3_PRIVATE_ROOT_BUCKET }}
-p S3_PRIVATE_AQUIFER_BUCKET=${{ vars.S3_PRIVATE_AQUIFER_BUCKET }}
-p S3_PRIVATE_REGISTRANT_BUCKET=${{ vars.S3_PRIVATE_REGISTRANT_BUCKET }}
-p S3_PRIVATE_WELL_BUCKET=${{ vars.S3_PRIVATE_WELL_BUCKET }}
-p ENABLE_AQUIFERS_SEARCH=${{ vars.ENABLE_AQUIFERS_SEARCH }}
-p EMAIL_NOTIFICATION_RECIPIENT=${{ vars.EMAIL_NOTIFICATION_RECIPIENT }}
-p GEOCODER_ADDRESS_API_BASE=${{ vars.GEOCODER_ADDRESS_API_BASE }}
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
oc_version: "4.14.30"
file: frontend/openshift.deploy.yml
parameters:
-p NAME_SUFFIX=-dev-${{ github.event.number }}
-p ENV_NAME=dev

146 changes: 73 additions & 73 deletions .github/workflows/.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,81 +20,81 @@ env:
PREFIX: ${{ github.event.repository.name }}-${{ inputs.target }}

jobs:
# integration-tests:
# name: Integration
# runs-on: ubuntu-latest
# timeout-minutes: 1
# steps:
# - uses: actions/checkout@v4
# - id: cache-npm
# uses: actions/cache@v4
# with:
# path: ~/.npm
# key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-cache-node-modules-
# ${{ runner.os }}-build-
# ${{ runner.os }}-
integration-tests:
name: Integration
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- id: cache-npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-cache-node-modules-
${{ runner.os }}-build-
${{ runner.os }}-

# - env:
# API_NAME: nest
# BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}
# run: |
# cd tests/integration
# npm ci
# node src/main.js
- env:
API_NAME: nest
BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}
run: |
cd tests/integration
npm ci
node src/main.js

# e2e-tests:
# name: E2E
# defaults:
# run:
# working-directory: frontend
# runs-on: ubuntu-latest
# timeout-minutes: 5
# strategy:
# matrix:
# project: [ chromium, Google Chrome, firefox, safari, Microsoft Edge ]
# steps:
# - uses: actions/checkout@v4
# name: Checkout
# - uses: actions/setup-node@v4
# name: Setup Node
# with:
# node-version: 20
# cache: 'npm'
# cache-dependency-path: frontend/package-lock.json
# - name: Install dependencies
# run: |
# npm ci
# npx playwright install --with-deps
e2e-tests:
name: E2E
defaults:
run:
working-directory: frontend
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
project: [ chromium, Google Chrome, firefox, safari, Microsoft Edge ]
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-node@v4
name: Setup Node
with:
node-version: 20
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: |
npm ci
npx playwright install --with-deps

# - name: Run Tests
# env:
# E2E_BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}/
# CI: 'true'
# run: |
# npx playwright test --project="${{ matrix.project }}" --reporter=html
- name: Run Tests
env:
E2E_BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}/
CI: 'true'
run: |
npx playwright test --project="${{ matrix.project }}" --reporter=html

# - uses: actions/upload-artifact@v4
# if: ${{ !cancelled() }}
# name: upload results
# with:
# name: playwright-report-${{ matrix.project }}
# path: "./frontend/playwright-report" # path from current folder
# retention-days: 7
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
name: upload results
with:
name: playwright-report-${{ matrix.project }}
path: "./frontend/playwright-report" # path from current folder
retention-days: 7

# load-tests:
# name: Load
# runs-on: ubuntu-latest
# strategy:
# matrix:
# name: [backend, frontend]
# steps:
# - uses: actions/checkout@v4
# - uses: grafana/[email protected]
# env:
# BACKEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/api
# FRONTEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}
# with:
# filename: ./tests/load/${{ matrix.name }}-test.js
# flags: --vus 10 --duration 30s
load-tests:
name: Load
runs-on: ubuntu-latest
strategy:
matrix:
name: [backend, frontend]
steps:
- uses: actions/checkout@v4
- uses: grafana/[email protected]
env:
BACKEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/api
FRONTEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}
with:
filename: ./tests/load/${{ matrix.name }}-test.js
flags: --vus 10 --duration 30s
39 changes: 0 additions & 39 deletions .github/workflows/demo.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ concurrency:
cancel-in-progress: true

jobs:
# # https://github.com/bcgov-nr/action-builder-ghcr
# https://github.com/bcgov-nr/action-builder-ghcr
builds:
name: Builds
runs-on: ubuntu-latest
strategy:
matrix:
package: [database, backend]
package: [database, backend, frontend]
timeout-minutes: 20
steps:
- uses: bcgov-nr/[email protected]
Expand Down
Loading
Loading