docker-mendix-buildpack icon indicating copy to clipboard operation
docker-mendix-buildpack copied to clipboard

Fail at #18 Buildpack Mono.py

Open SamRhodesSiemens opened this issue 3 years ago • 1 comments

Hi,

I am trying to build an image from Mendix Buildpack, but sadly ran into a few errors. I previously managed to containerize except that it managed to containerize the sql database but not the mendix buildpack. I shut down VM, and then when opened, re-ran, now have following build issue at stage 18 with it not finding mono.py

docker build
--build-arg BUILD_PATH=build
--build-arg CF_BUILDPACK=v4.17.1
--build-arg ROOTFS_IMAGE=mendix/rootfs:ubi8
-t mendix/mendix-buildpack:v3.2.0 . Sending build context to Docker daemon 30.2MB Step 1/40 : ARG ROOTFS_IMAGE=mendix/rootfs:ubi8 Step 2/40 : ARG BUILDER_ROOTFS_IMAGE=mendix/rootfs:bionic Step 3/40 : FROM ${BUILDER_ROOTFS_IMAGE} AS builder bionic: Pulling from mendix/rootfs Digest: sha256:ac0d8cd109797053d0415224c1ef1c507a172a5d016161ce4f80873d031a435d Status: Downloaded newer image for mendix/rootfs:bionic ---> 56c6beb708a2 Step 4/40 : ARG BUILD_PATH=project ---> Using cache ---> 9647a20afe89 Step 5/40 : ARG DD_API_KEY ---> Using cache ---> a0c9341cc125 Step 6/40 : ARG CF_BUILDPACK=v4.17.1 ---> Using cache ---> 79f926004f85 Step 7/40 : ARG CF_BUILDPACK_URL=https://github.com/mendix/cf-mendix-buildpack/releases/download/${CF_BUILDPACK}/cf-mendix-buildpack.zip ---> Using cache ---> 6f3aa82bf88a Step 8/40 : ARG EXCLUDE_LOGFILTER=true ---> Using cache ---> ddd76ce84a72 Step 9/40 : ARG BLOBSTORE ---> Using cache ---> cb08f8b9e1c2 Step 10/40 : ARG BUILDPACK_XTRACE ---> Using cache ---> fa5d59c3cdc9 Step 11/40 : ARG USER_UID=1001 ---> Using cache ---> 5a9e46281921 Step 12/40 : RUN mkdir -p /opt/mendix/buildpack /opt/mendix/build && echo "Downloading CF Buildpack from ${CF_BUILDPACK_URL}" && curl -fsSL ${CF_BUILDPACK_URL} -o /tmp/cf-mendix-buildpack.zip && python3 -m zipfile -e /tmp/cf-mendix-buildpack.zip /opt/mendix/buildpack/ && rm /tmp/cf-mendix-buildpack.zip && chown -R ${USER_UID}:0 /opt/mendix && chmod -R g=u /opt/mendix ---> Using cache ---> 7b38e6beb9f5 Step 13/40 : COPY scripts/compilation scripts/git /opt/mendix/buildpack/ ---> Using cache ---> a5866ce31200 Step 14/40 : COPY $BUILD_PATH /opt/mendix/build ---> Using cache ---> 424d1ead2aa7 Step 15/40 : RUN chmod +rx /opt/mendix/buildpack/bin/bootstrap-python && /opt/mendix/buildpack/bin/bootstrap-python /opt/mendix/buildpack /tmp/buildcache ---> Using cache ---> e560fd781c77 Step 16/40 : ENV PYTHONPATH "$PYTHONPATH:/opt/mendix/buildpack/lib/:/opt/mendix/buildpack/:/opt/mendix/buildpack/lib/python3.6/site-packages/" ---> Using cache ---> 7f823d551907 Step 17/40 : ENV NGINX_CUSTOM_BIN_PATH=/usr/sbin/nginx ---> Using cache ---> 36cc78337007 Step 18/40 : RUN mkdir -p /tmp/buildcache /var/mendix/build /var/mendix/build/.local && chmod +rx /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git /opt/mendix/buildpack/buildpack/stage.py && cd /opt/mendix/buildpack && ./compilation /opt/mendix/build /tmp/buildcache && rm -fr /tmp/buildcache /tmp/javasdk /tmp/opt /tmp/downloads /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git && ln -s /opt/mendix/.java /opt/mendix/build && chown -R ${USER_UID}:0 /opt/mendix /var/mendix && chmod -R g=u /opt/mendix /var/mendix ---> Running in c89ee7211589 INFO: Mendix project compilation phase... WARNING: Cannot retrieve metadata key RuntimeVersion INFO: Preflight check on Mendix version [9.4.0.24572] and stack [None]... INFO: Preflight check completed INFO: Building from source... INFO: Selecting Mono Runtime: mono-5.20.1.27 Traceback (most recent call last): File "/opt/mendix/buildpack/buildpack/mono.py", line 102, in ensure_and_get_mono mono_location = _get_mono_path("/tmp/opt", mono_version) File "/opt/mendix/buildpack/buildpack/mono.py", line 46, in _get_mono_path "Mono not found", File "/opt/mendix/buildpack/buildpack/util.py", line 192, in get_existing_directory_or_raise raise NotFoundException(error) buildpack.util.NotFoundException: Mono not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/util/connection.py", line 61, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/connectionpool.py", line 677, in urlopen chunked=chunked, File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/connectionpool.py", line 381, in _make_request self._validate_conn(conn) File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn conn.connect() File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/connection.py", line 309, in connect conn = self._new_conn() File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/connection.py", line 172, in _new_conn self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7faec059ccf8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/mendix/buildpack/lib/python3.6/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/connectionpool.py", line 727, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/opt/mendix/buildpack/lib/python3.6/site-packages/urllib3/util/retry.py", line 446, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cdn.mendix.com', port=443): Max retries exceeded with url: /mx-buildpack/mono/mono-5.20.1.27-mx-ubuntu-bionic.tar.gz (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7faec059ccf8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/mendix/buildpack/buildpack/stage.py", line 139, in runtime.get_java_version(runtime_version), File "/opt/mendix/buildpack/buildpack/mxbuild.py", line 21, in build_from_source mono_location = mono.ensure_and_get_mono(runtime_version, cache_path) File "/opt/mendix/buildpack/buildpack/mono.py", line 108, in ensure_and_get_mono cache_dir, File "/opt/mendix/buildpack/buildpack/util.py", line 106, in download_and_unpack download(url, cached_location) File "/opt/mendix/buildpack/buildpack/util.py", line 179, in download response = requests.get(url, stream=True) File "/opt/mendix/buildpack/lib/python3.6/site-packages/requests/api.py", line 76, in get return request('get', url, params=params, **kwargs) File "/opt/mendix/buildpack/lib/python3.6/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "/opt/mendix/buildpack/lib/python3.6/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/opt/mendix/buildpack/lib/python3.6/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/opt/mendix/buildpack/lib/python3.6/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='cdn.mendix.com', port=443): Max retries exceeded with url: /mx-buildpack/mono/mono-5.20.1.27-mx-ubuntu-bionic.tar.gz (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7faec059ccf8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)) Traceback (most recent call last): File "./compilation", line 65, in exit_code = call_buildpack_compilation() File "./compilation", line 37, in call_buildpack_compilation return subprocess.check_call(["/opt/mendix/buildpack/buildpack/stage.py", BUILD_PATH, CACHE_PATH]) File "/usr/lib/python3.6/subprocess.py", line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/opt/mendix/buildpack/buildpack/stage.py', '/opt/mendix/build', '/tmp/buildcache']' returned non-zero exit status 1. The command '/bin/sh -c mkdir -p /tmp/buildcache /var/mendix/build /var/mendix/build/.local && chmod +rx /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git /opt/mendix/buildpack/buildpack/stage.py && cd /opt/mendix/buildpack && ./compilation /opt/mendix/build /tmp/buildcache && rm -fr /tmp/buildcache /tmp/javasdk /tmp/opt /tmp/downloads /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git && ln -s /opt/mendix/.java /opt/mendix/build && chown -R ${USER_UID}:0 /opt/mendix /var/mendix && chmod -R g=u /opt/mendix /var/mendix' returned a non-zero code: 1 make: *** [Makefile:13: build-image] Error 1

SamRhodesSiemens avatar Aug 19 '21 08:08 SamRhodesSiemens

I was having the same issue, so I took a look at the source code of cf-mendix-buildpack and I found a solution :

In the Dockerfile, set a default value for BLOBSTORE.

    ARG BLOBSTORE=https://cdn.mendix.com

remark : in cf-mendix-buildpack code, if BLOBSTORE is not define, the value "https://cdn.mendix.com" is used instead. That's why I use this value. But it looks like there is an issue in cf-mendix-buildpack, and the default value is not used when BLOBSTORE has not default value in the Dockerfile :

    ARG BLOBSTORE

mikepmosh avatar Sep 28 '21 15:09 mikepmosh