Merge "Updated dev-minimal to deploy behind proxy"

This commit is contained in:
Zuul 2018-07-30 00:47:48 +00:00 committed by Gerrit Code Review
commit 3dd7150fef
2 changed files with 60 additions and 7 deletions

View File

@ -52,6 +52,11 @@ export WORKSPACE=${WORKSPACE:-"/root/deploy"}
# The site to deploy # The site to deploy
TARGET_SITE=${TARGET_SITE:-"dev"} TARGET_SITE=${TARGET_SITE:-"dev"}
# Setup blank defaults for proxy variables
http_proxy=${http_proxy:-""}
https_proxy=${https_proxy:-""}
no_proxy=${no_proxy:-""}
# The host name for the single-node deployment. e.g.: 'genesis' # The host name for the single-node deployment. e.g.: 'genesis'
SHORT_HOSTNAME=${SHORT_HOSTNAME:-""} SHORT_HOSTNAME=${SHORT_HOSTNAME:-""}
# The host ip for this single-node deployment. e.g.: '10.0.0.9' # The host ip for this single-node deployment. e.g.: '10.0.0.9'
@ -122,6 +127,34 @@ function setup_workspace() {
chmod -R 777 ${WORKSPACE}/genesis chmod -R 777 ${WORKSPACE}/genesis
} }
function configure_docker() {
if [[ ! -z "${https_proxy}" ]] || [[ ! -z "${http_proxy}" ]]
then
echo "Configuring Docker to use a proxy..."
mkdir -p /etc/systemd/system/docker.service.d/
cat << EOF > /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=${http_proxy}"
Environment="HTTPS_PROXY=${https_proxy}"
Environment="NO_PROXY=${no_proxy}"
EOF
systemctl daemon-reload
systemctl restart docker
fi
}
function configure_apt() {
if [[ ! -z "${https_proxy}" ]] || [[ ! -z "${http_proxy}" ]]
then
echo "Configuring apt to use a proxy..."
mkdir -p /etc/apt/
cat << EOF > /etc/apt/apt.conf
Acquire::http::proxy "${http_proxy}";
Acquire::https::proxy "${https_proxy}";
EOF
fi
}
function get_repo() { function get_repo() {
# Setup a repository in the workspace # Setup a repository in the workspace
# #
@ -183,8 +216,9 @@ function generate_certs() {
cp "${WORKSPACE}/collected"/*.yaml ${WORKSPACE}/genesis cp "${WORKSPACE}/collected"/*.yaml ${WORKSPACE}/genesis
docker run --rm -t \ docker run --rm -t \
-e http_proxy=$PROXY \ -e http_proxy=$http_proxy \
-e https_proxy=$PROXY \ -e https_proxy=$https_proxy \
-e no_proxy=$no_proxy \
-w /target \ -w /target \
-e PROMENADE_DEBUG=false \ -e PROMENADE_DEBUG=false \
-v ${WORKSPACE}/genesis:/target \ -v ${WORKSPACE}/genesis:/target \
@ -206,8 +240,9 @@ function lint_design() {
function generate_genesis() { function generate_genesis() {
# Generate the genesis scripts # Generate the genesis scripts
docker run --rm -t \ docker run --rm -t \
-e http_proxy=$PROXY \ -e http_proxy=$http_proxy \
-e https_proxy=$PROXY \ -e https_proxy=$https_proxy \
-e no_proxy=$no_proxy \
-w /target \ -w /target \
-e PROMENADE_DEBUG=false \ -e PROMENADE_DEBUG=false \
-v ${WORKSPACE}/genesis:/target \ -v ${WORKSPACE}/genesis:/target \
@ -343,10 +378,12 @@ trap clean EXIT
# Common steps for all breakpoints specified # Common steps for all breakpoints specified
check_preconditions || error "checking for preconditions" check_preconditions || error "checking for preconditions"
configure_apt || error "configuring apt behind proxy"
setup_workspace || error "setting up workspace directories" setup_workspace || error "setting up workspace directories"
setup_repos || error "setting up Git repos" setup_repos || error "setting up Git repos"
configure_dev_configurables || error "adding dev-configurables values" configure_dev_configurables || error "adding dev-configurables values"
install_dependencies || error "installing dependencies" install_dependencies || error "installing dependencies"
configure_docker || error "configuring docker behind proxy"
# collect # collect
if [[ ${STEP_BREAKPOINT} -ge 10 ]]; then if [[ ${STEP_BREAKPOINT} -ge 10 ]]; then

View File

@ -28,7 +28,20 @@ Process
recommended. 32GB of disk is enough, use more if you plan on doing any recommended. 32GB of disk is enough, use more if you plan on doing any
extended use. extended use.
2) Become root. All the commands are run as root. 2) Become root. All the commands are run as root.
3) Update etc/hosts with IP/Hostname of your VM. e.g. 10.0.0.15 testvm1 3) Update etc/hosts with IP/Hostname of your VM. e.g. 10.0.0.15 testvm1.
Note: If running this behind a corporate proxy, you will need to update the
/etc/environment file, and append your proxy configurtion there.
Then you will need to source the /etc/environment to set the proxy
environment.
For instance, you will need to add following lines in the
/etc/environment file, and then source it:
export http_proxy="your.proxy.address:port"
export https_proxy="your.proxy.address:port"
export no_proxy=".foo.com,.cluster.local,localhost,127.0.0.0/8,10.0.0.0/24"
export HTTP_PROXY="http://your.proxy.address:port"
export HTTPS_PROXY="http://your.proxy.address:port"
export NO_PROXY=".foo.com,.cluster.local,localhost,127.0.0.0/8,10.0.0.0/24"
4) go to /root/deploy and clone airship-in-a-bottle. Switch to a target 4) go to /root/deploy and clone airship-in-a-bottle. Switch to a target
patchset if needed patchset if needed
4a) If you use a directory other than /root/deploy, /root/deploy will be 4a) If you use a directory other than /root/deploy, /root/deploy will be
@ -40,8 +53,11 @@ Process
NOTE: If running this behind a corporate proxy, you will need to update the NOTE: If running this behind a corporate proxy, you will need to update the
file deployment_files/site/dev-proxy/networks/common-addresses.yaml to file deployment_files/site/dev-proxy/networks/common-addresses.yaml to
specify your proxy server and appropriate no_proxy list. Also change specify your proxy server and appropriate no_proxy list. In this file,
set-env.sh to use TARGET_SITE of 'dev-proxy'. also update the dns list, and add your corporate name servers to the
dns list. This is done for name resolution of internal corporate
addresses behind the proxy.
Also change set-env.sh to use TARGET_SITE of 'dev-proxy'.
8) ../common/deploy-airship.sh 8) ../common/deploy-airship.sh
You may sepecify a target point to stop the deployment by using an argument of You may sepecify a target point to stop the deployment by using an argument of