Skip to content

Commit

Permalink
Merge pull request #510 from bcgov/feat/task-228
Browse files Browse the repository at this point in the history
Feat/task 228
  • Loading branch information
nikhila-aot authored Sep 15, 2023
2 parents e638604 + b1b7e01 commit c4c8236
Show file tree
Hide file tree
Showing 22 changed files with 804 additions and 1 deletion.
83 changes: 83 additions & 0 deletions .github/workflows/cd-forms-flow-bpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: forms-flow-bpm Custom

on:
workflow_dispatch:
inputs:
START_BUILD:
required: true
type: boolean
description: This value is ignored, just to trigger dispatch.
push:
branches:
- dev
- main
- feat/task-228 # Remove in future, just to verify this works
paths:
- "forms-flow-ai/forms-flow-ai-ee/forms-flow-bpm"
- ".github/workflows/cd-forms-flow-bpm.yaml"

defaults:
run:
shell: bash
working-directory: ./forms-flow-ai/forms-flow-ai-ee/forms-flow-bpm
env:
APP_NAME: "forms-flow-bpm"

jobs:
forms-flow-ai-bpm-cd-by-push:
runs-on: ubuntu-20.04

if: github.repository == 'bcgov/nr-epd-digital-services'
steps:
- uses: actions/checkout@v2
- name: Set ENV variables
id: set-variable
# make sure to update the TOOLS_NAME once all the environment for forms-flow-ai-web is ready
run: |
if [ '${{ github.ref_name }}' == 'dev' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OC_NAMESPACE_NAMEPLATE}}" >> $GITHUB_ENV
echo "TAG_NAME="dev"" >> $GITHUB_ENV
echo "BRANCH_NAME="dev"" >> $GITHUB_ENV
echo "ENV_NAME="dev"" >> $GITHUB_ENV
elif [ '${{ github.ref_name }}' == 'main' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OC_NAMESPACE_NAMEPLATE}}" >> $GITHUB_ENV
echo "TAG_NAME="test"" >> $GITHUB_ENV
echo "BRANCH_NAME="main"" >> $GITHUB_ENV
echo "ENV_NAME="test"" >> $GITHUB_ENV
else
echo "For ${{ github.ref_name }} branch, defaulting to dev values"
echo "TOOLS_NAME=${{secrets.OC_NAMESPACE_NAMEPLATE}}" >> $GITHUB_ENV
echo "TAG_NAME="dev"" >> $GITHUB_ENV
echo "BRANCH_NAME="dev"" >> $GITHUB_ENV
fi
shell: bash

- name: Login Openshift
shell: bash
run: |
oc login --server=${{secrets.OC_SERVER}} --token=${{secrets.OC_TOKEN}}
- name: Tools project
shell: bash
run: |
oc project ${{ secrets.OC_NAMESPACE_NAMEPLATE }}-tools
# Build from either dev or main branch as appropriate
- name: Build from ${{ env.BRANCH_NAME }} branch
shell: bash
run: |
oc patch bc/${{ env.APP_NAME }}-build -p '{"spec":{"source":{"git":{"ref":"${{ env.BRANCH_NAME }}"}}}}'
- name: Start Build Openshift
shell: bash
run: |
oc start-build ${{ env.APP_NAME }}-build --wait
- name: Tag+Deploy for ${{ env.TAG_NAME }}
shell: bash
run: |
oc tag ${{ env.APP_NAME }}:latest ${{ env.APP_NAME }}:${{ env.TAG_NAME }}
3 changes: 2 additions & 1 deletion .github/workflows/cd-openshift-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
# message: "Release version ${{ inputs.RELEASE_VERSION }}"


forms-flow-root-config-and-microfrontends:
forms-flow-root-config-and-microfrontends-bpm-changes:
runs-on: ubuntu-20.04

