Dokku stable

by ademuk
17 deployments · 4 still active · last rev. 4 years ago

Installs a specific Dokku version (mini-Heroku server).

After booting, wait until the file "ready-for-kernel-change.txt" appears in your admin user's home directory. Follow the instructions in that file (switch to the pv-grub kernel, disable the "Xenify distro" option and then reboot using the Linode dashboard).

Once you've rebooted with the pv-grub kernel and let the installer finish, your Dokku server will be ready for app deployment.

For more configuration details:

Source scripts:

Compatible with: Ubuntu 14.04 LTS

# <UDF name="fqdn" label="Fully Qualified Domain Name" example="">
# <UDF name="hostname" Label="Hostname" example="dokku"/>
# <UDF name="dokkuversion" label="Dokku version" example="v0.3.5">
# <UDF name="dokkukey" label="SSH public key for dokku user (used when deploying apps)">
# <UDF name="adminuser" label="Username for new admin user (cannot be dokku)" default="">
# <UDF name="adminpass" label="Password for new admin user" default="">
# <UDF name="adminkey" label="SSH public key for admin user (password SSH auth will be disabled)" default="">

source <ssinclude StackScriptID="1">

system_set_hostname "$HOSTNAME"
system_add_host_entry "$(system_primary_ip)" "$FQDN $HOSTNAME"


sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config

# Set up admin user
if [ -n "$ADMINUSER" ] && [ -n "$ADMINPASS" ]; then
  user_add_sudo "$ADMINUSER" "$ADMINPASS"

  if [ -n "$ADMINKEY" ]; then
    user_add_pubkey "$ADMINUSER" "$ADMINKEY"

# Install dependencies
apt-get -y install ufw fail2ban bsdtar git man

# Prepare system for pv-grub kernel
DEBIAN_FRONTEND=noninteractive apt-get -y install linux-virtual
DEBIAN_FRONTEND=noninteractive apt-get -y purge grub2 grub-pc
DEBIAN_FRONTEND=noninteractive apt-get -y install grub
mkdir -p /boot/grub
update-grub -y
sed -i 's/kopt=root=UUID=.* ro/kopt=root=\/dev\/xvda console=hvc0 ro quiet/g' /boot/grub/menu.lst
sed -i 's/# groot=(hd0,0)/# groot=(hd0)/g' /boot/grub/menu.lst

# Install dokku with a startup script on the next boot (after we've switched to the pv-grub kernel)
cat << EOF > /etc/init.d/install_dokku

case "\$1" in
  [ -n "$ADMINUSER" ] && rm -f /home/$ADMINUSER/ready-for-kernel-change.txt

  # Dokku dependencies
  apt-get update
  apt-get -y install lxc bsdtar linux-image-extra-\$(uname -r)
  modprobe aufs

  # Install dokku
  wget -qO-$DOKKUVERSION/ | sudo bash

  # Installation on 14.04 seems to fail the first time, but succeed on a retry
  test -d dokku || wget -qO-$DOKKUVERSION/ | sudo bash

  # Set up SSH access for dokku user
  [ -n "$DOKKUKEY" ] && echo "$DOKKUKEY" | /usr/local/bin/sshcommand acl-add dokku deploy
  echo "$FQDN" > /home/dokku/VHOST
  chown dokku:dokku /home/dokku/VHOST

  # Clean up this script so it only runs once
  update-rc.d -f install_dokku remove
  rm -f /etc/init.d/install_dokku


chmod +x /etc/init.d/install_dokku
update-rc.d install_dokku defaults 97 03

# Indicate to admin user that we're ready for kernel change
# (Is there any way to do this automatically with StackScripts?)
[ -n "$ADMINUSER" ] && echo 'Change this Linode configuration to use the pv-grub kernel, disable the "Xenify distro" option, and reboot (from the Linode dashboard!) to finish installation.' > /home/$ADMINUSER/ready-for-kernel-change.txt