Last active
January 24, 2020 15:02
-
-
Save aforty/9360250346ac92eac715fb1cdf1bbd24 to your computer and use it in GitHub Desktop.
Digital Ocean - Dokku - 1GB Swap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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