Skip to content

Commit

Permalink
Merge branch 'main' into feature/#1862-uxui-for-ignore-restriction-by…
Browse files Browse the repository at this point in the history
…pass-list
  • Loading branch information
lewischen-aot committed Sep 25, 2024
2 parents 41ce826 + f32a64e commit 76acd2e
Show file tree
Hide file tree
Showing 87 changed files with 7,070 additions and 4,390 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/env-setup-build-forms-server.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Env Setup - Build Forms Server
run-name: Env Setup - Build forms server from ${{ inputs.gitRef }}(form.io tag ${{ inputs.formioTag }})
run-name: Env Setup - Build forms server from ${{ github.ref_name }}(form.io tag ${{ inputs.formioTag }})

on:
workflow_dispatch:
Expand All @@ -8,20 +8,15 @@ on:
description: "Formio tag, please refer https://github.com/formio/formio/tags to deploy the appropriate tag."
type: string
required: true
default: "v2.5.3"
gitRef:
description: "Git Ref"
required: true
default: ""
default: "v4.2.4"

jobs:
build:
name: Build Forms Server
runs-on: ubuntu-latest
env:
FORMIO_SOURCE_REPO_TAG: ${{ inputs.formioTag }}
BUILD_REF: ${{ inputs.formioTag }}
BUILD_NAMESPACE: ${{ vars.BUILD_NAMESPACE }}
FORMIO_SOURCE_REPO_TAG: ${{ inputs.formioTag }}
steps:
- name: Print env
run: |
Expand All @@ -31,7 +26,7 @@ jobs:
- name: Checkout Target Branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.gitRef }}
ref: ${{ github.ref_name }}
# Log in to OpenShift.
- name: Log in to OpenShift
run: |
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/env-setup-deploy-forms-server.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Env Setup - Deploy Forms Server
run-name: Env Setup - Deploy forms server from ${{ inputs.gitRef }}(form.io tag ${{ inputs.formioTag }}) to ${{ inputs.environment }}
run-name: Env Setup - Deploy forms server from ${{ github.ref_name }}(form.io tag ${{ inputs.formioTag }}) to ${{ inputs.environment }}

on:
workflow_dispatch:
Expand All @@ -12,11 +12,7 @@ on:
description: "Formio tag, please refer https://github.com/formio/formio/tags to deploy the appropriate tag."
type: string
required: true
default: "v2.5.3"
gitRef:
description: "Git Ref"
required: true
default: ""
default: "v4.2.4"

jobs:
deploy:
Expand All @@ -26,7 +22,7 @@ jobs:
env:
FORMS_NAME: forms
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
BUILD_REF: ${{ inputs.formioTag }}
FORMIO_SOURCE_REPO_TAG: ${{ inputs.formioTag }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
FORMIO_ROOT_EMAIL: ${{ secrets.FORMS_SA_USER_NAME }}
Expand All @@ -39,13 +35,12 @@ jobs:
- name: Print env
run: |
echo NAMESPACE: $NAMESPACE
echo BRANCH: $BUILD_REF
echo HOST_PREFIX: $HOST_PREFIX
# Checkout the PR branch
- name: Checkout Target Branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.gitRef }}
ref: ${{ github.ref_name }}
# Log in to OpenShift.
- name: Log in to OpenShift
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-deploy-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ env:
TLS_CERTIFICATE: ${{ secrets.TLS_CERTIFICATE }}
TLS_KEY: ${{ secrets.TLS_KEY }}
TLS_CA_CERTIFICATE: ${{ secrets.TLS_CA_CERTIFICATE }}
ALLOW_BETA_USERS_ONLY: ${{ vars.ALLOW_BETA_USERS_ONLY }}

