Fix: VM requirements verification

Added VM size and OS version requrements precheck to script and
information to README.
Require to run as root, because ./deploy-airship.sh would anyway
require root priveleges.
Added lazy mode for questions asked - just hit Enter.

Change-Id: Ib9e5eb0b4ca65fd0dcdf5f8478b219edcdd33adb
This commit is contained in:
Roman Gorshunov 2018-05-18 23:23:44 +02:00
parent 635776f36e
commit 0e9e6dd5cc
2 changed files with 19 additions and 7 deletions

View File

@ -7,7 +7,8 @@ Airship is a broad integration of several components
enabling an automated, resilient Kubernetes-based infrastructure for hosting
Helm-deployed containerized workloads.
To get started, run the following in a fresh Ubuntu 16.04 VM. This will deploy Airship and OSH:
To get started, run the following in a fresh Ubuntu 16.04 VM (4vCPU/16GB RAM/
64GB disk). This will deploy Airship and OSH:
```
sudo -i
mkdir -p /root/deploy && cd "$_"

View File

@ -34,21 +34,32 @@ echo "| /"
echo " \--------------------/"
sleep 1
echo ""
echo "The minimum recommended size of the VM is 4 vCPUs, 16GB of RAM with 64GB disk space."
echo "The minimum recommended size of the Ubuntu 16.04 VM is 4 vCPUs, 16GB of RAM with 64GB disk space."
CPU_COUNT=$(grep -c processor /proc/cpuinfo)
RAM_TOTAL=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
source /etc/os-release
if [[ $CPU_COUNT -lt 4 || $RAM_TOTAL -lt 16777216 || $NAME != "Ubuntu" || $VERSION_ID != "16.04" ]]; then
echo "Error: minimum VM recommendations are not met. Exiting."
exit 1
fi
if [[ $(id -u) -ne 0 ]]; then
echo "Please execute this script as root!"
exit 1
fi
sleep 1
echo "Let's collect some information about your VM to get started."
sleep 1
# IP and Hostname setup
HOST_IFACE=$(ip route | grep "^default" | head -1 | awk '{ print $5 }')
read -p "Is your HOST IFACE $HOST_IFACE? (y/n) " YN_HI
if [ "$YN_HI" != "y" ]; then
read -p "Is your HOST IFACE $HOST_IFACE? (Y/n) " YN_HI
if [[ ! "$YN_HI" =~ ^([yY]|"")$ ]]; then
read -p "What is your HOST IFACE? " HOST_IFACE
fi
LOCAL_IP=$(ip addr | awk "/inet/ && /${HOST_IFACE}/{sub(/\/.*$/,\"\",\$2); print \$2}")
read -p "Is your LOCAL IP $LOCAL_IP? (y/n) " YN_IP
if [ "$YN_IP" != "y" ]; then
read -p "Is your LOCAL IP $LOCAL_IP? (Y/n) " YN_IP
if [[ ! "$YN_IP" =~ ^([yY]|"")$ ]]; then
read -p "What is your LOCAL IP? " LOCAL_IP
fi
@ -59,7 +70,7 @@ if grep -q "$HOSTS_REGEX" "/etc/hosts"; then
echo "Not updating /etc/hosts, entry ${HOSTS} already exists."
else
echo "Updating /etc/hosts with: ${HOSTS}"
cat << EOF | sudo tee -a /etc/hosts
cat << EOF | tee -a /etc/hosts
$HOSTS
EOF
fi