Skip to content

Commit

Permalink
Merge pull request #412 from bcgov/dev
Browse files Browse the repository at this point in the history
Merge dev into main
  • Loading branch information
acoard-aot authored Jul 27, 2023
2 parents 5849ef3 + 9d599cf commit ba9f948
Show file tree
Hide file tree
Showing 87 changed files with 98,675 additions and 16,078 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
id_rsa_ff_ee

# Logs
logs
*.log
Expand Down Expand Up @@ -118,3 +120,6 @@ backend/etl/debezium-jdbc/.settings/org.eclipse.core.resources.prefs
backend/etl/debezium-jdbc/.project
backend/etl/debezium-jdbc/.classpath
backend/etl/debezium-jdbc/target/


notes/
1 change: 1 addition & 0 deletions forms-flow-ai/epd-forms/Summary of Site Condition.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions forms-flow-ai/forms-flow-ai-ee/forms-flow-web-root-config/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Base image
FROM node:14.17.6-alpine as build-stage

# Set working directory
WORKDIR /forms-flow-web-root-config/app

# Set build arguments
ARG NODE_ENV
ARG MF_FORMSFLOW_WEB_URL
ARG MF_FORMSFLOW_NAV_URL
ARG MF_FORMSFLOW_SERVICE_URL
ARG MF_FORMSFLOW_ADMIN_URL
ARG MF_FORMSFLOW_THEME_URL
ARG REACT_APP_CUSTOM_LOGOUT_URL
ARG REACT_APP_CUSTOM_MAP_URL
ARG ssh_prv_key
ARG ssh_pub_key

# Set environment variables
ENV MF_FORMSFLOW_WEB_URL ${MF_FORMSFLOW_WEB_URL}
ENV MF_FORMSFLOW_NAV_URL ${MF_FORMSFLOW_NAV_URL}
ENV MF_FORMSFLOW_SERVICE_URL ${MF_FORMSFLOW_SERVICE_URL}
ENV MF_FORMSFLOW_ADMIN_URL ${MF_FORMSFLOW_ADMIN_URL}
ENV MF_FORMSFLOW_THEME_URL ${MF_FORMSFLOW_THEME_URL}
ENV NODE_ENV ${NODE_ENV}
ENV REACT_APP_CUSTOM_LOGOUT_URL ${REACT_APP_CUSTOM_LOGOUT_URL}
ENV REACT_APP_CUSTOM_MAP_URL ${REACT_APP_CUSTOM_MAP_URL}

# Add `/app/node_modules/.bin` to $PATH
ENV PATH /forms-flow-web-root-config/app/node_modules/.bin:$PATH

# Install necessary packages
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh

# Install and cache app dependencies
COPY package-lock.json /forms-flow-web-root-config/app/package-lock.json
COPY package.json /forms-flow-web-root-config/app/package.json
COPY env.sh /forms-flow-web-root-config/app/env.sh
RUN npm ci --only=production

# Copy source code
# COPY . /forms-flow-web-root-config/app/

# Authorize SSH Host
RUN mkdir -p /root/.ssh && \
chmod 0700 /root/.ssh && \
echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config

RUN echo "$ssh_prv_key" | sed 's/\\n/\n/g' > /root/.ssh/id_rsa && \
echo "$ssh_pub_key" | sed 's/\\n/\n/g' > /root/.ssh/id_rsa.pub && \
chmod 600 /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa.pub

RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts

RUN git clone [email protected]:AOT-Technologies/forms-flow-ai-ee.git -b epd-ff-ee-5.2.0 /tmp/forms-flow-ai/

RUN cp -r /tmp/forms-flow-ai/forms-flow-web-root-config/. /forms-flow-web-root-config/app


