If you are behind a forward proxy server and need to perform tasks that access the internet (such as installing MyST Studio), you will need to setup the forward proxy server settings.
Note: Throughout this article the '\' character is sometimes escaped as '%5c'.
Note: This level of configuration is for the current shell only, you can permanently apply this configuration in ~/.bashrc or ~/.bash_profile.
export http_proxy='http://<Domain>%5C<Username>:<Password>@<ProxyHost>:<ProxyPort>'
export https_proxy='<Protocol>://<Domain>%5C<Username>:<Password>@<ProxyHost>:<ProxyPort>'
export no_proxy="127.0.0.1, localhost,<CiServerIPHostName>,<CiServerIP>"
wget http://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
If the file is downloaded successfully, the proxy configuration is setup correctly. Now you can remove the file.
wget https://github.com/docker/compose/releases/download/1.14.0/docker-compose-$(uname -s)-$(name -m)
If the file is downloaded successfully, the proxy configuration is setup correctly. Now you can remove the file.
Note: This level of configuration is for yum only.
vi /etc/yum.conf
proxy=http://<ProxyHost>:<ProxyPort>
proxy_username=<Username>
proxy_password=<Password>
Install xclock to test yum internet connectivity.
sudo yum install xclock
Note: This level of configuration is for the docker service only and doesn't automatically apply the proxy configuration to the docker container (e.g. /bin/bash).
cat <<EOF | sudo tee -a /etc/sysconfig/docker
http_proxy='http://<Domain>%5C<Username>:<Password>@<ProxyHost>:<ProxyPort>'
https_proxy='<Protocol>://<Domain>%5C<Username>:<Password>@<ProxyHost>:<ProxyPort>'
EOF
Note: The no_proxy configuration is not required here. The docker service uses these proxy settings to pull images from internet, and docker won't be communicating to the CI server (or any internal servers). However, there should be no harm setting no_proxy.
sudo sed -i '/\[Service\]/a EnvironmentFile=/etc/sysconfig/docker' /usr/lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo service docker restart
Run command 'docker info' and check the Http Proxy and Https Proxy settings where '\' backslash is replaced with '%5C'.
Run a command where docker requires internet activity (e.g. /opt/app/myst-studio/bin/start.sh). If successful then the proxy is configured correctly.
Note: This level of configuration is for Jenkins only, this proxy setting doesn't automatically apply on any other applications.
Jenkins cannot communicate to proxy server that requires NTML Authentication. The solution is to force the JVM to enable "basic" authentication (Not NTML Authentication).
For information regarding NTML Authentication Issue:
The solution to this problem is to modify the jenkins yml file:
vi $MYSTSTUDIO_HOME/conf/ci/docker-compose-base.yml
Add the following line after the Port definition:
environment:
* JAVA_OPTS=-Dhttp.auth.preference="basic"
The Jenkins JVM will use basic authentication to the proxy, not NTLM authenication.
Once the yml file is modified, run /myst-studio/bin/restart.sh to bounce the jenkins container (This will also bounce all other docker containers).
Provide the proxy configuration in the Jenkins console. For example:
Note: The Advanced > Validate Proxy button will return "Failed to connect to http://www.google.com (code 407).", but the connection should still work. Simply ignore this error.
Note: This level of configuration is for Artifactory only, this proxy setting doesn't automatically apply on any other applications.
Artifactory cannot communicate to proxy server that requires NTML Authentication. The solution is to force the JVM to enable "basic" authentication (Not NTML Authentication).
The solution to this problem is to modify the jenkins yml file:
vi $MYSTSTUDIO_HOME/conf/maven/docker-compose.yml
Add the following line after the Port definition:
environment:
JAVA_OPTS=-Dhttp.auth.preference="basic"
The Artifactory JVM will use basic authentication to the proxy, not NTLM authenication.
Once the yml file is modified, run /myst-studio/bin/restart.sh to bounce the artifactory container (This will also bounce all other docker containers).
Provide the proxy configuration in the Artifactory console. For example:
Artifactory Console > Admin > Remote > Click on any Remote Repository (e.g. jcenter) > Click Test and make sure there is no error.
Note: This step isn't required if Artifactory is configured with Maven in settings.xml, because Artifactory will access Internet on behalf of Maven.
Add the below section to the global maven settings.xml file right after the root
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<username><Domain>%5C<Username></username>
<password><Password></password>
<host><ProxyHost></host>
<port><ProxyPort></port>
<nonProxyHosts><NoProxy></nonProxyHosts>
</proxy>
</proxies>
Follow the below steps:
mkdir /tmp/TestMaven
vi pom.xml
Add the below content and save the file.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
</project>
Run run the following command to test Maven's Internet connectivity.
mvn -U -X clean install
Ensure you have configured Artifactory with Internet connectivity.
Run run the following command to test Maven's Internet connectivity via Artifactory.
mvn -U -X clean install