To bootstrap the infrastructure system
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker-release
gradle/wrapper
scripts
src/main
.gitignore
InfraBootstrapApp - allDefaults.launch
InfraBootstrapApp - genJsonAnswers.launch
InfraBootstrapApp - help.launch
InfraBootstrapApp - interactive.launch
InfraBootstrapApp - join incomplete.launch
InfraBootstrapApp - join.launch
InfraBootstrapApp - jsonAnswerFile.launch
LICENSE
README.md
build.gradle
create-local-release-no-tests.sh
create-local-release.sh
create-public-release.sh
gradle.properties
gradlew
gradlew.bat
settings.gradle
step-clean-compile.sh
step-clean.sh
step-compile-no-tests.sh
step-compile.sh
step-create-docker-image.sh
step-git-tag.sh
step-update-copyrights.sh
step-upload-docker-image.sh

README.md

About

To bootstrap the infrastructure system. It can create a new cluster or join an existing one.

Bootstrap a node

New cluster

Prerequisite

On Ubuntu 16.04:

# Install base applications
echo "deb https://dl.bintray.com/foilen/debian stable main" | tee /etc/apt/sources.list.d/foilen.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61

apt update && \
apt -y dist-upgrade && \
apt -y autoremove

apt install -y haveged docker.io docker-sudo

# Add swap memory (5G in 5 1G files. Useful if you want to easily remove some G later)
for i in {1..5}; do
  SWAP_FILE=/var/swap.$i
  echo Generating $SWAP_FILE
  fallocate -l 1G $SWAP_FILE
  chmod 600 $SWAP_FILE
  /sbin/mkswap $SWAP_FILE
  echo $SWAP_FILE swap swap defaults 0 0 >> /etc/fstab
  /sbin/swapon $SWAP_FILE
done

# Enable SSHD password authentication
if egrep '^PasswordAuthentication no$' /etc/ssh/sshd_config > /dev/null ; then
  echo Enabling SSHD password authentication
  sed 's/^PasswordAuthentication no$/#PasswordAuthentication no/g' /etc/ssh/sshd_config > /etc/ssh/sshd_config.tmp
  mv /etc/ssh/sshd_config.tmp /etc/ssh/sshd_config
  service sshd restart
fi

Use in Interactive Mode

docker run -ti \
  --rm \
  --env HOSTFS=/hostfs/ \
  --env MACHINE_HOSTNAME=$(hostname -f) \
  --hostname $(hostname -f) \
  --volume /etc:/hostfs/etc \
  --volume /home:/hostfs/home \
  --volume /usr/bin/docker:/usr/bin/docker \
  --volume /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.1:/usr/lib/x86_64-linux-gnu/libltdl.so.7 \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  foilen/foilen-infra-bootstrap:latest

Generate questions in a file and feed it back

Generate a JSON file with all questions and answers if you do not want to use the interactive mode:

DATA_DIR=$(mktemp -d)
cd $DATA_DIR

docker run -ti \
  --rm \
  --env HOSTFS=/hostfs/ \
  --env MACHINE_HOSTNAME=$(hostname -f) \
  --hostname $(hostname -f) \
  --volume $DATA_DIR:/data \
  --volume /etc:/hostfs/etc \
  --volume /home:/hostfs/home \
  --volume /usr/bin/docker:/usr/bin/docker \
  --volume /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.1:/usr/lib/x86_64-linux-gnu/libltdl.so.7 \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  foilen/foilen-infra-bootstrap:latest \
  --genJsonAnswers --jsonAnswerFile /data/bootstrap.json

Edit the file.

Execute the bootstrap using the answer file:

docker run -ti \
  --rm \
  --env HOSTFS=/hostfs/ \
  --env MACHINE_HOSTNAME=$(hostname -f) \
  --hostname $(hostname -f) \
  --volume $DATA_DIR:/data \
  --volume /etc:/hostfs/etc \
  --volume /home:/hostfs/home \
  --volume /usr/bin/docker:/usr/bin/docker \
  --volume /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.1:/usr/lib/x86_64-linux-gnu/libltdl.so.7 \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  foilen/foilen-infra-bootstrap:latest \
  --jsonAnswerFile /data/bootstrap.json --startDockerManager --info | tee bootstrap.log

Join a cluster

From the UI

  • Go in your Infra UI
  • Go in Infrastructure > Machine - Bootstrap
  • Choose your machine
  • Copy the commands to run as root in your shell