# Customizations
ARG CUSTOM_SRC_DIR=src
COPY ./ /tmp/${CUSTOM_SRC_DIR}/
RUN cp -R /tmp/${CUSTOM_SRC_DIR}/* /forms-flow-web-root-config/app/ && rm -Rf /tmp/${CUSTOM_SRC_DIR}

ARG CUSTOM_SRC_DIR=public
COPY ./ /tmp/${CUSTOM_SRC_DIR}/
RUN cp -R /tmp/${CUSTOM_SRC_DIR}/* /forms-flow-web-root-config/app/ && rm -Rf /tmp/${CUSTOM_SRC_DIR}/

# Build the application
RUN if [ $NODE_ENV == "development" ]; then \
npm run build-dev:webpack; \
else \
npm run build:webpack; \
fi


# Production stage
FROM nginx:1.25.1-alpine as production-stage

# Set label for image
LABEL Name="formsflow"

# Create directories
RUN mkdir /app
WORKDIR /usr/share/nginx/html/config

# Copy built files from build stage
COPY --from=build-stage /forms-flow-web-root-config/app/dist /usr/share/nginx/html
COPY --from=build-stage /forms-flow-web-root-config/app/env.sh /usr/share/nginx/html/config

# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf

# Expose port
EXPOSE 8080

# Install necessary packages
RUN apk add --no-cache bash

# Set execute permission for env.sh
RUN chmod +x /usr/share/nginx/html/config/env.sh

# Start Nginx server with environment setup
CMD ["/bin/bash", "-c", "nginx -g \"daemon off;\""]
# CMD ["/bin/bash", "-c", "/usr/share/nginx/html/config/env.sh && nginx -g \"daemon off;\""]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
services:
forms-flow-web-root-config:
container_name: forms-flow-web-root-config
build:
context: .
dockerfile: Dockerfile
args:
- MF_FORMSFLOW_WEB_URL=${MF_FORMSFLOW_WEB_URL:-https://forms-flow-microfrontends.aot-technologies.com/[email protected]/forms-flow-web.gz.js}
- MF_FORMSFLOW_NAV_URL=${MF_FORMSFLOW_NAV_URL:-https://forms-flow-microfrontends.aot-technologies.com/[email protected]/forms-flow-nav.gz.js}
- MF_FORMSFLOW_SERVICE_URL=${MF_FORMSFLOW_SERVICE_URL:-https://forms-flow-microfrontends.aot-technologies.com/[email protected]/forms-flow-service.gz.js}
- MF_FORMSFLOW_ADMIN_URL=${MF_FORMSFLOW_ADMIN_URL:-https://forms-flow-microfrontends.aot-technologies.com/[email protected]/forms-flow-admin.gz.js}
- MF_FORMSFLOW_THEME_URL=${MF_FORMSFLOW_THEME_URL:-https://forms-flow-microfrontends.aot-technologies.com/[email protected]/forms-flow-theme.gz.js}
- NODE_ENV=${NODE_ENV:-production}
entrypoint: /bin/sh -c "/usr/share/nginx/html/config/env.sh && nginx -g 'daemon off;'"
environment:
- NODE_ENV=${NODE_ENV:-production}
- REACT_APP_API_SERVER_URL=${FORMIO_DEFAULT_PROJECT_URL}
- REACT_APP_API_PROJECT_URL=${FORMIO_DEFAULT_PROJECT_URL}
- REACT_APP_KEYCLOAK_CLIENT=${KEYCLOAK_WEB_CLIENT_ID:-forms-flow-web}
- REACT_APP_WEB_BASE_URL=${FORMSFLOW_API_URL}
- REACT_APP_BPM_URL=${BPM_API_URL}
- REACT_APP_WEBSOCKET_ENCRYPT_KEY=${WEBSOCKET_ENCRYPT_KEY:-giert989jkwrgb@DR55}
- REACT_APP_KEYCLOAK_URL_REALM=${KEYCLOAK_URL_REALM:-forms-flow-ai}
- REACT_APP_KEYCLOAK_URL=${KEYCLOAK_URL}
- REACT_APP_APPLICATION_NAME=${APPLICATION_NAME:-formsflow.ai}
- REACT_APP_ENABLE_APPLICATION_ACCESS_PERMISSION_CHECK=${ENABLE_APPLICATION_ACCESS_PERMISSION_CHECK:-false}
- REACT_APP_WEB_BASE_CUSTOM_URL=${WEB_BASE_CUSTOM_URL}
- REACT_APP_MULTI_TENANCY_ENABLED=${MULTI_TENANCY_ENABLED:-false}
- REACT_APP_MT_ADMIN_BASE_URL=${MT_ADMIN_BASE_URL}
- REACT_APP_MT_ADMIN_BASE_URL_VERSION=${MT_ADMIN_BASE_URL_VERSION}
- REACT_APP_CUSTOM_SUBMISSION_URL=${CUSTOM_SUBMISSION_URL}
- REACT_APP_CUSTOM_SUBMISSION_ENABLED=${CUSTOM_SUBMISSION_ENABLED:-false}
- REACT_APP_DRAFT_ENABLED=${DRAFT_ENABLED:-false}
- REACT_APP_DRAFT_POLLING_RATE=${DRAFT_POLLING_RATE:-15000}
- REACT_APP_EXPORT_PDF_ENABLED=${EXPORT_PDF_ENABLED:-false}
- REACT_APP_PUBLIC_WORKFLOW_ENABLED=${PUBLIC_WORKFLOW_ENABLED:-false}
- REACT_APP_DOCUMENT_SERVICE_URL=${DOCUMENT_SERVICE_URL}
- REACT_APP_CUSTOM_THEME_URL=${CUSTOM_THEME_URL}
- REACT_APP_CUSTOM_RESOURCE_BUNDLE_URL=${CUSTOM_RESOURCE_BUNDLE_URL}
- REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH=${KEYCLOAK_ENABLE_CLIENT_AUTH:-false}
- REACT_APP_ENABLE_FORMS_MODULE=${ENABLE_FORMS_MODULE:-true}
- REACT_APP_ENABLE_TASKS_MODULE=${ENABLE_TASKS_MODULE:-true}
- REACT_APP_ENABLE_DASHBOARDS_MODULE=${ENABLE_DASHBOARDS_MODULE:-true}
- REACT_APP_ENABLE_PROCESSES_MODULE=${ENABLE_PROCESSES_MODULE:-true}
- REACT_APP_ENABLE_APPLICATIONS_MODULE=${ENABLE_APPLICATIONS_MODULE:-true}
- REACT_APP_CUSTOM_MAP_URL=${EPD_CUSTOM_MAP_URL:-http://localhost:4000/map}
- REACT_APP_CUSTOM_LOGOUT_URL=${EPD_IDP_LOGOUT_URL:-https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://epd-keycloak-dev.apps.silver.devops.gov.bc.ca/auth/realms/forms-flow-ai/protocol/openid-connect/logout?post_logout_redirect_uri=http://localhost:4000}
ports:
- "3000:8080"
tty: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Recreate config file
rm -rf ./config.js
touch ./config.js

envsubst < ./config.template.js > ./config.js;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM8mwzO0j1vTTis0XJ44UGSe+CbsVzcrYDvzzHih+GM0 [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# nginx.conf
worker_processes auto;
error_log /var/log/nginx/error.log;

pid /tmp/nginx.pid;


events {
worker_connections 4096;
}

http {
include /etc/nginx/mime.types;
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
default_type application/octet-stream;
server_tokens off;
underscores_in_headers on;

# Use a w3c standard log format
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;


server {

# add in most common security headers
add_header Content-Security-Policy "default-src * data: blob: filesystem: 'unsafe-inline' 'unsafe-eval'";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection 1;
add_header X-Frame-Options SAMEORIGIN;



listen 8080;
server_name _;

index index.html;
error_log /dev/stdout info;
access_log /dev/stdout;

# forms-flow-web-root-config
location / {
add_header 'Access-Control-Allow-Origin' '*';
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
}
Loading

0 comments on commit ba9f948

Please sign in to comment.