From dcee09564cbac28f98abdd833dd5efa72a596c64 Mon Sep 17 00:00:00 2001 From: Adish M <44204658+adishM98@users.noreply.github.com> Date: Tue, 18 Mar 2025 11:11:49 +0530 Subject: [PATCH 1/8] Adding single image changes from ee lts (#12272) --- docker/ee/ee-production.Dockerfile | 51 ++++++++++++++++++++++++++++++ server/entrypoint.sh | 47 +++++++++++++++++++-------- 2 files changed, 85 insertions(+), 13 deletions(-) diff --git a/docker/ee/ee-production.Dockerfile b/docker/ee/ee-production.Dockerfile index 230a2f8ebb..b69458daa1 100644 --- a/docker/ee/ee-production.Dockerfile +++ b/docker/ee/ee-production.Dockerfile @@ -62,8 +62,40 @@ FROM debian:11 RUN apt-get update -yq \ && apt-get install curl gnupg zip -yq \ && apt-get install -yq build-essential \ + && apt -y install redis \ && apt-get clean -y +# Install required dependencies for downloading and extracting files +RUN apt-get update && apt-get install -y \ + curl tar xz-utils postgresql postgresql-contrib postgresql-client && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install PostgREST from official Docker image +COPY --from=postgrest/postgrest:v12.2.0 /bin/postgrest /bin + +RUN apt-get update && apt-get install -y supervisor + +# Create supervisord configuration file +RUN echo "[supervisord]\n" \ + "nodaemon=true\n" \ + "\n" \ + "[program:postgrest]\n" \ + "command=/bin/postgrest \n" \ + "autostart=true\n" \ + "autorestart=true\n" \ + "stdout_logfile=/dev/stdout\n" \ + "stderr_logfile=/dev/stderr\n" \ + "stdout_logfile_maxbytes=0\n" \ + "stderr_logfile_maxbytes=0\n" \ + "\n" | sed 's/ //' > /etc/supervisor/conf.d/supervisord.conf + +# Create a wrapper for PostgREST to prefix its logs +RUN mv /bin/postgrest /bin/postgrest-original && \ + echo '#!/bin/bash\n\ +exec /bin/postgrest-original "$@" 2>&1 | sed "s/^/[PostgREST] /"\n\ +' > /bin/postgrest && \ + chmod +x /bin/postgrest + RUN curl -O https://nodejs.org/dist/v18.18.2/node-v18.18.2-linux-x64.tar.xz \ && tar -xf node-v18.18.2-linux-x64.tar.xz \ @@ -152,6 +184,25 @@ RUN mkdir -p /tmp/.npm/npm-cache/_logs \ && chmod g+s /tmp/.npm/npm-cache/_logs \ && chmod -R g=u /tmp/.npm/npm-cache/_logs +# Create Redis data, log, and configuration directories +RUN mkdir -p /var/lib/redis /var/log/redis /etc/redis \ + && chown -R appuser:0 /var/lib/redis /var/log/redis /etc/redis \ + && chmod g+s /var/lib/redis /var/log/redis /etc/redis \ + && chmod -R g=u /var/lib/redis /var/log/redis /etc/redis + +# Set permissions for PostgREST binary +RUN chown appuser:0 /bin/postgrest && chmod u+x /bin/postgrest && chmod g=u /bin/postgrest + +RUN touch /tmp/postgrest.conf \ + && chown appuser:0 /tmp/postgrest.conf \ + && chmod 640 /tmp/postgrest.conf + +# Create PostgREST data, log, and configuration directories +RUN mkdir -p /var/lib/postgrest /var/log/postgrest /etc/postgrest \ + && chown -R appuser:0 /var/lib/postgrest /var/log/postgrest /etc/postgrest \ + && chmod g+s /var/lib/postgrest /var/log/postgrest /etc/postgrest \ + && chmod -R g=u /var/lib/postgrest /var/log/postgrest /etc/postgrest + ENV HOME=/home/appuser # Switch back to appuser diff --git a/server/entrypoint.sh b/server/entrypoint.sh index ba321cd401..ac4b0bafd2 100755 --- a/server/entrypoint.sh +++ b/server/entrypoint.sh @@ -8,6 +8,40 @@ if [ -f "./.env" ]; then export $(grep -v '^#' ./.env | xargs -d '\n') || true fi +# Start Redis server only if REDIS_HOST is localhost or not set +if [ -z "$REDIS_HOST" ] || [ "$REDIS_HOST" = "localhost" ]; then + echo "Starting Redis server locally..." + redis-server /etc/redis/redis.conf & +elif [ -n "$REDIS_URL" ]; then + echo "REDIS_URL connection is set: $REDIS_URL" +else + echo "Using external Redis at $REDIS_HOST:$REDIS_PORT." + + # Validate external Redis connection + if ! ./server/scripts/wait-for-it.sh "$REDIS_HOST:${REDIS_PORT:-6379}" --strict --timeout=300 -- echo "Redis is up"; then + echo "Error: Unable to connect to Redis at $REDIS_HOST:$REDIS_PORT." + exit 1 + fi +fi + +# Check if PGRST_HOST starts with "localhost" +if [[ "$PGRST_HOST" == localhost:* ]]; then + echo "Starting PostgREST server locally..." + + # Generate PostgREST configuration in a writable directory + POSTGREST_CONFIG_PATH="/tmp/postgrest.conf" + + echo "db-uri = \"${PGRST_DB_URI}\"" > "$POSTGREST_CONFIG_PATH" + echo "db-pre-config = \"postgrest.pre_config\"" >> "$POSTGREST_CONFIG_PATH" + echo "server-port = \"${PGRST_SERVER_PORT}\"" >> "$POSTGREST_CONFIG_PATH" + + # Starting PostgREST + echo "Starting PostgREST..." + postgrest "$POSTGREST_CONFIG_PATH" & +else + echo "Using external PostgREST at $PGRST_HOST." +fi + # Check WORKLOW_WORKER and skip SETUP_CMD if true if [ "${WORKFLOW_WORKER}" == "true" ]; then echo "WORKFLOW_WORKER is set to true. Running worker process." @@ -31,19 +65,6 @@ else ./server/scripts/wait-for-it.sh "$PG_HOST:$PG_PORT" --strict --timeout=300 -- echo "PostgreSQL is up" fi -# Note: This Redis connection check changes are only for EE repo - -# Check Redis connection -if [ -z "$REDIS_URL" ]; then - if [ -z "$REDIS_HOST" ] || [ -z "$REDIS_PORT" ]; then - echo "Waiting for Redis connection..." - fi - - ./server/scripts/wait-for-it.sh $REDIS_HOST:${REDIS_PORT:-6379} --strict --timeout=300 -- echo "Redis is up" -else - echo "REDIS_URL connection is set" -fi - # Run setup command if defined if [ -n "$SETUP_CMD" ]; then $SETUP_CMD From 0c338412a8c054ad9a5f9b8b4a11a61bf78077df Mon Sep 17 00:00:00 2001 From: Mekhla Asopa <59684099+Mekhla-Asopa@users.noreply.github.com> Date: Wed, 19 Mar 2025 13:56:33 +0530 Subject: [PATCH 2/8] added data-cy for rest api (#12298) --- .../CodeEditor/SingleLineCodeEditor.jsx | 2 +- frontend/src/_components/DynamicForm.jsx | 4 +- .../src/_components/EncyrptedFieldWrapper.jsx | 3 +- frontend/src/_ui/Accordion/AccordionItem.js | 34 ++++++++++++----- frontend/src/_ui/HttpHeaders/SourceEditor.jsx | 8 +++- frontend/src/_ui/HttpHeaders/index.js | 26 ++++++++----- frontend/src/_ui/OAuth/Authentication.jsx | 5 ++- frontend/src/_ui/OAuth/GrantTypes.jsx | 37 ++++++++++++------- frontend/src/_ui/Search/Search.jsx | 2 +- .../DataSourceManager/DataSourceManager.jsx | 3 +- 10 files changed, 86 insertions(+), 38 deletions(-) diff --git a/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx b/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx index 1243f26f43..5506a94fed 100644 --- a/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx +++ b/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx @@ -336,7 +336,7 @@ const EditorInput = ({