Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.

What is it?

A Vagrant configuration that starts up a PostgreSQL database in a virtual machine for local application development.


First install [Vagrant] and Virtual Box.

Then, run the following to create a new PostgreSQL app dev virtual machine:

# Clone it locally:
$ git clone myapp

# Enter the cloned directory:
$ cd myapp

# Delete the old .git and README:
$ rm -rf .git

# Optionally edit the database username/password:
$ $EDITOR Vagrant-setup/


# Start up the virtual machine:
$ vagrant up

# Stop the virtual machine:
$ vagrant halt

What does it do?

It creates a virtual server running Ubuntu 14.04 with the latest version of PostgreSQL (as of writing 9.4) installed. It also edits the PostgreSQL configuration files to allow network access and creates a database user/database for your application to use.

Once it has started up it will print out how to access the database on the virtual machine. It will look something like this:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[... truncated ...]
Your PostgreSQL database has been setup and can be accessed on your local machine on the forwarded port (default: 15432)
  Host: localhost
  Port: 15432
  Database: myapp
  Username: myapp
  Password: dbpass

Admin access to postgres user via VM:
  vagrant ssh
  sudo su - postgres

psql access to app database user via VM:
  vagrant ssh
  sudo su - postgres
  PGUSER=myapp PGPASSWORD=dbpass psql -h localhost myapp

Env variable for application development:

Local command to access the database via psql:
  PGUSER=myapp PGPASSWORD=dbpass psql -h localhost -p 15432 myapp

Why use the shell provisioner?

Or alternatively, why not Chef, Puppet, Ansible, or Salt?

Mainly because it's simple and anybody with a basic knowledge of shell scripting can tweak the to their liking.


This is released under the MIT license. See the file LICENSE.



Basic Vagrant configuration for local application development with PostgreSQL




No releases published


No packages published


You can’t perform that action at this time.