OpenLiberty / ci.docker

Eclipse Public License 1.0
43 stars 59 forks source link

Proxy configuration for features.sh #460

Open suxlv2 opened 1 year ago

suxlv2 commented 1 year ago

no_proxy isn't used or just ignored.

Using open-liberty:23.0.0.6-kernel-slim-java11-openj9-ubi.

The problem: (features.sh) Regardless of the existing proxy settings, script reports, that it can not access my local maven repository. Tried dozens of combinations: with & w/o ENV _httpproxy & _httpsproxy & _noproxy values in Dockerfile. With & w/o proxy set in featureUtility.properties & repositories.properties.

All I see in the log is just:

> [17/19] RUN features.sh:
1.285 <---------------------> 0.00%
1.343 https://artifact.myhost.com/internal cannot be connected
1.356 <---------------------> 0.00%
1.431 https://artifact.myhost.com/external cannot be connected
1.442 <---------------------> 0.00%
1.504 https://artifact.myhost.com/thirdparty cannot be connected
1.511 <---------------------> 0.00%
1.534 https://repo.maven.apache.org/maven2/ cannot be connected
1.547 <---------------------> 0.00%
1.554 CWWKF1390E: The configured Maven Repository cannot be reached. Verify that your computer has network access and firewalls are configured correctly, then try the action again. If the connection still fails, the repository server might be temporarily unavailable.

Clarification: https://repo.maven.apache.org/maven2/ is blocked in my network, so the log message seems to be OK. Even with proxy this one isn't allowed in our network.

Dockerfile (removed/masked few lines)

FROM icr-io.artifact.myhost.com/appcafe/open-liberty:23.0.0.6-kernel-slim-java11-openj9-ubi

ENV HTTP_PROXY=http://proxy.myhost.com:8080
ENV http_proxy=${HTTP_PROXY}
ENV HTTPS_PROXY=${HTTP_PROXY}
ENV https_proxy=${HTTP_PROXY}
ENV NO_PROXY="127.0.0.1,localhost,docker.internal,artifact.myhost.com"
ENV no_proxy=${NO_PROXY}
ENV noProxy=${NO_PROXY}

COPY --chown=1001:0 /app-build/wlp/server/ /config/
COPY --chown=1001:0 /app-build/wlp/features/ /opt/ol/wlp/etc/
ENV VERBOSE true
RUN features.sh

COPY --chown=1001:0 /app-server/target/app.war /config/dropins/
EXPOSE 9080
RUN configure.sh

Clarification: The app.war was built in the same VM (fetched artifacts from the maven repo just fine), right before running the docker build.

Server.xml (features part)

    <featureManager>
        <feature>webProfile-8.0</feature>
        <feature>openidConnectClient-1.0</feature>
        <feature>mpMetrics-2.3</feature>
        <feature>concurrent-1.0</feature>
    </featureManager>

fetureUtility.properties

proxyHost=proxy.myhost.com
proxyPort=8080

mavenCentralMirror.url=https://artifact.myhost.com/external

remoteRepo1.url=https://artifact.myhost.com/internal
remoteRepo2.url=https://artifact.myhost.com/external
remoteRepo3.url=https://artifact.myhost.com/thirdparty

repositories.properties

proxyHost=proxy.myhost.com
proxyPort=8080
kabicin commented 1 year ago

@suxlv2 Feature Utility doesn't support no_proxy currently but it looks like there is an issue already tracking that here https://github.com/OpenLiberty/open-liberty/issues/23684.

Unless you are able to use your local network (i.e. build with --network=host) that proxies to your local Maven repo on your host or connect to a manually created network that proxies to your local Maven repo within a container, it may not be currently possible. Edit: looks like FEATURE_REPO_URL won't support this type of reverse proxy approach as you aren't able to access https://repo.maven.apache.org/maven2/

Could you please elaborate a bit more on the need for the no_proxy flag?

leochr commented 8 months ago

@suxlv2 Are you still facing this problem? If so, please provide answers to the above questions raised by @kabicin. Thank you.