fuel-library/files/fuel-docker-utils/dockerctl_config
Maksim Malchuk 07c3add419 Revert "Fix path to diagnostic snapshot"
This reverts commit dfad93c217.

Change-Id: Ic0fa223850285fe5e639666b7cd8306f08044b96
Partial-Bug: #1541785
2016-02-04 11:13:52 +00:00

149 lines
6.2 KiB
Bash

#!/bin/bash
### Container information
#Paths
DOCKER_ROOT="/var/www/nailgun/docker"
IMAGE_DIR="${DOCKER_ROOT}/images"
SOURCE_DIR="${DOCKER_ROOT}/sources"
ASTUTE_YAML="/etc/fuel/astute.yaml"
FUEL_RELEASE_FILE="/etc/fuel_release"
DOCKER_ENGINE="native"
ADMIN_IP="10.20.0.2"
LOCAL_IP="127.0.0.1"
SYSTEMCTL="/usr/bin/systemctl"
# Version of Fuel to deploy
VERSION=${VERSION_OVERRIDE:-$(cat $FUEL_RELEASE_FILE)}
if [ -z "$VERSION" ]; then
VERSION="_VERSION_"
fi
SYSTEMD="false"
IMAGE_PREFIX="fuel"
# busybox image for storage containers
BUSYBOX_IMAGE="busybox.tar.gz"
# base centos image for all containers
BASE_IMAGE="centos.tar.gz"
# Order in which to start all containers
CONTAINER_SEQUENCE="postgres rabbitmq keystone rsync astute rsyslog nailgun ostf nginx cobbler mcollective"
# storage container names
PREFIX_STORAGE="fuel-core-${VERSION}-volume-"
# app container names
declare -A CONTAINER_NAMES
prefix="fuel-core-${VERSION}-"
CONTAINER_NAMES['cobbler']="${prefix}cobbler"
CONTAINER_NAMES['postgres']="${prefix}postgres"
CONTAINER_NAMES['rabbitmq']="${prefix}rabbitmq"
CONTAINER_NAMES['rsync']="${prefix}rsync"
CONTAINER_NAMES['astute']="${prefix}astute"
CONTAINER_NAMES['nailgun']="${prefix}nailgun"
CONTAINER_NAMES['ostf']="${prefix}ostf"
CONTAINER_NAMES['nginx']="${prefix}nginx"
CONTAINER_NAMES['rsyslog']="${prefix}rsyslog"
CONTAINER_NAMES['mcollective']="${prefix}mcollective"
CONTAINER_NAMES['keystone']="${prefix}keystone"
# app container options
declare -A CONTAINER_OPTIONS
base_opts="-t --net=host"
FOREGROUND="-i"
BACKGROUND="-d"
BIND_ALL=""
BIND_ADMIN="${ADMIN_IP}:"
BIND_LOCAL="${LOCAL_IP}:"
CONTAINER_OPTIONS["cobbler"]="-p ${BIND_ALL}53:53/udp -p ${BIND_ALL}69:69/udp -p ${BIND_ALL}80:80 -p ${BIND_ALL}443:443 --privileged $base_opts"
CONTAINER_OPTIONS["postgres"]="-p ${BIND_ADMIN}5432:5432 -p ${BIND_LOCAL}5432:5432 $base_opts"
CONTAINER_OPTIONS["rabbitmq"]="-p ${BIND_ADMIN}5672:5672 -p ${BIND_LOCAL}5672:5672 -p ${BIND_ADMIN}4369:4369 -p ${BIND_LOCAL}4369:4369 -p ${BIND_ADMIN}15672:15672 -p ${BIND_LOCAL}15672:15672 -p ${BIND_ADMIN}61613:61613 -p ${BIND_LOCAL}61613:61613 $base_opts"
CONTAINER_OPTIONS["rsync"]="-p ${BIND_ADMIN}873:873 -p ${BIND_LOCAL}873:873 $base_opts"
CONTAINER_OPTIONS["astute"]="$base_opts"
CONTAINER_OPTIONS["nailgun"]="--privileged -p ${BIND_ADMIN}8001:8001 -p ${BIND_LOCAL}8001:8001 $base_opts"
CONTAINER_OPTIONS["ostf"]="-p ${BIND_ADMIN}8777:8777 -p ${BIND_LOCAL}8777:8777 $base_opts"
CONTAINER_OPTIONS["nginx"]="-p ${BIND_ALL}8000:8000 -p ${BIND_ALL}8080:8080 $base_opts"
CONTAINER_OPTIONS["rsyslog"]="--privileged -p ${BIND_ADMIN}514:514 -p ${BIND_LOCAL}514:514 -p ${BIND_ADMIN}514:514/udp -p ${BIND_LOCAL}514:514/udp -p ${BIND_ADMIN}25150:25150 -p ${BIND_LOCAL}25150:25150 $base_opts"
CONTAINER_OPTIONS["mcollective"]="--privileged $base_opts"
CONTAINER_OPTIONS["keystone"]="-p ${BIND_ALL}5000:5000 -p ${BIND_ALL}35357:35357 $base_opts"
######
#Dependency of volumes for deployment
#####
#Host volumes
declare -A HOST_VOL
HOST_VOL['repo']="-v /var/www/nailgun:/var/www/nailgun:rw"
HOST_VOL['puppet']="-v /etc/puppet:/etc/puppet:ro"
HOST_VOL['sshkey']="-v /root/.ssh:/root/.ssh:ro"
HOST_VOL['astuteyaml']="-v /etc/fuel:/etc/fuel:ro"
HOST_VOL['logs']="-v /var/log/docker-logs:/var/log"
HOST_VOL['keys']="-v /var/lib/fuel/keys:/var/lib/fuel/keys:rw"
HOST_VOL['ibp']="-v /var/lib/fuel/ibp:/var/lib/fuel/ibp:rw"
HOST_VOL['fuel_bootstrap_cli']="-v /etc/fuel-bootstrap-cli:/etc/fuel-bootstrap-cli:rw"
HOST_VOL['logs_dump']="-v /var/log/dump:/var/dump:rw"
#Persistent directories for container data
HOST_VOL['astute_data']="-v /var/lib/fuel/container_data/$VERSION/astute:/var/lib/astute"
HOST_VOL['cobbler_data']="-v /var/lib/fuel/container_data/$VERSION/cobbler:/var/lib/cobbler"
HOST_VOL['postgres_data']="-v /var/lib/fuel/container_data/$VERSION/postgres:/var/lib/pgsql"
HOST_VOL['dnsmasq']="-v /var/lib/fuel/container_data/$VERSION/dnsmasq:/etc/dnsmasq.d"
HOST_VOL['mcollective_data']="-v /var/lib/fuel/container_data/$VERSION/mcollective:/etc/hiera"
#Storage container volume mounts
declare -A CONTAINER_VOLUMES
#Format: CONTAINER_VOLUMES[$FOO_CNT]="${HOST_VOL['foo']}"
#Storage container volumes
#Format: FOO_VOL="--volumes-from $FOO_CNT"
#Nailgun static files are in nailgun container
NAILGUN_VOL="--volumes-from ${CONTAINER_NAMES['nailgun']}"
COBBLER_VOL="--volumes-from ${CONTAINER_NAMES['cobbler']}"
ASTUTE_VOL="--volumes-from ${CONTAINER_NAMES['astute']}"
#App container volume mounts
###requirements cheat sheet
###ALL: astuteyaml repo logs
###puppet: rsync
###sshkey: nailgun cobbler astute mcollective ostf
###repo: nginx mcollective
###nailgun: nginx
###cobbler: mcollective
###astute: mcollective
declare -A REQS
REQS["${HOST_VOL['astuteyaml']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
REQS["${HOST_VOL['keys']}"]="mcollective astute"
REQS["${HOST_VOL['repo']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
REQS["${HOST_VOL['logs']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
#Most containers work from local integrated puppet, but rsync needs to serve host puppet
REQS["${HOST_VOL['puppet']}"]="rsync"
#Uncomment to enable host puppet manifests
#REQS["${HOST_VOL['puppet']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
REQS["${HOST_VOL['astute_data']}"]="astute"
REQS["${HOST_VOL['cobbler_data']}"]="cobbler"
REQS["${HOST_VOL['dnsmasq']}"]="cobbler mcollective"
REQS["${HOST_VOL['postgres_data']}"]="postgres"
REQS["${HOST_VOL['mcollective_data']}"]="mcollective"
REQS["${HOST_VOL['sshkey']}"]="nailgun cobbler astute mcollective ostf"
REQS["${HOST_VOL['ibp']}"]="mcollective"
REQS["$NAILGUN_VOL"]="nginx"
REQS["$COBBLER_VOL"]="mcollective"
REQS["$ASTUTE_VOL"]="mcollective"
REQS["${HOST_VOL['fuel_bootstrap_cli']}"]="mcollective"
REQS["${HOST_VOL['logs_dump']}"]="mcollective nginx"
#assemble requirements
for requirement in "${!REQS[@]}"; do
for container in ${REQS["$requirement"]}; do
CONTAINER_VOLUMES["$container"]+="${requirement} "
done
done
#backup settings
SYSTEM_DIRS="/etc/fuel /var/lib/fuel /root/.ssh /var/www/nailgun/plugins"
FULL_BACKUP_DIRS="/etc/puppet /var/www/nailgun"
BACKUP_ROOT="/var/backup/fuel"
# number of retries for "docker check"
CHECK_RETRIES=240