├── Makefile ├── Procfile ├── README.md ├── Vagrantfile ├── app.py ├── bootstrap.sh └── requirements.txt /Makefile: -------------------------------------------------------------------------------- 1 | deploy: 2 | @git push dokku master 3 | 4 | logs: 5 | @ssh -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me sudo dokku logs dokku-vagrant-example 6 | 7 | test: 8 | @curl -sL http://dokku-vagrant-example.dokku.me\?echo+"It+works\!" | bash 9 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: python app.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dokku-vagrant-example 2 | ===================== 3 | 4 | How to run dokku on Vagrant 5 | 6 | These are just my notes on how to run dokku on Vagrant. 7 | 8 | Installing 9 | ---------- 10 | 11 | First, install Vagrant. Then, add entries to the Host Database in /etc/hosts, such as: 12 | 13 | 10.0.0.2 dokku.me 14 | 10.0.0.2 dokku-vagrant-example.dokku.me 15 | 16 | Go! 17 | 18 | git clone https://github.com/RyanBalfanz/dokku-vagrant-example.git 19 | cd dokku-vagrant-example 20 | ./bootstrap.sh 21 | # bootstrap.sh doesn't yet clone this repo 22 | # wget -qO- https://raw.github.com/RyanBalfanz/dokku-vagrant-example/raw/master/bootstrap.sh | bash 23 | 24 | Now what? Try these: 25 | 26 | make deploy 27 | make test # Check if the application is running correctly 28 | make logs # Show the last logs of the application 29 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | BOX_NAME = ENV["BOX_NAME"] || "raring" 5 | BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box" 6 | DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me" 7 | DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2" 8 | 9 | Vagrant::configure("2") do |config| 10 | config.vm.box = BOX_NAME 11 | config.vm.box_url = BOX_URI 12 | config.vm.synced_folder File.dirname(__FILE__), "/root/dokku" 13 | config.vm.network :forwarded_port, guest: 80, host: 8080 14 | config.vm.hostname = "#{DOKKU_DOMAIN}" 15 | config.vm.network :private_network, ip: DOKKU_IP 16 | 17 | config.vm.provider :virtualbox do |vb| 18 | vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] 19 | # Ubuntu's Raring 64-bit cloud image is set to a 32-bit Ubuntu OS type by 20 | # default in Virtualbox and thus will not boot. Manually override that. 21 | vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"] 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | """ 2 | This app comes from Jeff Lindsay's (@progrium) blog: 3 | http://progrium.com/blog/2013/01/05/executable-tweets-and-programs-in-short-urls/. 4 | """ 5 | import os, urllib2 6 | 7 | from flask import Flask, request 8 | 9 | 10 | app = Flask(__name__) 11 | 12 | @app.route("/") 13 | def echo(): 14 | data = urllib2.unquote(request.query_string) 15 | if ' ' not in data: 16 | return data.replace('+', ' ') 17 | else: 18 | return data 19 | 20 | if __name__ == "__main__": 21 | port = int(os.environ.get('PORT', 5000)) 22 | app.run(host='0.0.0.0', port=port) 23 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | vagrant up 4 | vagrant ssh -- "wget -qO- https://raw.github.com/progrium/dokku/v0.2.1/bootstrap.sh | sudo DOKKU_TAG=v0.2.1 bash" 5 | 6 | cat ~/.ssh/id_rsa.pub | vagrant ssh -- sudo sshcommand acl-add dokku ${USER} 7 | 8 | git remote add dokku dokku@dokku.me:dokku-vagrant-example 9 | 10 | make deploy 11 | make test 12 | make logs 13 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==0.10.1 2 | Jinja2==2.7.2 3 | MarkupSafe==0.18 4 | Werkzeug==0.9.4 5 | distribute==0.6.49 6 | itsdangerous==0.23 7 | stevedore==0.12 8 | virtualenv==1.10.1 9 | virtualenv-clone==0.2.4 10 | virtualenvwrapper==4.1.1 11 | wsgiref==0.1.2 12 | --------------------------------------------------------------------------------