jobs:
# Run DB migrations.
Expand Down
45 changes: 45 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,51 @@
"ENVIRONMENT": "test",
"TZ": "UTC"
}
},
{
"type": "node",
"request": "launch",
"name": "Workflow - Current test file",
"program": "${workspaceFolder}/sources/packages/backend/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--runInBand",
"--config",
"./sources/packages/backend/workflow/test/jest-e2e.json",
"--forceExit"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/sources/packages/backend/node_modules/jest/bin/jest"
},
"env": {
"ENVIRONMENT": "test",
"TZ": "UTC"
}
},
{
"type": "node",
"request": "launch",
"name": "Workflow - all tests",
"program": "${workspaceFolder}/sources/packages/backend/node_modules/.bin/jest",
"args": [
"--runInBand",
"--config",
"./sources/packages/backend/workflow/test/jest-e2e.json",
"--forceExit"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/sources/packages/backend/node_modules/jest/bin/jest"
},
"env": {
"ENVIRONMENT": "test",
"TZ": "UTC"
}
}
]
}
11 changes: 7 additions & 4 deletions configs/env-example
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ S3_DEFAULT_BUCKET=sims-local
S3_REGION=

# Logged Out due to inactivity, wait times in seconds.
MAXIMUM_IDLE_TIME_FOR_WARNING_STUDENT =
MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION =
MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER =
MAXIMUM_IDLE_TIME_FOR_WARNING_AEST =
MAXIMUM_IDLE_TIME_FOR_WARNING_STUDENT =
MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION =
MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER =
MAXIMUM_IDLE_TIME_FOR_WARNING_AEST =

