Sets up a single node on a VM.

- Updates the config files to the local hostname, IP, and CIDR
   instead of in a VM.
- Without IP or CIDR it tries to guess at a reasonable value with
   the 'replace' argument.
- Example:
sudo ./tools/simple-deployment.sh examples/complete build replace 10.0.0.1 10.0.0.0\\\/24
 Then run genesis.sh

Change-Id: Idddfb828fc5d078ceb522be3e46e8bc7a2aac12b
This commit is contained in:
Aaron Sheffield 2018-03-16 15:23:36 -05:00
parent 47bf886ddd
commit 49e2a030fa
1 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,12 @@ PROMENADE_DEBUG=${PROMENADE_DEBUG:-0}
SCRIPT_DIR=$(realpath $(dirname $0))
CONFIG_SOURCE=$(realpath ${1:-${SCRIPT_DIR}/../examples/basic})
BUILD_DIR=$(realpath ${2:-${SCRIPT_DIR}/../build})
REPLACE=${3:-false}
HOSTNAME=$(hostname)
# If not provided, it takes a guess at the host IP Address
HOSTIP=${4:-$(hostname -I | cut -d' ' -f 1)}
# Ceph CIDR provide like 10.0.0.0\\\/24
HOSTCIDR=${5:-"$(hostname -I | cut -d'.' -f 1,2,3).0\/24"}
echo === Cleaning up old data ===
@ -17,6 +23,16 @@ chmod 777 ${BUILD_DIR}
cp "${CONFIG_SOURCE}"/*.yaml ${BUILD_DIR}
if [ ${REPLACE} == 'replace' ]
then
sed -i "s/-n0/-${HOSTNAME}/g" "${BUILD_DIR}"/*.yaml
sed -i "s/- n0/- ${HOSTNAME}/g" "${BUILD_DIR}"/*.yaml
sed -i "s/: n0/: ${HOSTNAME}/g" "${BUILD_DIR}"/*.yaml
sed -i "s/:n0/:${HOSTNAME}/g" "${BUILD_DIR}"/*.yaml
sed -i "s/192.168.77.10/${HOSTIP}/g" "${BUILD_DIR}"/*.yaml
sed -i "s/192.168.77.0\/24/${HOSTCIDR}/g" "${BUILD_DIR}"/*.yaml
fi
echo === Generating updated certificates ===
docker run --rm -t \
-w /target \