This repository contains a VagrantFile and support scripts that will configure a local VM suitable for developing Rails and Python applications.
- apt packages necessary for typical rails and python development
- rvm (to manage ruby versions)
- a version of ruby and the bundler gem
- a version of python, pipenv, and tox
- the heroku command line interface tool
On your local computer
- Install Virtualbox
- Install Vagrant
- Clone this repo locally
vagrant upin the cloned directory of this repo- NOTE: if you don't like the default of
src, you can useSYNCED_FOLDERENV - EXAMPLE:
SYNCED_FOLDER="~/projects" vagrant up
- NOTE: if you don't like the default of
- git clone the repo you want to work on into
src- NOTE: if you changed with
ENV['SYNCED_FOLDER']wherever you change it to - NOTE: you can sync a directory containing multiple projects instead of having a VM for each.
- NOTE: if you changed with
vagrant sshgets you a shell on the rails vm- Note: do all your development using your preferred tools on your local
computer. Do your
gitwork on your local as well. vagrant haltwhen you want to shutdown the vm (vagrant upto bring it back)
On the rails/python VM
cd /vagrant/src/YOUR_PROJECTgets you to the linked directory- Rails:
bundle installwhenever you need to install gemsbin/rails testto run tests
- Python:
pipenv installto create a virtualenv and install project dependenciestoxto run tests (usually, may vary by project)
heroku localto run a dev server. We useheroku localinstead ofbin/rails serverso we can easily load environment variables by dropping a.envfile insrcon your local (or/vagrant/src/YOUR_PROJECTin the vm as they are the same thing)
This does not use Ansible due to a requirement to work on Windows.
If you end up needing additional packages installed to get gems to work,
adding them to the provision.sh will probably make it easier later if it's a
fairly common gem.
If you are working on projects that use a different version of ruby than is installed by default, you can:
rvm install 2.4.2(replace2.4.2with the version you need)gem install bundler- if your projects use
.ruby-versionfiles you are now all set and ruby will be switched to the version each project needs automatically
If you are working on projects that use a different version of python than is installed by default, you can:
- update the Vagrantfile with additional python provisioning lines, e.g.
config.vm.provision :shell, path: "install-python.sh", args: "3.6"to install Python 3.6 - run
vagrant provisionfrom your local computer to install - if your projects set a Python version in the Pipfile (e.g.
[requires] python_version = "3.6") you are now all set and pipenv will switch to the version each project needs automatically