Skip to content

Instantly share code, notes, and snippets.

@AndrewKvalheim
Last active February 14, 2024 04:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewKvalheim/ce7ee64e9c158f5e239307edb95a8818 to your computer and use it in GitHub Desktop.
Save AndrewKvalheim/ce7ee64e9c158f5e239307edb95a8818 to your computer and use it in GitHub Desktop.
Simple Dokku virtual machine

Create the Dokku instance:

vagrant up

Configure SSH (see how to enable ~/.ssh/config.d):

vagrant ssh-config --host 'dokku' > ~/.ssh/config.d/dokku

Clean up:

rm ~/.ssh/config.d/dokku
vagrant destroy
Vagrant.configure('2') do |config|
config.vm.box = 'generic/ubuntu2204'
config.vm.provision :shell, inline: <<-SCRIPT
ip="$(hostname --all-ip-addresses | cut --delimiter=' ' --fields='1')"
export DOKKU_TAG='v0.30.1'
curl "https://raw.githubusercontent.com/dokku/dokku/$DOKKU_TAG/bootstrap.sh" | bash
cat ~vagrant/.ssh/authorized_keys | dokku ssh-keys:add admin
dokku domains:set-global "$ip.sslip.io"
dokku git:set --global main
dokku plugin:install https://github.com/dokku/dokku-mysql.git mysql
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
SCRIPT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment