From 8a5384dd5898ebefbb62deee919f87ebe06b7541 Mon Sep 17 00:00:00 2001 From: Dmitry Zolotukhin Date: Thu, 28 Sep 2023 17:19:17 +0000 Subject: [PATCH 1/3] Bumped up CF Buildpack version to v5.0.9. --- rootfs-builder.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootfs-builder.dockerfile b/rootfs-builder.dockerfile index 03ced12..3fa96b2 100644 --- a/rootfs-builder.dockerfile +++ b/rootfs-builder.dockerfile @@ -10,7 +10,7 @@ ENV LANG C.UTF-8 ENV LC_ALL C.UTF-8 # CF buildpack version -ARG CF_BUILDPACK=v5.0.4 +ARG CF_BUILDPACK=v5.0.9 # CF buildpack download URL ARG CF_BUILDPACK_URL=https://github.com/mendix/cf-mendix-buildpack/releases/download/${CF_BUILDPACK}/cf-mendix-buildpack.zip From fac94012534328d7770c05c04fdf01c2376a26bd Mon Sep 17 00:00:00 2001 From: Dmitry Zolotukhin Date: Thu, 28 Sep 2023 17:54:09 +0000 Subject: [PATCH 2/3] Ensure that patching /etc/passwd is not required. --- Dockerfile | 4 ---- scripts/startup.py | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 730b794..9fbcf9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,10 +53,6 @@ ARG USER_UID=1001 # Set the home path ENV HOME=/opt/mendix/build -# Allow the user group to modify /etc/passwd so that OpenShift 3 randomized UIDs are supported by CF Buildpack -RUN chmod g=u /etc/passwd &&\ - chown ${USER_UID}:0 /etc/passwd - # Add the buildpack modules ENV PYTHONPATH "/opt/mendix/buildpack/lib/:/opt/mendix/buildpack/:/opt/mendix/buildpack/lib/python3.11/site-packages/" diff --git a/scripts/startup.py b/scripts/startup.py index b7f0b75..c91ec2c 100755 --- a/scripts/startup.py +++ b/scripts/startup.py @@ -5,6 +5,7 @@ import re import runpy import sys +import pwd import base64 logging.basicConfig( @@ -82,6 +83,9 @@ def check_logfilter(): logging.warn("LOG_RATELIMIT is set, but the mendix-logfilter binary is missing. Rebuild Docker image with EXCLUDE_LOGFILTER=false to enable log filtering") del os.environ['LOG_RATELIMIT'] +def emulate_getpwuid(): + pwd.getpwuid = lambda _: ['mendix', None, os.getuid(), os.getgid(), 'mendix user', '/opt/mendix/build', '/sbin/nologin'] + def call_buildpack_startup(): logging.debug("Executing call_buildpack_startup...") @@ -122,6 +126,7 @@ def get_welcome_header(): export_industrial_edge_config_variable() export_k8s_instance() check_logfilter() + emulate_getpwuid() export_encoded_cacertificates() call_buildpack_startup() From bd8cdd2cb459a9bf09d50076776781c01cbc0a74 Mon Sep 17 00:00:00 2001 From: Dmitry Zolotukhin Date: Fri, 29 Sep 2023 09:14:46 +0000 Subject: [PATCH 3/3] Remove /etc/passwd emulation code. OpenShift already correctly adds an entry to /etc/passwd. Perhaps the issue was caused by incorrect permissions. --- scripts/startup.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/startup.py b/scripts/startup.py index c91ec2c..b7f0b75 100755 --- a/scripts/startup.py +++ b/scripts/startup.py @@ -5,7 +5,6 @@ import re import runpy import sys -import pwd import base64 logging.basicConfig( @@ -83,9 +82,6 @@ def check_logfilter(): logging.warn("LOG_RATELIMIT is set, but the mendix-logfilter binary is missing. Rebuild Docker image with EXCLUDE_LOGFILTER=false to enable log filtering") del os.environ['LOG_RATELIMIT'] -def emulate_getpwuid(): - pwd.getpwuid = lambda _: ['mendix', None, os.getuid(), os.getgid(), 'mendix user', '/opt/mendix/build', '/sbin/nologin'] - def call_buildpack_startup(): logging.debug("Executing call_buildpack_startup...") @@ -126,7 +122,6 @@ def get_welcome_header(): export_industrial_edge_config_variable() export_k8s_instance() check_logfilter() - emulate_getpwuid() export_encoded_cacertificates() call_buildpack_startup()