From e34ca98f8764ee163ca920bce1bf2577217a2f14 Mon Sep 17 00:00:00 2001 From: Olaf Meeuwissen Date: Mon, 1 Feb 2021 14:23:27 +0900 Subject: [PATCH 1/3] Support proxy exceptions --- docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index ace282f29..8f4dd44b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,12 +8,14 @@ services: args: - https_proxy - http_proxy + - no_proxy command: mvn -v environment: KNOWLEDGE_TEST_MAIL: 'false' MAVEN_CONFIG: /var/maven/.m2 https_proxy: ${https_proxy} http_proxy: ${http_proxy} + no_proxy: ${no_proxy} working_dir: /usr/src/mymaven/ entrypoint: '' volumes: @@ -35,6 +37,7 @@ services: environment: https_proxy: ${https_proxy} http_proxy: ${http_proxy} + no_proxy: ${no_proxy} volumes: - ${KNOWLEDGE_HOME}.knowledge:/root/.knowledge - $PWD/target/webapps:/usr/local/tomcat/webapps From bbbbb70f45f18b19ec6239c7f19dbaefeab79859 Mon Sep 17 00:00:00 2001 From: Olaf Meeuwissen Date: Mon, 1 Feb 2021 14:24:47 +0900 Subject: [PATCH 2/3] Propagate proxy settings to maven invocations --- launch.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/launch.sh b/launch.sh index 633d9a5ef..045b7360d 100755 --- a/launch.sh +++ b/launch.sh @@ -1,8 +1,25 @@ #!/bin/bash -eu -docker-compose run --rm maven mvn install -DskipTests=true -Dmaven.javadoc.skip=true -e -# docker-compose run --rm maven mvn clean test site -e -docker-compose run --rm maven mvn clean package -e +propagate_proxy_vars () { + # For newer JVM versions, use this instead. + # echo " -Djava.net.useSystemProxies=true" + + if test -n "$https_proxy"; then + echo " -Dhttps.proxyHost=$(echo $https_proxy | sed 's|.*://||; s|:.*||')" + echo " -Dhttps.proxyPort=$(echo $https_proxy | sed 's|.*:||')" + fi + if test -n "$http_proxy"; then + echo " -Dhttp.proxyHost=$(echo $http_proxy | sed 's|.*://||; s|:.*||')" + echo " -Dhttp.proxyPort=$(echo $http_proxy | sed 's|.*:||')" + fi + if test -n "$no_proxy"; then + echo " -Dhttp.nonProxyHosts=$(echo $no_proxy | sed 's/,\./,*./g; s/,/|/g')" + fi +} + +docker-compose run --rm maven mvn install -DskipTests=true -Dmaven.javadoc.skip=true -e $(propagate_proxy_vars) +# docker-compose run --rm maven mvn clean test site -e $(propagate_proxy_vars) +docker-compose run --rm maven mvn clean package -e $(propagate_proxy_vars) mkdir target/webapps mv target/knowledge.war target/webapps/ROOT.war From 6b6dee1c9112759830d8944e83d7e88261f7fb7f Mon Sep 17 00:00:00 2001 From: Olaf Meeuwissen Date: Mon, 1 Feb 2021 14:25:37 +0900 Subject: [PATCH 3/3] Fix permission issue when launching as a normal user --- launch.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/launch.sh b/launch.sh index 045b7360d..da93fef0f 100755 --- a/launch.sh +++ b/launch.sh @@ -21,8 +21,9 @@ docker-compose run --rm maven mvn install -DskipTests=true -Dmaven.javadoc.skip= # docker-compose run --rm maven mvn clean test site -e $(propagate_proxy_vars) docker-compose run --rm maven mvn clean package -e $(propagate_proxy_vars) -mkdir target/webapps -mv target/knowledge.war target/webapps/ROOT.war +# Run everything through docker-compose to work around permission issues. +docker-compose run --rm maven mkdir target/webapps +docker-compose run --rm maven mv target/knowledge.war target/webapps/ROOT.war docker-compose up --build -d tomcat docker-compose logs -f tomcat