Make infra_version.js option and fix base image on DO
This commit is contained in:
@@ -138,7 +138,7 @@ cd "${SOURCE_DIR}"
|
|||||||
git archive --format=tar HEAD | $ssh22 "root@${server_ip}" "cat - > /tmp/box.tar.gz"
|
git archive --format=tar HEAD | $ssh22 "root@${server_ip}" "cat - > /tmp/box.tar.gz"
|
||||||
|
|
||||||
echo "Executing init script"
|
echo "Executing init script"
|
||||||
if ! $ssh22 "root@${server_ip}" "/bin/bash /root/initializeBaseUbuntuImage.sh ${installer_revision}"; then
|
if ! $ssh22 "root@${server_ip}" "/bin/bash /root/initializeBaseUbuntuImage.sh ${installer_revision} caas"; then
|
||||||
echo "Init script failed"
|
echo "Init script failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ if ! $ssh22 "ubuntu@${server_ip}" "sudo sed -e 's/.* \(ssh-rsa.*\)/\1/' -i /root
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Executing init script"
|
echo "Executing init script"
|
||||||
if ! $ssh22 "root@${server_ip}" "/bin/bash /home/ubuntu/initializeBaseUbuntuImage.sh ${installer_revision}"; then
|
if ! $ssh22 "root@${server_ip}" "/bin/bash /home/ubuntu/initializeBaseUbuntuImage.sh ${installer_revision} ec2"; then
|
||||||
echo "Init script failed"
|
echo "Init script failed"
|
||||||
echo "Make sure to cleanup the ec2 instance ${instance_id}"
|
echo "Make sure to cleanup the ec2 instance ${instance_id}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ readonly USER=yellowtent
|
|||||||
readonly USER_HOME="/home/${USER}"
|
readonly USER_HOME="/home/${USER}"
|
||||||
readonly INSTALLER_SOURCE_DIR="${USER_HOME}/installer"
|
readonly INSTALLER_SOURCE_DIR="${USER_HOME}/installer"
|
||||||
readonly INSTALLER_REVISION="$1"
|
readonly INSTALLER_REVISION="$1"
|
||||||
|
readonly PROVIDER="$2"
|
||||||
readonly USER_DATA_FILE="/root/user_data.img"
|
readonly USER_DATA_FILE="/root/user_data.img"
|
||||||
readonly USER_DATA_DIR="/home/yellowtent/data"
|
readonly USER_DATA_DIR="/home/yellowtent/data"
|
||||||
|
|
||||||
@@ -133,7 +134,11 @@ iptables -I FORWARD -d 169.254.169.254 -j DROP
|
|||||||
mkdir /etc/iptables && iptables-save > /etc/iptables/rules.v4
|
mkdir /etc/iptables && iptables-save > /etc/iptables/rules.v4
|
||||||
|
|
||||||
echo "=== Enable memory accounting =="
|
echo "=== Enable memory accounting =="
|
||||||
sed -e 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1 panic_on_oops=1 panic=5"/' -i /etc/default/grub
|
if [[ "${PROVIDER}" == "digitalocean" ]] || [[ "${PROVIDER}" == "caas" ]]; then
|
||||||
|
sed -e 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="console=tty1 root=LABEL=DOROOT notsc clocksource=kvm-clock net.ifnames=0 cgroup_enable=memory swapaccount=1 panic_on_oops=1 panic=5"/' -i /etc/default/grub
|
||||||
|
else
|
||||||
|
sed -e 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1 panic_on_oops=1 panic=5"/' -i /etc/default/grub
|
||||||
|
fi
|
||||||
update-grub
|
update-grub
|
||||||
|
|
||||||
# now add the user to the docker group
|
# now add the user to the docker group
|
||||||
@@ -149,12 +154,16 @@ apt-get install -y python # Install python which is required for npm rebuild
|
|||||||
[[ "$(python --version 2>&1)" == "Python 2.7."* ]] || die "Expecting python version to be 2.7.x"
|
[[ "$(python --version 2>&1)" == "Python 2.7."* ]] || die "Expecting python version to be 2.7.x"
|
||||||
|
|
||||||
echo "==== Downloading docker images ===="
|
echo "==== Downloading docker images ===="
|
||||||
images=$(node -e "var i = require('${SOURCE_DIR}/infra_version.js'); console.log(i.baseImage, Object.keys(i.images).map(function (x) { return i.images[x].tag; }).join(' '));")
|
if [ -f ${SOURCE_DIR}/infra_version.js ]; then
|
||||||
|
images=$(node -e "var i = require('${SOURCE_DIR}/infra_version.js'); console.log(i.baseImage, Object.keys(i.images).map(function (x) { return i.images[x].tag; }).join(' '));")
|
||||||
|
|
||||||
echo "Pulling images: ${images}"
|
echo "Pulling images: ${images}"
|
||||||
for image in ${images}; do
|
for image in ${images}; do
|
||||||
docker pull "${image}"
|
docker pull "${image}"
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
echo "No infra_versions.js found, skipping image download"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==== Install nginx ===="
|
echo "==== Install nginx ===="
|
||||||
apt-get -y install nginx-full
|
apt-get -y install nginx-full
|
||||||
|
|||||||
Reference in New Issue
Block a user