if: github.repository == 'bcgov/nr-epd-digital-services'
Expand Down Expand Up @@ -146,6 +146,7 @@ jobs:
oc tag forms-flow-nav:test forms-flow-nav:prod
oc tag forms-flow-theme:test forms-flow-theme:prod
oc tag forms-flow-web-ee:test forms-flow-web-ee:prod
oc tag forms-flow-bpm:test forms-flow-bpm:prod
- name: Start Build Openshift
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/cd-openshift-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,44 @@ jobs:
overwrite: ${{ matrix.overwrite }}
template_file: ${{ matrix.template_file }}
template_vars: ${{ matrix.template_vars }}

forms-flow-root-config-and-microfrontends-bpm-changes:
runs-on: ubuntu-20.04

if: github.repository == 'bcgov/nr-epd-digital-services'
steps:
- uses: actions/checkout@v2
- name: Set ENV variables
id: set-variable
# make sure to update the TOOLS_NAME once all the environment for forms-flow-ai-web is ready
run: |
echo "For ${{ github.ref_name }} branch for TEST"
echo "TOOLS_NAME=${{secrets.OC_NAMESPACE_NAMEPLATE}}" >> $GITHUB_ENV
echo "TAG_NAME="test"" >> $GITHUB_ENV
echo "BRANCH_NAME="main"" >> $GITHUB_ENV
echo "ENV_NAME="test"" >> $GITHUB_ENV
shell: bash

- name: Login Openshift
shell: bash
run: |
oc login --server=${{secrets.OC_SERVER}} --token=${{secrets.OC_TOKEN}}
- name: Tools project
shell: bash
run: |
oc project ${{ secrets.OC_NAMESPACE_NAMEPLATE }}-tools
- name: Tag Microfrontends from Dev
shell: bash
run: |
oc tag forms-flow-nav:dev forms-flow-nav:test
oc tag forms-flow-theme:dev forms-flow-theme:test
oc tag forms-flow-web-ee:dev forms-flow-web-ee:test
oc tag forms-flow-bpm:dev forms-flow-bpm:test

- name: Start Build Openshift
shell: bash
run: |
oc start-build ${{ env.APP_NAME }}-prod-build --wait
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-openshift-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- 'dev'
- 'feat/task-228' #test1

paths:
- 'backend/**'
Expand Down
51 changes: 51 additions & 0 deletions forms-flow-ai/forms-flow-ai-ee/forms-flow-bpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Modified by Yichun Zhao and Walter Moar


# Maven build
FROM maven:3.8.1-openjdk-17-slim AS MAVEN_TOOL_CHAIN
RUN apt-get update \
&& apt-get install -y git

# expect a build-time variable
ARG FORMFLOW_SOURCE_REPO_BRANCH
# use the value to set the ENV var default
ENV FORMFLOW_SOURCE_REPO_BRANCH v5.1.0
# expect a build-time variable
ARG FORMFLOW_SOURCE_REPO_URL
# use the value to set the ENV var default
ENV FORMFLOW_SOURCE_REPO_URL https://github.com/AOT-Technologies/forms-flow-ai

# Clone code
RUN git clone -b ${FORMFLOW_SOURCE_REPO_BRANCH} ${FORMFLOW_SOURCE_REPO_URL} /bpm/

RUN cp /bpm/forms-flow-bpm/pom*.xml /tmp/
RUN cp /bpm/forms-flow-bpm/settings-docker.xml /usr/share/maven/ref/
#RUN cp -r /tmp/forms-flow-ai/forms-flow-bpm/. /forms-flow-bpm/
WORKDIR /tmp/
# This allows Docker to cache most of the maven dependencies
RUN mvn -s /usr/share/maven/ref/settings-docker.xml dependency:resolve-plugins dependency:resolve dependency:go-offline -B
RUN cp -r /bpm/forms-flow-bpm/src/ /tmp/src/

#Copy custom files for EPD
COPY ./templates /tmp/src/main/resources/templates
COPY ./processes /tmp/src/main/resources/processes

RUN mvn -s /usr/share/maven/ref/settings-docker.xml package -P default

