From a161f6fbbea6e189e7ec7ae4d5142b0c6a740b81 Mon Sep 17 00:00:00 2001 From: Kay Ulbrich Date: Fri, 23 Aug 2024 16:08:27 +0200 Subject: [PATCH 1/5] Add build arg YARN_OPTS to be added to "yarn" on Docker build --- docker/docker-compose-mysql.yaml | 2 ++ docker/docker-compose-postgres-es7.yaml | 2 ++ docker/docker-compose-postgres.yaml | 2 ++ docker/docker-compose.yaml | 2 ++ docker/server/Dockerfile | 3 ++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose-mysql.yaml b/docker/docker-compose-mysql.yaml index 5c587e321..8c2c3753e 100644 --- a/docker/docker-compose-mysql.yaml +++ b/docker/docker-compose-mysql.yaml @@ -10,6 +10,8 @@ services: build: context: ../ dockerfile: docker/server/Dockerfile + args: + YARN_OPTS: ${YARN_OPTS} networks: - internal ports: diff --git a/docker/docker-compose-postgres-es7.yaml b/docker/docker-compose-postgres-es7.yaml index 1dff23682..383be9500 100644 --- a/docker/docker-compose-postgres-es7.yaml +++ b/docker/docker-compose-postgres-es7.yaml @@ -9,6 +9,8 @@ services: build: context: ../ dockerfile: docker/server/Dockerfile + args: + YARN_OPTS: ${YARN_OPTS} networks: - internal ports: diff --git a/docker/docker-compose-postgres.yaml b/docker/docker-compose-postgres.yaml index 1e86fc69a..d1a51cefe 100644 --- a/docker/docker-compose-postgres.yaml +++ b/docker/docker-compose-postgres.yaml @@ -9,6 +9,8 @@ services: build: context: ../ dockerfile: docker/server/Dockerfile + args: + YARN_OPTS: ${YARN_OPTS} networks: - internal ports: diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 7c32c1437..9425f735a 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -9,6 +9,8 @@ services: build: context: ../ dockerfile: docker/server/Dockerfile + args: + YARN_OPTS: ${YARN_OPTS} networks: - internal ports: diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index 4dd41bad1..97a22463e 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -25,6 +25,7 @@ RUN ls -ltr # 1. Builder stage 2 # =========================================================================================================== FROM alpine:3.20 AS ui-builder +ARG YARN_OPTS LABEL maintainer="Orkes OSS " @@ -36,7 +37,7 @@ WORKDIR /conductor/ui # Include monaco sources into bundle (instead of using CDN) ENV REACT_APP_MONACO_EDITOR_USING_CDN=false -RUN yarn install && cp -r node_modules/monaco-editor public/ && yarn build +RUN yarn ${YARN_OPTS} install && cp -r node_modules/monaco-editor public/ && yarn ${YARN_OPTS} build RUN ls -ltr RUN echo "Done building UI" From aafc53c33732c27ffade4ebed0ddbe2e84b19557 Mon Sep 17 00:00:00 2001 From: Kay Ulbrich Date: Fri, 23 Aug 2024 16:33:26 +0200 Subject: [PATCH 2/5] Extended Docker build documentation --- docker/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docker/README.md b/docker/README.md index e19a916ee..2f80e85d0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -49,3 +49,35 @@ TODO: Link to the helm charts | [docker-compose.yaml](docker-compose.yaml) | Redis + Elasticsearch 7 | | [docker-compose-postgres.yaml](docker-compose-postgres.yaml) | Postgres + Elasticsearch 7 | | [docker-compose-mysql.yaml](docker-compose-mysql.yaml) | Mysql + Elasticsearch 7 | + +### Network errors during UI build with yarn + +It has been observed, that the UI build may fail with an error message like + +``` +> [linux/arm64 ui-builder 5/7] RUN yarn install && cp -r node_modules/monaco-editor public/ && yarn build: +269.9 at Object.onceWrapper (node:events:633:28) +269.9 at TLSSocket.emit (node:events:531:35) +269.9 at Socket._onTimeout (node:net:590:8) +269.9 at listOnTimeout (node:internal/timers:573:17) +269.9 at process.processTimers (node:internal/timers:514:7) +269.9 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. +281.2 info There appears to be trouble with your network connection. Retrying... +313.5 info There appears to be trouble with your network connection. Retrying... +920.3 info There appears to be trouble with your network connection. Retrying... +953.6 info There appears to be trouble with your network connection. Retrying... +``` + +This can happen, even if the network resources `yarn` tries to use are available, but there is too much network latency. `yarn` accepts the option `--network-timeout` to set a custom timeout in milliseconds. + +For passing arguments to `yarn`, in [this Dockerfile](server/Dockerfile) the build arg `YARN_OPTS` has been added. This argument will be added to each `yarn` call. When using one of the `docker-compose-*` files, you can set this via the eponymous environment variable `YARN_OPTS`, e.g.: + +``` +YARN_OPTS='--network-timeout 10000000' docker compose -f docker-compose.yaml up +``` + +When building a Docker image using `docker`, you must call it like e.g. + +``` +docker build --build-arg='YARN_OPTS=--network-timeout 10000000' .. -f server/Dockerfile -t oss-conductor:v3.21.4 +``` From 42251ac39c7de0cdcaa0f4b11617762269e9c9e6 Mon Sep 17 00:00:00 2001 From: Kay Ulbrich Date: Fri, 23 Aug 2024 16:47:52 +0200 Subject: [PATCH 3/5] Added to README --- docker/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 2f80e85d0..d096159a1 100644 --- a/docker/README.md +++ b/docker/README.md @@ -70,7 +70,9 @@ It has been observed, that the UI build may fail with an error message like This can happen, even if the network resources `yarn` tries to use are available, but there is too much network latency. `yarn` accepts the option `--network-timeout` to set a custom timeout in milliseconds. -For passing arguments to `yarn`, in [this Dockerfile](server/Dockerfile) the build arg `YARN_OPTS` has been added. This argument will be added to each `yarn` call. When using one of the `docker-compose-*` files, you can set this via the eponymous environment variable `YARN_OPTS`, e.g.: +For passing arguments to `yarn`, in [this Dockerfile](server/Dockerfile) the build arg `YARN_OPTS` has been added. This argument will be added to each `yarn` call. It is not compulsory to set this argument. + +When using one of the `docker-compose-*` files, you can set this via the eponymous environment variable `YARN_OPTS`, e.g.: ``` YARN_OPTS='--network-timeout 10000000' docker compose -f docker-compose.yaml up From 218a6001012d87a9040a951e887678565f906492 Mon Sep 17 00:00:00 2001 From: kay-horst <37873708+kay-horst@users.noreply.github.com> Date: Sat, 24 Aug 2024 13:42:46 +0200 Subject: [PATCH 4/5] Corrected wording --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index d096159a1..1074cbe10 100644 --- a/docker/README.md +++ b/docker/README.md @@ -72,7 +72,7 @@ This can happen, even if the network resources `yarn` tries to use are available For passing arguments to `yarn`, in [this Dockerfile](server/Dockerfile) the build arg `YARN_OPTS` has been added. This argument will be added to each `yarn` call. It is not compulsory to set this argument. -When using one of the `docker-compose-*` files, you can set this via the eponymous environment variable `YARN_OPTS`, e.g.: +When using one of the `docker-compose-*` files, you can set this via the environment variable `YARN_OPTS`, e.g.: ``` YARN_OPTS='--network-timeout 10000000' docker compose -f docker-compose.yaml up From 467a6a6bd02d243b9c348f1eae8770b82c9c2f92 Mon Sep 17 00:00:00 2001 From: kay-horst <37873708+kay-horst@users.noreply.github.com> Date: Sat, 24 Aug 2024 15:39:22 +0200 Subject: [PATCH 5/5] Improved wording --- docker/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 1074cbe10..809260c1c 100644 --- a/docker/README.md +++ b/docker/README.md @@ -68,9 +68,9 @@ It has been observed, that the UI build may fail with an error message like 953.6 info There appears to be trouble with your network connection. Retrying... ``` -This can happen, even if the network resources `yarn` tries to use are available, but there is too much network latency. `yarn` accepts the option `--network-timeout` to set a custom timeout in milliseconds. +This does not necessarily mean, that the network is unavailable, but can be caused by too high latency, as well. `yarn` accepts the option `--network-timeout <#ms>` to set a custom timeout in milliseconds. -For passing arguments to `yarn`, in [this Dockerfile](server/Dockerfile) the build arg `YARN_OPTS` has been added. This argument will be added to each `yarn` call. It is not compulsory to set this argument. +For passing arguments to `yarn`, in [this Dockerfile](server/Dockerfile) the _optional_ build arg `YARN_OPTS` has been added. This argument will be added to each `yarn` call. When using one of the `docker-compose-*` files, you can set this via the environment variable `YARN_OPTS`, e.g.: