Adding support for Environment variables with sudo -E

This commit is contained in:
Aric Renzo 2017-06-19 15:43:53 -04:00
parent 5cd2400c21
commit 758b1c0928
3 changed files with 17 additions and 14 deletions

View File

@ -40,10 +40,13 @@ docker build -t quay.io/attcomdev/promenade:experimental .
## Using Promenade Behind a Proxy
Modify the `genesis.sh` and `proxy.sh` scripts, passing in the URL and ports of the proxy server relative to the cluster hosts:
To use Promenade from behind a proxy, simply export `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` environment variables on the vagrant host prior to executing the `genesis.sh` and `join.sh` scripts respectively. Alternatively, you may also export the `DOCKER_HTTP_PROXY`, `DOCKER_HTTPS_PROXY`, and `DOCKER_NO_PROXY` directly. Ensure you are running the script with `sudo -E` option to preserve the environment variables.
```bash
DOCKER_HTTP_PROXY="http://proxy.server.com:8080"
DOCKER_HTTPS_PROXY="https://proxy.server.com:8080"
DOCKER_NO_PROXY="localhost,127.0.0.1"
vagrant ssh n0
cd /vagrant
export DOCKER_HTTP_PROXY="http://proxy.server.com:8080"
export DOCKER_HTTPS_PROXY="https://proxy.server.com:8080"
export DOCKER_NO_PROXY="localhost,127.0.0.1"
sudo -E /vagrant/genesis.sh /vagrant/example/vagrant-config.yaml
```

View File

@ -12,10 +12,10 @@ set -ex
DOCKER_PACKAGE="docker.io"
DOCKER_VERSION=1.12.6-0ubuntu1~16.04.1
#Proxy Variables - set only if deploying behind a proxy
DOCKER_HTTP_PROXY=""
DOCKER_HTTPS_PROXY=""
DOCKER_NO_PROXY=""
#Proxy Variables
DOCKER_HTTP_PROXY=${DOCKER_HTTP_PROXY:-${HTTP_PROXY:-${http_proxy}}}
DOCKER_HTTPS_PROXY=${DOCKER_HTTPS_PROXY:-${HTTPS_PROXY:-${https_proxy}}}
DOCKER_NO_PROXY=${DOCKER_NO_PROXY:-${NO_PROXY:-${no_proxy}}}
mkdir -p /etc/docker
@ -32,7 +32,7 @@ mkdir -p /etc/systemd/system/docker.service.d
#Set HTTPS Proxy Variable
cat <<EOF > /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=${DOCKER_HTTPS_PROXY}"
Environment="HTTP_PROXY=${DOCKER_HTTP_PROXY}"
EOF
#Set HTTPS Proxy Variable

10
join.sh
View File

@ -12,10 +12,10 @@ set -ex
DOCKER_PACKAGE="docker.io"
DOCKER_VERSION=1.12.6-0ubuntu1~16.04.1
#Proxy Variables - set only if deploying behind a proxy
DOCKER_HTTP_PROXY=""
DOCKER_HTTPS_PROXY=""
DOCKER_NO_PROXY=""
#Proxy Variables
DOCKER_HTTP_PROXY=${DOCKER_HTTP_PROXY:-${HTTP_PROXY:-${http_proxy}}}
DOCKER_HTTPS_PROXY=${DOCKER_HTTPS_PROXY:-${HTTPS_PROXY:-${https_proxy}}}
DOCKER_NO_PROXY=${DOCKER_NO_PROXY:-${NO_PROXY:-${no_proxy}}}
mkdir -p /etc/docker
@ -32,7 +32,7 @@ mkdir -p /etc/systemd/system/docker.service.d
#Set HTTPS Proxy Variable
cat <<EOF > /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=${DOCKER_HTTPS_PROXY}"
Environment="HTTP_PROXY=${DOCKER_HTTP_PROXY}"
EOF
#Set HTTPS Proxy Variable