# Final custom slim java image (for apk command see 17-jdk-alpine-slim)
FROM openjdk:17-jdk-alpine

ENV JAVA_VERSION=17-ea+14
ENV JAVA_HOME=/opt/java/openjdk-17\
PATH="/opt/java/openjdk-17/bin:$PATH"

EXPOSE 8080
# OpenShift has /app in the image, but it's missing when doing local development - Create it when missing
RUN test ! -d /app && mkdir /app || :
# Add spring boot application
RUN mkdir -p /app
COPY --from=MAVEN_TOOL_CHAIN /tmp/target/forms-flow-bpm.jar ./app
RUN chmod a+rwx -R /app
WORKDIR /app
VOLUME /tmp
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom", "-Dpolyglot.js.nashorn-compat=true", "-Dpolyglot.engine.WarnInterpreterOnly=false", "-jar","/app/forms-flow-bpm.jar"]
89 changes: 89 additions & 0 deletions forms-flow-ai/forms-flow-ai-ee/forms-flow-bpm/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Author: Yichun Zhao
version: "3.7"
services:
forms-flow-bpm-db:
image: postgres:latest
environment:
POSTGRES_USER: ${CAMUNDA_JDBC_USER:-admin}
POSTGRES_PASSWORD: ${CAMUNDA_JDBC_PASSWORD:-changeme}
POSTGRES_DB: ${CAMUNDA_JDBC_DB_NAME:-formsflow-bpm}
volumes:
- ./postgres/camunda:/var/lib/postgresql/data
ports:
- '5432:5432'
restart: unless-stopped
networks:
- forms-flow-bpm-network

