Skip to content

Instantly share code, notes, and snippets.

@aforty
Last active January 24, 2020 15:02
Show Gist options
  • Save aforty/9360250346ac92eac715fb1cdf1bbd24 to your computer and use it in GitHub Desktop.
Save aforty/9360250346ac92eac715fb1cdf1bbd24 to your computer and use it in GitHub Desktop.
Digital Ocean - Dokku - 1GB Swap
set -e
# install updates
echo "Installing updates..."
apt update -y
apt upgrade -y -o Dpkg::Options::=--force-confnew
# install do agent
echo "Installing DO Agent..."
curl -sSL https://agent.digitalocean.com/install.sh | sh
# add swap space
echo "Adding swap file..."
fallocate -l 1G /swapfile
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sysctl vm.swappiness=10
echo "LABEL=SWAP /swapfile swap swap defaults 0 0" >> /etc/fstab
echo "vm.swappiness=10" >> /etc/sysctl.conf
# install dokku
echo "Installing dokku..."
DOKKU_TAG=v0.19.12
curl -sSL "https://raw.githubusercontent.com/dokku/dokku/$DOKKU_TAG/bootstrap.sh" | bash
# copy ssh keys
echo "Copying ssh keys to dokku user..."
cat /root/.ssh/authorized_keys >> /home/dokku/.ssh/authorized_keys
# cleanup
echo "Cleaning up..."
apt autoremove -y
# reboot
echo "Rebooting in 10 seconds..." && sleep 10
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment