Giter VIP home page Giter VIP logo

pg-app-dev-vm's Introduction

What is it?

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

Installation

First install [Vagrant] and Virtual Box.

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

# Clone it locally:
$ git clone https://github.com/jackdb/pg-app-dev-vm myapp

# Enter the cloned directory:
$ cd myapp

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

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

Usage

# 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:
  DATABASE_URL=postgresql://myapp:dbpass@localhost:15432/myapp

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 bootstrap.sh to their liking.

License

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

Vagrant]: http://www.vagrantup.com/

pg-app-dev-vm's People

Contributors

adamcavaliere avatar bjmc avatar sehrope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pg-app-dev-vm's Issues

Port forwarding OS X Yosemite

Wondering if anyone has this working with OS X Yosemite, can't seem to connect using PSequel and the credentials given. Could it be the port forwarding, from what I can tell port forwarding was affected in Yosemite.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.