forms-flow-bpm:
build:
context: ./
dockerfile: Dockerfile
restart: always
links:
- forms-flow-bpm-db
ports:
- '8000:8080'
environment:
- KEYCLOAK_URL=${KEYCLOAK_URL}
- KEYCLOAK_URL_REALM=${KEYCLOAK_URL_REALM:-forms-flow-ai}
- KEYCLOAK_CLIENTID=${KEYCLOAK_BPM_CLIENT_ID:-forms-flow-bpm}
- KEYCLOAK_CLIENTSECRET=${KEYCLOAK_BPM_CLIENT_SECRET:-e4bdbd25-1467-4f7f-b993-bc4b1944c943}
- CAMUNDA_JDBC_URL=${CAMUNDA_JDBC_URL:-jdbc:postgresql://forms-flow-bpm-db:5432/formsflow-bpm}
- CAMUNDA_JDBC_USER=${CAMUNDA_JDBC_USER:-admin}
- CAMUNDA_JDBC_PASSWORD=${CAMUNDA_JDBC_PASSWORD:-changeme}
- CAMUNDA_JDBC_DRIVER=${CAMUNDA_JDBC_DRIVER:-org.postgresql.Driver}
# - CAMUNDA_HIKARI_CONN_TIMEOUT=${CAMUNDA_HIKARI_CONN_TIMEOUT}
# - CAMUNDA_HIKARI_IDLE_TIMEOUT=${CAMUNDA_HIKARI_IDLE_TIMEOUT}
# - CAMUNDA_HIKARI_MAX_POOLSIZE=${CAMUNDA_HIKARI_MAX_POOLSIZE}
# - CAMUNDA_HIKARI_VALID_TIMEOUT=${CAMUNDA_HIKARI_VALID_TIMEOUT}
# - CAMUNDA_BPM_HISTORY_LEVEL=${CAMUNDA_BPM_HISTORY_LEVEL}
# - CAMUNDA_AUTHORIZATION_FLAG=${CAMUNDA_AUTHORIZATION_FLAG}
# - CAMUNDA_AUTHORIZATION_REVOKE_CHECK_FLAG=${CAMUNDA_AUTHORIZATION_REVOKE_CHECK_FLAG}
# - CAMUNDA_JOB_CORE_POOL_SIZE=${CAMUNDA_JOB_CORE_POOL_SIZE}
# - CAMUNDA_JOB_LOCK_TIME_MILLIS=${CAMUNDA_JOB_LOCK_TIME_MILLIS}
# - CAMUNDA_JOB_MAXJOBS_PER_ACQUISITION=${CAMUNDA_JOB_MAXJOBS_PER_ACQUISITION}
# - CAMUNDA_JOB_MAX_POOL_SIZE=${CAMUNDA_JOB_MAX_POOL_SIZE}
# - CAMUNDA_JOB_QUEUE_SIZE=${CAMUNDA_JOB_QUEUE_SIZE}
# - CAMUNDA_JOB_WAIT_TIME_MILLIS=${CAMUNDA_JOB_WAIT_TIME_MILLIS}
# - CAMUNDA_JOB_MAX_WAIT=${CAMUNDA_JOB_MAX_WAIT}
# - CAMUNDA_METRICS_FLAG=${CAMUNDA_METRICS_FLAG}
- CAMUNDA_APP_ROOT_LOG_FLAG=${CAMUNDA_APP_ROOT_LOG_FLAG:-error}
- FORMSFLOW_API_URL=${FORMSFLOW_API_URL}
- FORMIO_URL=${FORMIO_DEFAULT_PROJECT_URL}
- FORMIO_ROOT_EMAIL=${FORMIO_ROOT_EMAIL:[email protected]}
- FORMIO_ROOT_PASSWORD=${FORMIO_ROOT_PASSWORD:-changeme}
- APP_SECURITY_ORIGIN=${APP_SECURITY_ORIGIN:-*}
- WEBSOCKET_SECURITY_ORIGIN=${WEBSOCKET_SECURITY_ORIGIN}
- WEBSOCKET_MESSAGE_TYPE=${WEBSOCKET_MESSAGE_TYPE:-TASK_EVENT}
- WEBSOCKET_ENCRYPT_KEY=${WEBSOCKET_ENCRYPT_KEY:-giert989jkwrgb@DR55}
- DATA_BUFFER_SIZE=${DATA_BUFFER_SIZE:-2}
- IDENTITY_PROVIDER_MAX_RESULT_SIZE=${IDENTITY_PROVIDER_MAX_RESULT_SIZE:-250}
- KEYCLOAK_WEB_CLIENTID=${KEYCLOAK_WEB_CLIENTID:-}
- KEYCLOAK_ENABLE_CLIENT_AUTH=${KEYCLOAK_ENABLE_CLIENT_AUTH:-false}
- BPM_CLIENT_CONN_TIMEOUT=${BPM_CLIENT_CONN_TIMEOUT:-5000}
- DATA_ANALYSIS_URL=${DATA_ANALYSIS_URL}
- CUSTOM_SUBMISSION_URL=${CUSTOM_SUBMISSION_URL}
- CUSTOM_SUBMISSION_ENABLED=${CUSTOM_SUBMISSION_ENABLED:-false}
- MULTI_TENANCY_ENABLED=${MULTI_TENANCY_ENABLED:-false}
- FORMSFLOW_ADMIN_URL=${FORMSFLOW_ADMIN_URL:-}
- REDIS_ENABLED=${REDIS_ENABLED:-false}
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT:-6379}
- REDIS_PASSCODE=${REDIS_PASSCODE:-changeme}
- SESSION_COOKIE_SECURE=${SESSION_COOKIE_SECURE:-false}
- CHES_CLIENT_ID=CDACC9DF-68BE85E6452
- CHES_SECRET=56b613b2-fbf8-481a-b464-38967c66e066
- CHES_AUTH_URL=https://dev.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token
- CHES_HOST_URL=https://ches-dev.api.gov.bc.ca

networks:
- forms-flow-bpm-network


networks:
forms-flow-bpm-network:
driver: "bridge"

volumes:
postgres:
Loading

0 comments on commit c4c8236

Please sign in to comment.