hacks/provision.workbox/cloud-init.sh

28 lines
713 B
Bash
Raw Normal View History

#!/bin/bash
2018-03-06 21:04:21 +00:00
2018-03-06 21:27:31 +00:00
# fetch and run this in cloud-init, viz:
2018-03-06 21:04:21 +00:00
2018-03-06 21:27:31 +00:00
##cloud-config
#runcmd:
2018-03-06 22:51:11 +00:00
# - curl -fsSL https://raw.githubusercontent.com/sneak/hacks/master/provision.workbox/cloud-init.sh | bash
2018-03-06 22:07:09 +00:00
2018-03-06 23:15:51 +00:00
# make sure we don't OOM
if [[ ! -e /var/swapfile ]]; then
fallocate -l 2G /var/swapfile
chmod 600 /var/swapfile
mkswap /var/swapfile
echo '/var/swapfile none swap sw 0 0' | tee -a /etc/fstab
fi
swapon /var/swapfile
echo 'vm.swappiness=80' >> /etc/sysctl.conf
echo 'vm.vfs_cache_pressure=50' >> /etc/sysctl.conf
sysctl -p
2018-03-06 21:27:31 +00:00
export DEBIAN_FRONTEND=noninteractive
2018-03-06 21:04:21 +00:00
apt-get update
2018-03-06 22:48:09 +00:00
apt-get -y install git
git clone https://github.com/sneak/hacks.git /var/tmp/hacks
2018-03-06 22:56:48 +00:00
cd /var/tmp/hacks/provision.workbox
2018-03-06 22:48:09 +00:00
bash main.sh