From 17315cd809f98bb8a9e582b8ef70ee9ea5d42766 Mon Sep 17 00:00:00 2001 From: Adish M <44204658+adishM98@users.noreply.github.com> Date: Tue, 14 Mar 2023 12:52:38 +0530 Subject: [PATCH 1/2] openshift code (#5745) --- deploy/openshift/deployment.yaml | 96 ++++++++++++++++++++++++++++++++ deploy/openshift/postgrest.yaml | 52 +++++++++++++++++ deploy/openshift/service.yaml | 13 +++++ 3 files changed, 161 insertions(+) create mode 100644 deploy/openshift/deployment.yaml create mode 100644 deploy/openshift/postgrest.yaml create mode 100644 deploy/openshift/service.yaml diff --git a/deploy/openshift/deployment.yaml b/deploy/openshift/deployment.yaml new file mode 100644 index 0000000000..20babd29e4 --- /dev/null +++ b/deploy/openshift/deployment.yaml @@ -0,0 +1,96 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tooljet-deployment +spec: + replicas: 2 + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 + selector: + matchLabels: + component: tooljet + template: + metadata: + labels: + component: tooljet + spec: + imagePullSecrets: + - name: docker-secret + containers: + - name: container + image: tooljet/tooljet-ce:latest + imagePullPolicy: Always + args: ["npm", "run", "start:prod"] + resources: + limits: + memory: "2000Mi" + cpu: "2000m" + requests: + memory: "1000Mi" + cpu: "1000m" + ports: + - containerPort: 3000 + readinessProbe: + httpGet: + port: 3000 + path: /api/health + successThreshold: 1 + initialDelaySeconds: 10 + periodSeconds: 5 + failureThreshold: 6 + env: + - name: PG_HOST + valueFrom: + secretKeyRef: + name: server + key: pg_host + - name: PG_USER + valueFrom: + secretKeyRef: + name: server + key: pg_user + - name: PG_PASS + valueFrom: + secretKeyRef: + name: server + key: pg_password + - name: PG_DB + valueFrom: + secretKeyRef: + name: server + key: pg_db + - name: LOCKBOX_MASTER_KEY + valueFrom: + secretKeyRef: + name: server + key: lockbox_key + - name: SECRET_KEY_BASE + valueFrom: + secretKeyRef: + name: server + key: secret_key_base + - name: TOOLJET_HOST + valueFrom: + secretKeyRef: + name: server + key: tj_host + - name: DEPLOYMENT_PLATFORM + value: "openshift" + # Set the env values below for Tooljet Database + # - name: ENABLE_TOOLJET_DB + # value: "true" + # - name: TOOLJET_DB + # value: "tooljet_db" + # - name: TOOLJET_DB_USER + # value: "replace_with_tooljet_db_user" + # - name: TOOLJET_DB_HOST + # value: "replace_with_tooljet_db_host" + # - name: TOOLJET_DB_PASS + # value: "replace_with_tooljet_db_pass" + # - name: PGRST_HOST + # value: "replace_with_postgrest_host" + # - name: PGRST_JWT_SECRET + # value: "replace_jwt_secret_here" diff --git a/deploy/openshift/postgrest.yaml b/deploy/openshift/postgrest.yaml new file mode 100644 index 0000000000..d906a66477 --- /dev/null +++ b/deploy/openshift/postgrest.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tooljet-postgrest +spec: + replicas: 1 + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 + selector: + matchLabels: + component: tooljet-postgrest + template: + metadata: + labels: + component: tooljet-postgrest + spec: + containers: + - name: postgrest + image: postgrest/postgrest:v10.1.1.20221215 + ports: + - containerPort: 3000 + env: + - name: PGRST_DB_URI + valueFrom: + secretKeyRef: + name: server + key: pgrst_db_uri + - name: PGRST_JWT_SECRET + valueFrom: + secretKeyRef: + name: server + key: pgrst_db_uri + - name: PGRST_LOG_LEVEL + value: "info" +--- +apiVersion: v1 +kind: Service +metadata: + name: tooljet-postgrest-service + labels: + name: tooljet-postgrest +spec: + type: NodePort + ports: + - port: 80 + protocol: TCP + targetPort: 3000 + selector: + component: tooljet-postgrest diff --git a/deploy/openshift/service.yaml b/deploy/openshift/service.yaml new file mode 100644 index 0000000000..449513bc7f --- /dev/null +++ b/deploy/openshift/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: tooljet-server +spec: + type: LoadBalancer + selector: + component: tooljet + ports: + - protocol: TCP + port: 443 + targetPort: 3000 + name: https From 38264b38bd0bb02dc0de67dd8716cbcaa9b6b256 Mon Sep 17 00:00:00 2001 From: Adish M <44204658+adishM98@users.noreply.github.com> Date: Fri, 24 Mar 2023 14:21:11 +0530 Subject: [PATCH 2/2] fix for try-tooljet (#5839) --- docker/try-tooljet.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/try-tooljet.Dockerfile b/docker/try-tooljet.Dockerfile index cbac83e816..7782071dbc 100644 --- a/docker/try-tooljet.Dockerfile +++ b/docker/try-tooljet.Dockerfile @@ -5,7 +5,7 @@ COPY --from=postgrest/postgrest:v10.1.1.20221215 /bin/postgrest /bin # Install Postgres RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main 13" | tee /etc/apt/sources.list.d/pgdg.list +RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list RUN echo "deb http://deb.debian.org/debian" RUN apt update && apt -y install postgresql-13 postgresql-client-13 supervisor USER postgres