diff --git a/.github/workflows/render-preview-deploy.yml b/.github/workflows/render-preview-deploy.yml index 203ee88150..d1ca481d02 100644 --- a/.github/workflows/render-preview-deploy.yml +++ b/.github/workflows/render-preview-deploy.yml @@ -12,7 +12,7 @@ permissions: jobs: -# Community Edition +# Community Edition CE create-ce-review-app: if: ${{ github.event.action == 'labeled' && (github.event.label.name == 'create-ce-review-app' || github.event.label.name == 'review-app') }} runs-on: ubuntu-latest @@ -72,7 +72,7 @@ jobs: "envVars": [ { "key": "PG_HOST", - "value": "${{ secrets.RENDER_PG_HOST }}" + "value": "localhost" }, { "key": "PG_PORT", @@ -80,11 +80,11 @@ jobs: }, { "key": "PG_USER", - "value": "${{ secrets.RENDER_PG_USER }}" + "value": "tooljet" }, { "key": "PG_PASS", - "value": "${{ secrets.RENDER_PG_PASS }}" + "value": "postgres" }, { "key": "PG_DB", @@ -96,15 +96,15 @@ jobs: }, { "key": "TOOLJET_DB_HOST", - "value": "${{ secrets.RENDER_PG_HOST }}" + "value": "localhost" }, { "key": "TOOLJET_DB_USER", - "value": "${{ secrets.RENDER_PG_USER }}" + "value": "tooljet" }, { "key": "TOOLJET_DB_PASS", - "value": "${{ secrets.RENDER_PG_PASS }}" + "value": "postgres" }, { "key": "TOOLJET_DB_PORT", @@ -116,7 +116,7 @@ jobs: }, { "key": "PGRST_DB_URI", - "value": "postgres://${{ secrets.RENDER_PG_USER }}:${{ secrets.RENDER_PG_PASS }}@${{ secrets.RENDER_PG_HOST }}/${{ env.PR_NUMBER }}-ce-tjdb" + "value": "postgres://tooljet:postgres@localhost/${{ env.PR_NUMBER }}-ce-tjdb" }, { "key": "PGRST_HOST", @@ -162,18 +162,6 @@ jobs: "key": "SMTP_PASSWORD", "value": "${{ secrets.RENDER_SMTP_PASSWORD }}" }, - { - "key": "TEMPORAL_SERVER_ADDRESS", - "value": "https://auto-setup-1-25-1.onrender.com" - }, - { - "key": "TEMPORAL_TASK_QUEUE_NAME_FOR_WORKFLOWS", - "value": "tooljet-ce-pr-${{ env.PR_NUMBER }}" - }, - { - "key": "TOOLJET_WORKFLOWS_TEMPORAL_NAMESPACE", - "value": "default" - }, { "key": "TOOLJET_MARKETPLACE_URL", "value": "${{ secrets.MARKETPLACE_BUCKET }}" @@ -424,7 +412,7 @@ jobs: "envVars": [ { "key": "PG_HOST", - "value": "${{ secrets.RENDER_PG_HOST }}" + "value": "localhost" }, { "key": "PG_PORT", @@ -432,11 +420,11 @@ jobs: }, { "key": "PG_USER", - "value": "${{ secrets.RENDER_PG_USER }}" + "value": "tooljet" }, { "key": "PG_PASS", - "value": "${{ secrets.RENDER_PG_PASS }}" + "value": "postgres" }, { "key": "PG_DB", @@ -448,15 +436,15 @@ jobs: }, { "key": "TOOLJET_DB_HOST", - "value": "${{ secrets.RENDER_PG_HOST }}" + "value": "localhost" }, { "key": "TOOLJET_DB_USER", - "value": "${{ secrets.RENDER_PG_USER }}" + "value": "tooljet" }, { "key": "TOOLJET_DB_PASS", - "value": "${{ secrets.RENDER_PG_PASS }}" + "value": "postgres" }, { "key": "TOOLJET_DB_PORT", @@ -468,7 +456,7 @@ jobs: }, { "key": "PGRST_DB_URI", - "value": "postgres://${{ secrets.RENDER_PG_USER }}:${{ secrets.RENDER_PG_PASS }}@${{ secrets.RENDER_PG_HOST }}/${{ env.PR_NUMBER }}-ee-tjdb" + "value": "postgres://tooljet:postgres@localhost/${{ env.PR_NUMBER }}-ee-tjdb" }, { "key": "PGRST_HOST", @@ -1124,4 +1112,3 @@ jobs: # } catch (e) { # console.log(e) # } - diff --git a/docker/ce-entrypoint.sh b/docker/ce-entrypoint.sh index 4b63af2e45..b18ab59ffd 100755 --- a/docker/ce-entrypoint.sh +++ b/docker/ce-entrypoint.sh @@ -1,6 +1,10 @@ #!/bin/bash set -e +if [ -f "./.env" ]; then + export $(grep -v '^#' ./.env | xargs -d '\n') || true +fi + if [ -d "./server/dist" ]; then SETUP_CMD='npm run db:setup:prod' else diff --git a/docker/ce-preview.Dockerfile b/docker/ce-preview.Dockerfile index 4e9f8dd796..d71e6c1dbc 100644 --- a/docker/ce-preview.Dockerfile +++ b/docker/ce-preview.Dockerfile @@ -75,20 +75,39 @@ COPY --from=builder /app/server/templates ./app/server/templates COPY --from=builder /app/server/scripts ./app/server/scripts COPY --from=builder /app/server/dist ./app/server/dist -COPY ./docker/ce-entrypoint.sh ./app/server/entrypoint.sh - WORKDIR /app +USER root +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/ 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 +RUN service postgresql start && \ + psql -c "create role tooljet with login superuser password 'postgres';" +USER root + # ENV defaults -ENV TOOLJET_HOST=http://localhost:80 \ - PGRST_HOST=http://localhost:3000 \ - PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj \ - TOOLJET_DB=tooljet_db \ - ENABLE_TOOLJET_DB=true \ - PORT=80 \ +ENV TOOLJET_HOST=http://localhost \ + NODE_ENV=production \ LOCKBOX_MASTER_KEY=replace_with_lockbox_master_key \ SECRET_KEY_BASE=replace_with_secret_key_base \ - ORM_LOGGING=all \ + PG_DB=tooljet_production \ + PG_USER=tooljet \ + PG_PASS=postgres \ + PG_HOST=localhost \ + ENABLE_TOOLJET_DB=true \ + TOOLJET_DB_HOST=localhost \ + TOOLJET_DB_USER=tooljet \ + TOOLJET_DB_PASS=postgres \ + TOOLJET_DB=tooljet_db \ + PGRST_HOST=http://localhost:3000 \ + PGRST_DB_URI=postgres://tooljet:postgres@localhost/tooljet_db \ + PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj \ + PGRST_DB_PRE_CONFIG=postgrest.pre_config \ + ORM_LOGGING=true \ + DEPLOYMENT_PLATFORM=docker:local \ + HOME=/home/appuser \ TERM=xterm CMD ["/usr/bin/supervisord"] diff --git a/docker/ee/ee-preview.Dockerfile b/docker/ee/ee-preview.Dockerfile index d88efbfecf..91e0864bd0 100644 --- a/docker/ee/ee-preview.Dockerfile +++ b/docker/ee/ee-preview.Dockerfile @@ -104,20 +104,40 @@ COPY --from=builder /app/server/templates ./app/server/templates COPY --from=builder /app/server/scripts ./app/server/scripts COPY --from=builder /app/server/dist ./app/server/dist -COPY ./docker/ee/ee-entrypoint.sh ./app/server/ee-entrypoint.sh - WORKDIR /app # ENV defaults -ENV TOOLJET_HOST=http://localhost:80 \ - PGRST_HOST=http://localhost:3000 \ - PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj \ - TOOLJET_DB=tooljet_db \ - ENABLE_TOOLJET_DB=true \ - PORT=80 \ +USER root +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/ 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 +RUN service postgresql start && \ + psql -c "create role tooljet with login superuser password 'postgres';" +USER root + +# ENV defaults +ENV TOOLJET_HOST=http://localhost \ + NODE_ENV=production \ LOCKBOX_MASTER_KEY=replace_with_lockbox_master_key \ SECRET_KEY_BASE=replace_with_secret_key_base \ - ORM_LOGGING=all \ + PG_DB=tooljet_production \ + PG_USER=tooljet \ + PG_PASS=postgres \ + PG_HOST=localhost \ + ENABLE_TOOLJET_DB=true \ + TOOLJET_DB_HOST=localhost \ + TOOLJET_DB_USER=tooljet \ + TOOLJET_DB_PASS=postgres \ + TOOLJET_DB=tooljet_db \ + PGRST_HOST=http://localhost:3000 \ + PGRST_DB_URI=postgres://tooljet:postgres@localhost/tooljet_db \ + PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj \ + PGRST_DB_PRE_CONFIG=postgrest.pre_config \ + ORM_LOGGING=true \ + DEPLOYMENT_PLATFORM=docker:local \ + REDIS_PASS= \ TERM=xterm CMD ["/usr/bin/supervisord"] diff --git a/server/scripts/boot.sh b/server/scripts/boot.sh index e12aa43a25..3c2bbad93e 100755 --- a/server/scripts/boot.sh +++ b/server/scripts/boot.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +service postgresql start + echo " _____ _ ___ _ |_ _| | | |_ | | |