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

export bundle pdf changes from FF #716

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
91 changes: 91 additions & 0 deletions forms-flow-ai/forms-flow-ai-ee/forms-flow-documents/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#Author: Kurian Benoy
FROM python:3.9-slim-buster

# set label for image
LABEL Name="formsflow"

WORKDIR /forms-flow-documents/app

# install curl, gnupg2 and unzip
RUN apt-get update \
&& apt-get install -y gnupg2 \
&& apt-get install -y curl \
&& apt-get install -y wget \
&& apt-get install -y unzip \
&& apt-get install -y git \
&& rm -rf /var/lib/apt/lists/*

# expect a build-time variable
ARG FORMFLOW_SOURCE_REPO_URL
# expect ssh private key
ARG ssh_prv_key
# expect ssh public key
ARG ssh_pub_key
# expect a build-time variable
ARG FORMFLOW_SOURCE_REPO_BRANCH
# use the value to set the ENV var default
ENV FORMFLOW_SOURCE_REPO_BRANCH epd-ff-ee-5.2.0
# use the value to set the ENV var default
ENV FORMFLOW_SOURCE_REPO_URL git@github.com:AOT-Technologies/forms-flow-ai-ee.git

#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

COPY id_rsa_epd /root/.ssh/id_rsa
COPY id_rsa_epd.pub /root/.ssh/id_rsa.pub

RUN chmod 600 /root/.ssh/id_rsa

RUN chmod 600 /root/.ssh/id_rsa.pub

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

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

RUN cp -r /documents/forms-flow-documents/. /forms-flow-documents/app

#Copy custom files for EPD
COPY ./src/formsflow_documents/resources /forms-flow-documents/app/src/formsflow_documents/resources
COPY ./src/formsflow_documents/services /forms-flow-documents/app/src/formsflow_documents/services
COPY ./src/formsflow_documents/static /forms-flow-documents/app/src/formsflow_documents/static
COPY ./src/formsflow_documents /forms-flow-documents/app/src/formsflow_documents

# Install Chrome WebDriver - version 116.0.5845.96
RUN mkdir -p /opt/chromedriver && \
curl -sS -o /tmp/chromedriver_linux64.zip https://formsflow-documentsapi.aot-technologies.com/chromedriver-linux64.zip && \
unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver && \
rm /tmp/chromedriver_linux64.zip && \
chmod +x /opt/chromedriver/chromedriver-linux64/chromedriver && \
ln -fs /opt/chromedriver/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver

# Install Google Chrome
RUN wget --no-verbose -O /tmp/chrome.deb https://formsflow-documentsapi.aot-technologies.com/google-chrome-stable_116.0.5845.140-1_amd64.deb &&\
apt-get update && \
apt install -y /tmp/chrome.deb &&\
rm /tmp/chrome.deb


# set display port to avoid crash
ENV DISPLAY=:99

COPY requirements.txt .
ENV PATH=/venv/bin:$PATH

RUN : \
&& python3 -m venv /venv \
&& pip install --upgrade pip \
&& pip install -r requirements.txt

ADD . /forms-flow-documents/app
RUN pip install -e .

EXPOSE 5006
RUN chmod u+x ./entrypoint
ENTRYPOINT ["/bin/sh", "entrypoint"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3.7'

services:
forms-flow-documents-api:
build:
context: ./
dockerfile: Dockerfile
restart: unless-stopped
ports:
- '5006:5006'
volumes:
- ./:/app:rw
environment:
DATABASE_URL: ${FORMSFLOW_API_DB_URL:-postgresql://postgres:changeme@forms-flow-webapi-db:5432/webapi}
FORMSFLOW_API_CORS_ORIGINS: ${FORMSFLOW_API_CORS_ORIGINS:-*}
JWT_OIDC_WELL_KNOWN_CONFIG: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM:-forms-flow-ai}/.well-known/openid-configuration
JWT_OIDC_JWKS_URI: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM:-forms-flow-ai}/protocol/openid-connect/certs
JWT_OIDC_ISSUER: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM:-forms-flow-ai}
JWT_OIDC_AUDIENCE: ${KEYCLOAK_WEB_CLIENT_ID:-forms-flow-web}
JWT_OIDC_CACHING_ENABLED: 'True'
KEYCLOAK_URL: ${KEYCLOAK_URL}
KEYCLOAK_URL_REALM: ${KEYCLOAK_URL_REALM:-forms-flow-ai}
FORMSFLOW_API_URL: ${FORMSFLOW_API_URL}
FORMSFLOW_DOC_API_URL: ${FORMSFLOW_DOC_API_URL}
FORMIO_URL: ${FORMIO_DEFAULT_PROJECT_URL}
FORMIO_ROOT_EMAIL: ${FORMIO_ROOT_EMAIL:-admin@example.com}
FORMIO_ROOT_PASSWORD: ${FORMIO_ROOT_PASSWORD:-changeme}
CHROME_DRIVER_PATH: ${CHROME_DRIVER_PATH}
CUSTOM_SUBMISSION_URL: ${CUSTOM_SUBMISSION_URL}
CUSTOM_SUBMISSION_ENABLED: ${CUSTOM_SUBMISSION_ENABLED}
FORMIO_JWT_SECRET: ${FORMIO_JWT_SECRET:---- change me now ---}
MULTI_TENANCY_ENABLED: ${MULTI_TENANCY_ENABLED:-false}
KEYCLOAK_ENABLE_CLIENT_AUTH: ${KEYCLOAK_ENABLE_CLIENT_AUTH:-false}
stdin_open: true # -i
tty: true # -t
networks:
- forms-flow-webapi-network

networks:
forms-flow-webapi-network:
driver: 'bridge'

volumes:
mdb-data:
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
gunicorn -b :5006 'formsflow_documents:create_app()' --timeout 120 --worker-class=gthread --workers=5 --threads=10
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Brotli==1.0.9
Flask-Caching==2.0.2
Flask-Migrate==4.0.4
Flask-Moment==1.0.5
Flask-SQLAlchemy==3.0.5
Flask==2.3.2
Jinja2==3.1.2
Mako==1.2.4
MarkupSafe==2.1.3
PyJWT==2.7.0
PySocks==1.7.1
SQLAlchemy-Utils==0.41.1
SQLAlchemy==2.0.17
Werkzeug==2.3.6
alembic==1.11.1
aniso8601==9.0.1
async-generator==1.10
attrs==23.1.0
blinker==1.6.2
cachelib==0.9.0
certifi==2023.5.7
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
cryptography==41.0.1
ecdsa==0.18.0
exceptiongroup==1.1.1
flask-jwt-oidc==0.3.0
flask-marshmallow==0.15.0
flask-restx==1.1.0
formsflow-api-utils @ git+https://github.com/AOT-Technologies/forms-flow-ai.git@epd-5.2.2#subdirectory=forms-flow-api-utils
gunicorn==20.1.0
h11==0.14.0
h2==4.1.0
hpack==4.0.0
hyperframe==6.0.1
idna==3.4
itsdangerous==2.1.2
jsonschema==4.17.3
kaitaistruct==0.10
marshmallow-sqlalchemy==0.29.0
marshmallow==3.19.0
nested-lookup==0.2.25
outcome==1.2.0
packaging==23.1
psycopg2-binary==2.9.6
pyOpenSSL==23.2.0
pyasn1==0.5.0
pycparser==2.21
pyparsing==3.1.0
pyrsistent==0.19.3
python-dotenv==1.0.0
python-jose==3.3.0
pytz==2023.3
requests==2.31.0
rsa==4.9
selenium-wire==5.1.0
selenium==4.10.0
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
trio-websocket==0.10.3
trio==0.22.0
typing_extensions==4.7.0
urllib3==2.0.3
wsproto==1.2.0
zstandard==0.21.0
48 changes: 48 additions & 0 deletions forms-flow-ai/forms-flow-ai-ee/forms-flow-documents/sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
###############################################################################
# This file is a sample file, for Docker compose to work with the settings #
# rename this file to .env #
# Uncomment the variables if any changes from the default values #
###############################################################################
# ===== formsflow.ai Python Exportapi ENV Variables - START =====================



##Environment variables for WEB_API/FORMSFLOW_EXPORT_API in the adaptive tier.
##DB Connection URL for formsflow.ai
#FORMSFLOW_API_DB_URL=postgresql://postgres:changeme@forms-flow-webapi-db:5432/webapi
##formsflow.ai database postgres user
#FORMSFLOW_API_DB_USER=postgres
##formsflow.ai database postgres password
#FORMSFLOW_API_DB_PASSWORD=changeme
##formsflow.ai database name
#FORMSFLOW_API_DB_NAME=webapi

##URL to your Keycloak server
KEYCLOAK_URL=http://{your-ip-address}:8080
##The Keycloak realm to use
#KEYCLOAK_URL_REALM=forms-flow-ai
#KEYCLOAK_BPM_CLIENT_ID=forms-flow-bpm
#KEYCLOAK_WEB_CLIENT_ID=forms-flow-web
#KEYCLOAK_BPM_CLIENT_SECRET=e4bdbd25-1467-4f7f-b993-bc4b1944c943

##web Api End point
FORMSFLOW_API_URL=http://{your-ip-address}:5000
## Port should whether Docker starts internally
FORMSFLOW_DOC_API_URL=http://{your-ip-address}:5006
CHROME_DRIVER_PATH=/usr/local/bin/chromedriver
##web API CORS origins
FORMSFLOW_API_CORS_ORIGINS=*

##Env For Unit Testing
# TEST_REVIEWER_USERID=
# TEST_REVIEWER_PASSWORD=
# DATABASE_URL_TEST=

#FORMIO configuration
FORMIO_DEFAULT_PROJECT_URL=http://{your-ip-address}:3001
FORMIO_ROOT_EMAIL=admin@example.com
FORMIO_ROOT_PASSWORD=changeme

#custom submission
CUSTOM_SUBMISSION_ENABLED=false
CUSTOM_SUBMISSION_URL=http://{your-ip-address}:6212
Loading
Loading