S3 Proxy Settings
S3 application may use some third-party online services. For the current version of the S3 application only Currency Rate services (https://currencylayer.com/) are used. It makes a call to http://apilayer.net/api/live
.
For cases when outbound HTTP connections are handled by Proxy Servers some additional parameters should be configured.
S3 Environment Settings (.env)
In the project home directory find a file named .env
. The file was mentioned in the S3 deployment chapter.
Add additional settings:
USE_SYSTEM_PROXIES=false
HTTP_PROXY_HOST=
HTTP_PROXY_PORT=
HTTP_NON_PROXY_HOSTS=
HTTPS_PROXY_HOST=
HTTPS_PROXY_PORT=
PROXY_USER=
PROXY_PASSWORD=
Set proper values to the corresponding parameters:
USE_SYSTEM_PROXIES
: Should be setfalse
by default. Settrue
in case Operating System has proxy settings configured globally. Whentrue
other settings are not applied.HTTP_PROXY_HOST
: HTTP proxy host name or ip-address. For example:proxy.mycorp.com
.HTTP_PROXY_PORT
: HTTP proxy port. For example:80
or8080
HTTP_NON_PROXY_HOSTS
: A list of hosts (separated by|
) that should be reached directly, bypassing the proxy. For example:localhost|host.example.com
HTTPS_PROXY_HOST
:HTTPS (HTTP over SSL) proxy server host name or ip-address.HTTPS_PROXY_PORT
: HTTPS proxy server port.PROXY_USER
: Username for proxy servers that need authentication.PROXY_PASSWORD
: Proxy server password.
and save the file.
Docker Compose Configuration
In the project home directory find docker-compose.yml
file.
Without proxy settings lines 18-23 (may vary) usually configured this way:
backend:
build: registry.gitlab.com/metaphor/stratega-fm/fm-backend:sgw-prod-latest
command: "-Dswarm.datasources.data-sources.S3DS.connection-url=jdbc:postgresql://db/${POSTGRES_DB} -Dswarm.datasources.data-sources.S3DS.user-name=${POSTGRES_USER} -Dswarm.datasources.data-sources.S3DS.password=${POSTGRES_PASSWORD} -DkeycloakServerUrl=http://auth:8180/auth -DkeycloakServerHost=${KEYCLOAK_SERVER_HOST} -DkeycloakServerProto=${KEYCLOAK_SERVER_PROTO} -DkeycloakRealm=${KEYCLOAK_REALM} -DkeycloakUsername=${KEYCLOAK_USER} -DkeycloakPassword=${KEYCLOAK_PASSWORD} -DkeycloakClientId=${KEYCLOAK_CLIENT_ID} -DkeycloakApplicationRealm=${KEYCLOAK_APPLICATION_REALM} -Djava.net.preferIPv4Stack=true"
links:
- db
- auth
Change the third line with the command
and add following settings to the end of the command
after -Djava.net.preferIPv4Stack=true
(delimited by a space character):
-Djava.net.useSystemProxies=${USE_SYSTEM_PROXIES} -Dhttp.proxyHost=${HTTP_PROXY_HOST} -Dhttp.proxyPort=${HTTP_PROXY_PORT} -Dhttp.nonProxyHosts=${HTTP_NON_PROXY_HOSTS} -Dhttps.proxyHost=${HTTPS_PROXY_HOST} -Dhttps.proxyPort=${HTTPS_PROXY_PORT} -Dhttp.proxyUser=${PROXY_USER} -Dhttp.proxyPassword=${PROXY_PASSWORD}
and save the file.
You'll should have the following settings:
backend:
build: ./fm-backend
command: "-Dswarm.datasources.data-sources.S3DS.connection-url=jdbc:postgresql://db/${POSTGRES_DB} -Dswarm.datasources.data-sources.S3DS.user-name=${POSTGRES_USER} -Dswarm.datasources.data-sources.S3DS.password=${POSTGRES_PASSWORD} -DkeycloakServerUrl=http://auth:8180/auth -DkeycloakServerHost=${KEYCLOAK_SERVER_HOST} -DkeycloakServerProto=${KEYCLOAK_SERVER_PROTO} -DkeycloakRealm=${KEYCLOAK_REALM} -DkeycloakUsername=${KEYCLOAK_USER} -DkeycloakPassword=${KEYCLOAK_PASSWORD} -DkeycloakClientId=${KEYCLOAK_CLIENT_ID} -DkeycloakApplicationRealm=${KEYCLOAK_APPLICATION_REALM} -Djava.net.preferIPv4Stack=true -Djava.net.useSystemProxies=${USE_SYSTEM_PROXIES} -Dhttp.proxyHost=${HTTP_PROXY_HOST} -Dhttp.proxyPort=${HTTP_PROXY_PORT} -Dhttp.nonProxyHosts=${HTTP_NON_PROXY_HOSTS} -Dhttps.proxyHost=${HTTPS_PROXY_HOST} -Dhttps.proxyPort=${HTTPS_PROXY_PORT} -Dhttp.proxyUser=${PROXY_USER} -Dhttp.proxyPassword=${PROXY_PASSWORD}"
links:
- db
- auth
Restart
Make an S3 Update if necessary. Restart the application.