Skip to content

Commit

Permalink
Merge pull request #140 from shuhaib-aot/integration
Browse files Browse the repository at this point in the history
forms-flow-integration services added with templated structure | Workato whitelabelled menu in formsflow
  • Loading branch information
shuhaib-aot authored Feb 6, 2024
2 parents 5e152ac + 02cc3ab commit 0a7c932
Show file tree
Hide file tree
Showing 41 changed files with 25,445 additions and 5 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/forms-flow-integration-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: forms-flow-integration-CD
on:
workflow_dispatch:
push:
branches:
- main
- develop
- release/*
paths:
- "forms-flow-integration/**"
- "VERSION"
defaults:
run:
shell: bash
jobs:
build:
name: Build and push artifacts to s3
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.17.0'
- name: Set version
if: ${{ github.ref != 'refs/heads/main' }}
working-directory: .
run: |
VER=$(cat VERSION)
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Set version
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: .
run: |
VER=$(cat VERSION)
VER=${VER/-alpha/''}
echo "VERSION=$VER" >> $GITHUB_ENV
#TODO: force installing due to dependency conflict need to resolve the dependency
- run: npm ci --force
working-directory: ./forms-flow-integration
- run: npm run build:webpack
working-directory: ./forms-flow-integration
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.REGION }}
- run: npm ci
working-directory: ./scripts
- run: node index forms-flow-integration
env:
BUCKET: ${{ secrets.BUCKET}}
VERSION: ${{ env.VERSION }}
working-directory: ./scripts
8 changes: 8 additions & 0 deletions forms-flow-integration/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"ts-react-important-stuff",
"plugin:prettier/recommended"
],
"parser": "@babel/eslint-parser",
"requireConfigFile": false
}
8 changes: 8 additions & 0 deletions forms-flow-integration/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.gitignore
.prettierignore
yarn.lock
yarn-error.log
package-lock.json
dist
coverage
pnpm-lock.yaml
41 changes: 41 additions & 0 deletions forms-flow-integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# base image
FROM node:16.20.1-alpine as build-stage

# set working directory
WORKDIR /forms-flow-integration/app


# add `/app/node_modules/.bin` to $PATH
ENV PATH /forms-flow-integration/app/node_modules/.bin:$PATH

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh

# install and cache app dependencies

COPY package-lock.json /forms-flow-integration/app/package-lock.json
COPY package.json /forms-flow-integration/app/package.json

RUN npm install

COPY . /forms-flow-integration/app/

RUN npm run build:webpack


FROM nginx:1.15.2-alpine as production-stage

# set label for image
LABEL Name="formsflow"

RUN mkdir /app
COPY --from=build-stage /forms-flow-integration/app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 8080
WORKDIR /usr/share/nginx/html/config
# COPY .env .
RUN apk add --no-cache bash


CMD ["nginx", "-g", "daemon off;"]
30 changes: 30 additions & 0 deletions forms-flow-integration/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"presets": [
"@babel/preset-env",
[
"@babel/preset-react",
{
"runtime": "automatic"
}
],
"@babel/preset-typescript"
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"useESModules": true,
"regenerator": false
}
]
],
"env": {
"test": {
"presets": [
["@babel/preset-env", {
"targets": "current node"
}]
]
}
}
}
9 changes: 9 additions & 0 deletions forms-flow-integration/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
forms-flow-integration:
container_name: forms-flow-integration
build:
context: .
dockerfile: Dockerfile
ports:
- "3009:8080"
tty: true
12 changes: 12 additions & 0 deletions forms-flow-integration/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
rootDir: "src",
testEnvironment: "jsdom",
transform: {
"^.+\\.(j|t)sx?$": "babel-jest",
},
moduleNameMapper: {
"\\.(css)$": "identity-obj-proxy",
"single-spa-react/parcel": "single-spa-react/lib/cjs/parcel.cjs",
},
setupFilesAfterEnv: ["@testing-library/jest-dom"],
};
63 changes: 63 additions & 0 deletions forms-flow-integration/nginx.conf
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;

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 0a7c932

Please sign in to comment.