Question

I would like to develop my Django Heroku app in an environment as close to Heroku's Cedar stack as possible using Vagrant.

The best solution I have found so far for building the mocked up environment is Eric Holmes' excellent https://github.com/ejholmes/vagrant-heroku. However, this vagrant box currently uses python 2.6.x instead of the Python 2.7.4 my app uses and Heroku defaults to.

The other resource I have found is Heroku's https://github.com/heroku/stack-images. I have not tried this yet, but it seems to offer a way of creating a cedar stack locally. It ends up with Python 2.7.2.

Which of these (or something else) is the best way to go? I have a development environment that works now -- and it uses all the same software that Heroku uses (PostgreSQL, Python 2.7.4, etc.) -- but I would like to simulate some of the other aspects of the Heroku environment (memory available, disk space, multi-machine architecture, etc.).

I am leaning towards using Eric Holmes' box and adding Python 2.7.4 per https://askubuntu.com/questions/101591/how-do-i-install-python-2-7-2-on-ubuntu. I'd offer a patch to Eric's work, but I'm no Rubyist/veewee...

Update 1: Another possible resource: https://github.com/torchbox/vagrant-django-base.

Update 2: I've decided to roll my own by adapting from the above sources and others. These are the files (Vagrantfile and vagrant_data/install.sh) that I am currently using with some success: https://gist.github.com/ErikEvenson/5801503. This gets me to Python 2.7.3 and PostgresSQL 9.2.4 on a Ubuntu 12.04 512MB box.

I'd like to split off the database server with a second box and get the app server on Ubuntu 10.04 with Python 2.7.4.

Update 3: My setup has evolved. This is my current vagrant config: https://gist.github.com/ErikEvenson/9763878.

Update 4: I made several updates to my setup this week. The latest is at https://gist.github.com/ErikEvenson/9763878. Of note:

  • Use NFS instead of virtualbox folder syncing - huge performance improvement.
  • Avoid guest addition bug in current virtualbox version.
  • Use newly available Vagrant Cloud for versioned base box.

Update 5: Several updates here -- mostly software versions. The latest is at https://gist.github.com/ErikEvenson/9763878. Of note:

  • Uses Vagrant 1.6.3
  • Uses PostgreSQL 9.3.3
  • Uses python 2.7.7 and installs it from source. python 2.7.3 is retained as the system python.
  • Locks down all dependency versions -- especially those installed via apt-get and npm.
  • Uses hashicorp/precise64 as a base box.

The file structure to use is something like this:

- Project directory
-- vagrant_data
--- db
---- install.sh
---- memcached.conf
---- pg_hba.conf
---- postgresql.conf
---- redis.conf
--- web
---- install.sh
-- Vagrantfile

Update 6: Turns vagrant-vbguest on since VirtualBox 4.3.14 fixes some bugs.

Was it helpful?

Solution 2

You can see my solution to this at https://gist.github.com/ErikEvenson/9763878.

OTHER TIPS

You could try Dokku which support Heroku buildpacks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top