From 7cb76948295089a98aa01bbe9c88ac2f4e90a844 Mon Sep 17 00:00:00 2001 From: iromli Date: Sat, 28 Dec 2024 02:47:23 +0700 Subject: [PATCH 1/3] fix(docker-jans-persistence-loader): exclude external tables when creating indexes Signed-off-by: iromli --- docker-jans-persistence-loader/Dockerfile | 6 +++--- .../scripts/sql_setup.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docker-jans-persistence-loader/Dockerfile b/docker-jans-persistence-loader/Dockerfile index 2327a9cf9a5..bc62a27505c 100644 --- a/docker-jans-persistence-loader/Dockerfile +++ b/docker-jans-persistence-loader/Dockerfile @@ -23,7 +23,7 @@ ARG JANS_CONFIG_API_RESOURCES=jans-config-api/server/src/main/resources # note that as we're pulling from a monorepo (with multiple project in it) # we are using partial-clone and sparse-checkout to get the assets -RUN git clone --depth 500 --filter blob:none --no-checkout https://github.com/janssenproject/jans /tmp/jans \ +RUN git clone --depth 100 --filter blob:none --no-checkout https://github.com/janssenproject/jans /tmp/jans \ && cd /tmp/jans \ && git sparse-checkout init --cone \ && git checkout ${JANS_SOURCE_VERSION} \ @@ -56,8 +56,8 @@ RUN cd /tmp/jans \ COPY requirements.txt /app/requirements.txt RUN mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.disabled \ && python3 -m ensurepip \ - && pip3 install --no-cache-dir -U pip wheel setuptools \ - && pip3 install --no-cache-dir -r /app/requirements.txt \ + && pip3 install --no-cache-dir -U pip wheel setuptools --no-build-isolation --timeout 30 \ + && pip3 install --no-cache-dir -r /app/requirements.txt --timeout 30 \ && pip3 uninstall -y pip wheel # ======= diff --git a/docker-jans-persistence-loader/scripts/sql_setup.py b/docker-jans-persistence-loader/scripts/sql_setup.py index 8351ca711e7..7cd0fc43b98 100644 --- a/docker-jans-persistence-loader/scripts/sql_setup.py +++ b/docker-jans-persistence-loader/scripts/sql_setup.py @@ -185,13 +185,17 @@ def create_pgsql_indexes(self, table_name: str, column_mapping: dict): self.client.create_index(query) def create_indexes(self): - for table_name, column_mapping in self.client.get_table_mapping().items(): + # exclude tables that created externally https://github.com/JanssenProject/jans/issues/10512 + table_mapping = { + k: v for k, v in self.client.get_table_mapping().items() + if k in self.table_mapping_from_schema() + } + + for table_name, column_mapping in table_mapping.items(): if self.client.dialect == "pgsql": - index_func = self.create_pgsql_indexes + self.create_pgsql_indexes(table_name, column_mapping) else: - index_func = self.create_mysql_indexes - # run the callback - index_func(table_name, column_mapping) + self.create_mysql_indexes(table_name, column_mapping) def create_unique_indexes(self): for table_name, column in [ From e00672722bd13f93fe2d98e7611350a85e506349 Mon Sep 17 00:00:00 2001 From: iromli Date: Sat, 28 Dec 2024 05:14:18 +0700 Subject: [PATCH 2/3] build(cloud-native): add configurable build args --- docker-jans-persistence-loader/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker-jans-persistence-loader/Dockerfile b/docker-jans-persistence-loader/Dockerfile index bc62a27505c..5be105996e7 100644 --- a/docker-jans-persistence-loader/Dockerfile +++ b/docker-jans-persistence-loader/Dockerfile @@ -23,7 +23,8 @@ ARG JANS_CONFIG_API_RESOURCES=jans-config-api/server/src/main/resources # note that as we're pulling from a monorepo (with multiple project in it) # we are using partial-clone and sparse-checkout to get the assets -RUN git clone --depth 100 --filter blob:none --no-checkout https://github.com/janssenproject/jans /tmp/jans \ +ARG GIT_CLONE_DEPTH=100 +RUN git clone --depth ${GIT_CLONE_DEPTH} --filter blob:none --no-checkout https://github.com/janssenproject/jans /tmp/jans \ && cd /tmp/jans \ && git sparse-checkout init --cone \ && git checkout ${JANS_SOURCE_VERSION} \ @@ -53,11 +54,13 @@ RUN cd /tmp/jans \ # Python # ====== +# default pip timeout +ARG PIP_TIMEOUT=15 COPY requirements.txt /app/requirements.txt RUN mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.disabled \ && python3 -m ensurepip \ - && pip3 install --no-cache-dir -U pip wheel setuptools --no-build-isolation --timeout 30 \ - && pip3 install --no-cache-dir -r /app/requirements.txt --timeout 30 \ + && pip3 install --no-cache-dir -U pip wheel setuptools --no-build-isolation --timeout ${PIP_TIMEOUT} \ + && pip3 install --no-cache-dir -r /app/requirements.txt --timeout ${PIP_TIMEOUT} \ && pip3 uninstall -y pip wheel # ======= From d55411e0e336a8960306cd5c5961fc612e130112 Mon Sep 17 00:00:00 2001 From: iromli Date: Tue, 31 Dec 2024 05:07:08 +0700 Subject: [PATCH 3/3] build(cloud-native): remove unnecessary pip option Signed-off-by: iromli --- docker-jans-persistence-loader/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-jans-persistence-loader/Dockerfile b/docker-jans-persistence-loader/Dockerfile index 5be105996e7..bb662da7577 100644 --- a/docker-jans-persistence-loader/Dockerfile +++ b/docker-jans-persistence-loader/Dockerfile @@ -59,7 +59,7 @@ ARG PIP_TIMEOUT=15 COPY requirements.txt /app/requirements.txt RUN mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.disabled \ && python3 -m ensurepip \ - && pip3 install --no-cache-dir -U pip wheel setuptools --no-build-isolation --timeout ${PIP_TIMEOUT} \ + && pip3 install --no-cache-dir -U pip wheel setuptools --timeout ${PIP_TIMEOUT} \ && pip3 install --no-cache-dir -r /app/requirements.txt --timeout ${PIP_TIMEOUT} \ && pip3 uninstall -y pip wheel