You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This article is provided as a technical guide to set up Joget DX on PostgreSQL on Kubernetes. Please note that Postgres database is not officially supported by Joget. The following steps were implemented on Ubuntu 20.04, please modify the commands to suit your environment.

Create Joget Image with PostgreSQL JDBC Driver

# create custom Dockerfile
cat <<EOF > joget-dx8-postgresql-tomcat9.Dockerfile
FROM jogetworkflow/joget-dx8-tomcat9:7.0.14

# Copy postgresql jdbc driver (download from https://jdbc.postgresql.org/download/postgresql-42.2.19.jar)
COPY postgresql-42.2.19.jar /deployments/apache-tomcat/lib/postgresql-42.2.19.jar
EOF

# build docker image
docker build -f joget-dx8-postgresql-tomcat9.Dockerfile --rm -t quay.io/replaceWithYourAccount/joget-dx8-postgresql-tomcat9:7.0.14 .

# push docker image
docker push quay.io/replaceWithYourAccount/joget-dx8-postgresql-tomcat9:7.0.14

Deploy PostgreSQL on K8s using Helm

# deploy postgresql helm repo add bitnami https://charts.bitnami.com/bitnami
helm install postgres bitnami/postgresql
helm list
helm get notes postgres

# wait for postgresql to startup
kubectl wait \
  --for=condition=ready pod \
  --selector=app.kubernetes.io/name=postgresql \
  --timeout=180s

Create PostgreSQL Database

# set postgresql password
export POSTGRES_PASSWORD=$(kubectl get secret --namespace default postgres-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

# run psql
kubectl run postgres-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.11.0-debian-10-r24 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgres-postgresql -U postgres -d postgres -p 5432

$ CREATE DATABASE jwdb;
$ \quit

Import Joget DB SQL

Obtain the pgsql file from Configure for PostgreSQL.

# import sql
cat jwdb-postgresql-dx8.pgsql | kubectl exec -i postgres-postgresql-0 -- env PGPASSWORD=$POSTGRES_PASSWORD psql -U postgres -d jwdb

Deploy Joget

Follow the instructions in https://dev.joget.org/community/display/dx8/Joget+on+Kubernetes, replacing the jogetworkflow/joget-dx8-tomcat9 image with the custom image quay.io/replaceWithYourAccount/joget-dx8-postgresql-tomcat9 in the YAML

Configure Joget Datasource for PostgreSQL

# ssh into tomcat pod and create datasource files
kubectl exec --stdin --tty deployments/joget-dx8-tomcat9 -- /bin/bash

$ cat <<EOF > /opt/joget/wflow/app_datasource-postgresql.properties
workflowUser=postgres
workflowPassword=REPLACE_POSTGRES_PASSWORD_HERE
workflowDriver=org.postgresql.Driver
workflowUrl=jdbc\:postgresql\://postgres-postgresql/jwdb
EOF

$ cat <<EOF > /opt/joget/wflow/app_datasource.properties
currentProfile=postgresql
EOF

$ exit

Restart Joget

# restart pods

kubectl scale --replicas=0 deployment/joget-dx8-tomcat9

kubectl scale --replicas=1 deployment/joget-dx8-tomcat9

# view logs

kubectl logs -f deployment/joget-dx8-tomcat9
  • No labels