Refactoring for using Docker behind a proxy
This commit is contained in:
parent
ec5111949d
commit
ad06197b55
10
README.md
10
README.md
|
@ -37,3 +37,13 @@ vagrant ssh n3 -c 'sudo /vagrant/join.sh /vagrant/example/vagrant-config.yaml'
|
||||||
```bash
|
```bash
|
||||||
docker build -t quay.io/attcomdev/promenade:experimental .
|
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:
|
||||||
|
|
||||||
|
```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"
|
||||||
|
```
|
||||||
|
|
42
genesis.sh
42
genesis.sh
|
@ -8,12 +8,15 @@ fi
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
#Set working directory relative to script
|
#Promenade Variables
|
||||||
SCRIPT_DIR=$(dirname $0)
|
DOCKER_PACKAGE="docker.io"
|
||||||
pushd $SCRIPT_DIR
|
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=""
|
||||||
|
|
||||||
#Load Variables File
|
|
||||||
. variables.sh
|
|
||||||
|
|
||||||
mkdir -p /etc/docker
|
mkdir -p /etc/docker
|
||||||
cat <<EOS > /etc/docker/daemon.json
|
cat <<EOS > /etc/docker/daemon.json
|
||||||
|
@ -24,15 +27,34 @@ cat <<EOS > /etc/docker/daemon.json
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
#Configuration for Docker Behind a Proxy
|
#Configuration for Docker Behind a Proxy
|
||||||
if [ $USE_PROXY == true ]; then
|
mkdir -p /etc/systemd/system/docker.service.d
|
||||||
mkdir -p /etc/systemd/system/docker.service.d
|
|
||||||
CreateProxyConfiguraton
|
#Set HTTPS Proxy Variable
|
||||||
fi
|
cat <<EOF > /etc/systemd/system/docker.service.d/http-proxy.conf
|
||||||
|
[Service]
|
||||||
|
Environment="HTTP_PROXY=${DOCKER_HTTPS_PROXY}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#Set HTTPS Proxy Variable
|
||||||
|
cat <<EOF > /etc/systemd/system/docker.service.d/https-proxy.conf
|
||||||
|
[Service]
|
||||||
|
Environment="HTTPS_PROXY=${DOCKER_HTTPS_PROXY}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#Set No Proxy Variable
|
||||||
|
cat <<EOF > /etc/systemd/system/docker.service.d/no-proxy.conf
|
||||||
|
[Service]
|
||||||
|
Environment="NO_PROXY=${DOCKER_NO_PROXY}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#Reload systemd and docker if present
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart docker || true
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
apt-get install -y -qq --no-install-recommends \
|
apt-get install -y -qq --no-install-recommends \
|
||||||
docker.io=$DOCKER_VERSION \
|
$DOCKER_PACKAGE=$DOCKER_VERSION \
|
||||||
|
|
||||||
|
|
||||||
if [ -f "${PROMENADE_LOAD_IMAGE}" ]; then
|
if [ -f "${PROMENADE_LOAD_IMAGE}" ]; then
|
||||||
|
|
42
join.sh
42
join.sh
|
@ -8,12 +8,15 @@ fi
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
#Set working directory relative to script
|
#Promenade Variables
|
||||||
SCRIPT_DIR=$(dirname $0)
|
DOCKER_PACKAGE="docker.io"
|
||||||
pushd $SCRIPT_DIR
|
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=""
|
||||||
|
|
||||||
#Load Variables File
|
|
||||||
. variables.sh
|
|
||||||
|
|
||||||
mkdir -p /etc/docker
|
mkdir -p /etc/docker
|
||||||
cat <<EOS > /etc/docker/daemon.json
|
cat <<EOS > /etc/docker/daemon.json
|
||||||
|
@ -24,15 +27,34 @@ cat <<EOS > /etc/docker/daemon.json
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
#Configuration for Docker Behind a Proxy
|
#Configuration for Docker Behind a Proxy
|
||||||
if [ $USE_PROXY == true ]; then
|
mkdir -p /etc/systemd/system/docker.service.d
|
||||||
mkdir -p /etc/systemd/system/docker.service.d
|
|
||||||
CreateProxyConfiguraton
|
#Set HTTPS Proxy Variable
|
||||||
fi
|
cat <<EOF > /etc/systemd/system/docker.service.d/http-proxy.conf
|
||||||
|
[Service]
|
||||||
|
Environment="HTTP_PROXY=${DOCKER_HTTPS_PROXY}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#Set HTTPS Proxy Variable
|
||||||
|
cat <<EOF > /etc/systemd/system/docker.service.d/https-proxy.conf
|
||||||
|
[Service]
|
||||||
|
Environment="HTTPS_PROXY=${DOCKER_HTTPS_PROXY}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#Set No Proxy Variable
|
||||||
|
cat <<EOF > /etc/systemd/system/docker.service.d/no-proxy.conf
|
||||||
|
[Service]
|
||||||
|
Environment="NO_PROXY=${DOCKER_NO_PROXY}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#Reload systemd and docker if present
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart docker || true
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
apt-get install -y -qq --no-install-recommends \
|
apt-get install -y -qq --no-install-recommends \
|
||||||
docker.io=$DOCKER_VERSION \
|
$DOCKER_PACKAGE=$DOCKER_VERSION \
|
||||||
|
|
||||||
|
|
||||||
if [ -f "${PROMENADE_LOAD_IMAGE}" ]; then
|
if [ -f "${PROMENADE_LOAD_IMAGE}" ]; then
|
||||||
|
|
Loading…
Reference in New Issue