# Allow beta users only to access the system if true.
ALLOW_BETA_USERS_ONLY=
21 changes: 7 additions & 14 deletions devops/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export QUEUE_CONSUMERS_BUILD_REF := $(or ${QUEUE_CONSUMERS_BUILD_REF}, queue-con
export LOAD_TEST_GATEWAY_BUILD_REF := $(or ${LOAD_TEST_GATEWAY_BUILD_REF}, load-test-gateway-${APP_NAME})
export WEB_BUILD_REF := $(or ${WEB_BUILD_REF}, web-${APP_NAME})
export FORMS_BUILD_REF := $(or ${FORMS_BUILD_REF}, forms)
export FORMIO_SOURCE_REPO_TAG := $(or $(FORMIO_SOURCE_REPO_TAG), v4.2.4)
export FORMIO_ROOT_EMAIL := $(or ${FORMIO_ROOT_EMAIL}, [email protected])
export MONGODB_URI := $(or ${MONGODB_URI}, $$MONGODB_URI)
export QUEUE_PREFIX := $(or $(QUEUE_PREFIX), {sims-local})
Expand Down Expand Up @@ -112,18 +113,10 @@ define SOURCE_REPOSITORY_URL
"https://github.com/bcgov/SIMS.git"
endef

define SOURCE_REPOSITORY_REF
"main"
endef

define FORMIO_SOURCE_REPO_URL
"https://github.com/formio/formio.git"
endef

define FORMIO_SOURCE_REPO_TAG
"v2.5.4"
endef

define SOURCE_CONTEXT_DIR
"./sources/packages/"
endef
Expand Down Expand Up @@ -413,6 +406,7 @@ deploy-api:
-p TLS_CERTIFICATE=$(TLS_CERTIFICATE) \
-p TLS_KEY=$(TLS_KEY) \
-p TLS_CA_CERTIFICATE=$(TLS_CA_CERTIFICATE) \
-p ALLOW_BETA_USERS_ONLY=$(ALLOW_BETA_USERS_ONLY) \
| oc -n $(NAMESPACE) apply -f -
$(call rollout_and_wait,dc/$(API))

Expand Down Expand Up @@ -533,27 +527,26 @@ build-forms:
test -n "$(BUILD_REF)"
test -n "$(SOURCE_CONTEXT_DIR)"
test -n "$(SOURCE_REPOSITORY_URL)"
test -n "$(SOURCE_REPOSITORY_REF)"
test -n "$(FORMIO_SOURCE_REPO_URL)"
test -n "$(FORMIO_SOURCE_REPO_TAG)"
@echo "+\n++ BUILDING $(FORMS_BUILD_REF) DIR: $(SOURCE_CONTEXT_DIR)forms BUILD_TAG:$(BUILD_REF)\n+"
@oc -n $(BUILD_NAMESPACE) process -f openshift/forms-build.yml -p NAME=$(FORMS_BUILD_REF) -p TAG=$(BUILD_REF) -p FORMIO_SOURCE_REPO_URL=$(FORMIO_SOURCE_REPO_URL) -p FORMIO_SOURCE_REPO_TAG=$(FORMIO_SOURCE_REPO_TAG) -p SOURCE_REPOSITORY_URL=$(SOURCE_REPOSITORY_URL) -p SOURCE_REPOSITORY_REF=$(SOURCE_REPOSITORY_REF) -p SOURCE_CONTEXT_DIR=$(SOURCE_CONTEXT_DIR)forms| oc -n $(BUILD_NAMESPACE) apply -f -
@echo "+\n++ BUILDING $(FORMS_BUILD_REF) DIR: $(SOURCE_CONTEXT_DIR)forms BUILD_TAG:$(FORMIO_SOURCE_REPO_TAG)\n+"
@oc -n $(BUILD_NAMESPACE) process -f openshift/forms-build.yml -p NAME=$(FORMS_BUILD_REF) -p TAG=$(FORMIO_SOURCE_REPO_TAG) -p FORMIO_SOURCE_REPO_URL=$(FORMIO_SOURCE_REPO_URL) -p FORMIO_SOURCE_REPO_TAG=$(FORMIO_SOURCE_REPO_TAG) -p SOURCE_REPOSITORY_URL=$(SOURCE_REPOSITORY_URL) -p SOURCE_REPOSITORY_REF=$(BUILD_REF) -p SOURCE_CONTEXT_DIR=$(SOURCE_CONTEXT_DIR)forms| oc -n $(BUILD_NAMESPACE) apply -f -
@oc -n $(BUILD_NAMESPACE) start-build bc/$(FORMS_BUILD_REF) --wait

deploy-forms:
test -n "$(NAMESPACE)"
test -n "$(FORMS_NAME)"
test -n "$(FORMS_URL)"
test -n "$(BUILD_NAMESPACE)"
test -n "$(BUILD_REF)"
test -n "$(FORMIO_SOURCE_REPO_TAG)"
test -n "$(FORMIO_ROOT_EMAIL)"
test -n "$(MONGODB_URI)"
@echo "+\n++ Deploying forms with tag: $(BUILD_REF)\n+"
@echo "+\n++ Deploying forms with tag: $(FORMIO_SOURCE_REPO_TAG)\n+"
@oc -n $(NAMESPACE) process -f openshift/forms-deploy.yml \
-p NAME=$(FORMS_NAME) \
-p FORMS_URL=$(FORMS_URL) \
-p TOOLS_NAMESPACE=$(BUILD_NAMESPACE) \
-p IMAGE_STREAM_TAG="$(FORMS_BUILD_REF):$(BUILD_REF)" \
-p IMAGE_STREAM_TAG="$(FORMS_BUILD_REF):$(FORMIO_SOURCE_REPO_TAG)" \
-p FORMIO_ROOT_EMAIL=$(FORMIO_ROOT_EMAIL) \
-p FORMIO_ROOT_PASSWORD=$(FORMIO_ROOT_PASSWORD) \
-p MONGODB_URI=$(MONGODB_URI) \
Expand Down
4 changes: 4 additions & 0 deletions devops/openshift/api-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ objects:
value: "${MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION}"
- name: MAXIMUM_IDLE_TIME_FOR_WARNING_AEST
value: "${MAXIMUM_IDLE_TIME_FOR_WARNING_AEST}"
- name: ALLOW_BETA_USERS_ONLY
value: "${ALLOW_BETA_USERS_ONLY}"
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -490,3 +492,5 @@ parameters:
required: true
- name: TLS_CA_CERTIFICATE
required: true
- name: ALLOW_BETA_USERS_ONLY
required: true
26 changes: 10 additions & 16 deletions sources/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export SWAGGER_ENABLED := $(or ${SWAGGER_ENABLED}, true)
export APPLICATION_ARCHIVE_DAYS := $(or ${APPLICATION_ARCHIVE_DAYS}, 43)
#Formio forms integration
export FORMIO_SOURCE_REPO_URL := $(or ${FORMIO_SOURCE_REPO_URL}, https://github.com/formio/formio.git)
export FORMIO_SOURCE_REPO_TAG := $(or ${FORMIO_SOURCE_REPO_TAG}, v2.5.3)
export FORMIO_SOURCE_REPO_TAG := $(or ${FORMIO_SOURCE_REPO_TAG}, v4.2.4)
#ATBC Integration
export ATBC_USERNAME := $(or $(ATBC_USERNAME), )
export ATBC_PASSWORD := $(or $(ATBC_PASSWORD), )
Expand Down Expand Up @@ -85,14 +85,17 @@ export MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER := $(or $(MAXIMUM_IDLE_TIM
export MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION := $(or $(MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION), 3600)
export MAXIMUM_IDLE_TIME_FOR_WARNING_AEST := $(or $(MAXIMUM_IDLE_TIME_FOR_WARNING_AEST), 3600)

# Allow beta users only to access the system if true.
export ALLOW_BETA_USERS_ONLY := $(or $(ALLOW_BETA_USERS_ONLY), false)

# Starts all applications: SIMS application (Web Portals, SIMS Api, Workers, Queue Consumers),
# and also Form.io server, and Camunda releated services.
# Use make deploy-camunda-definitions to deploy all workflow definitions.
# Use make deploy-form-definitions to deploy all form.io definitions.
local-all: | print-status forms camunda local-build-run

local: | print-status local-build-run
local-api: | print-status local-build api-only
local-api: | print-status local-build api
db: | print-status postgres
local-redis: | print-status redis

Expand Down Expand Up @@ -160,32 +163,23 @@ local-clean:
# Local DB
postgres:
@echo "+\n++ Make: Run local db.\n+"
@docker compose -f docker-compose.yml up postgres
@docker compose -f docker-compose.yml up -d postgres

# Local Queue
redis:
@echo "+\n++ Make: Run local queue.\n+"
@docker compose -f docker-compose.yml up redis

# Local API only
api-only:
api:
@echo "+\n++ Make: Building and running API only"
@docker compose -f docker-compose.yml up api

# Local App
api: ## <Helper> :: Executes into the workspace container.
@echo "+\n++Shelling into local workspace ...++\n+"
@docker compose exec api bash
@docker compose -f docker-compose.yml up --build -d api

# Local Web (nginx)
web-local:
web:
@echo "+\n++ Make: Run local web (nginx).\n+"
@docker compose -f docker-compose.yml up --build -d web

local-db:
@echo "Make: Shelling into database workspace ..."
@docker compose -f docker-compose.yml exec postgres psql -U $(POSTGRESQL_USER) -W $(POSTGRES_DB)

# Build and run Camunda locally.
camunda:
@echo "Create Camunda locally (Zeebe, Operate, Tasklist, and Elasticsearch)..."
Expand Down Expand Up @@ -243,7 +237,7 @@ workers:
@docker compose -f docker-compose.yml build workers
@docker compose -f docker-compose.yml up -d workers

# Enable local DB connection to Openshift DEV/TEST/QA/STG/PROD
# Enable local DB connection to Openshift DEV/TEST/STG/PROD
connect-dev-db:
@echo "Forward local port 5454 to Openshift simsdb-pgbouncer default port."
@echo "Use your prefered DB Manager (e.g. pgAdmin or DBeaver) to connect to the Postgres database using the local port 5454."
Expand Down
1 change: 1 addition & 0 deletions sources/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ services:
- MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER=${MAXIMUM_IDLE_TIME_FOR_WARNING_SUPPORTING_USER}
- MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION=${MAXIMUM_IDLE_TIME_FOR_WARNING_INSTITUTION}
- MAXIMUM_IDLE_TIME_FOR_WARNING_AEST=${MAXIMUM_IDLE_TIME_FOR_WARNING_AEST}
- ALLOW_BETA_USERS_ONLY=${ALLOW_BETA_USERS_ONLY}
ports:
- ${API_PORT}:${API_PORT}
volumes:
Expand Down
9 changes: 4 additions & 5 deletions sources/forms-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.7'
services:
mongo:
image: mongo:4.1
Expand All @@ -10,7 +9,7 @@ services:
MONGO_INITDB_ROOT_PASSWORD:
networks:
- local-network

formio:
build:
context: ./packages/forms
Expand All @@ -34,13 +33,13 @@ services:
NODE_CONFIG: '{"mongo": "mongodb://mongo:27017/formio"}'
ROOT_EMAIL: [email protected]
ROOT_PASSWORD: CHANGEME
stdin_open: true # -i
tty: true # -t
stdin_open: true # -i
tty: true # -t

# Networks
networks:
local-network:
driver: bridge

volumes:
mdb-data:
mdb-data:
Loading

0 comments on commit 76acd2e

Please sign in to comment.