Coder Social home page Coder Social logo

jameshilliard / vagrant-ansible-rails Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 17.0 277 KB

A generic base Vagrant VM for ROR development with Postgres and RVM pre-installed. The VM is provisioned using Ansible and can be used as a starting point for running Rails projects inside a Vagrant VM

vagrant-ansible-rails's Introduction

Rails dev box

Builds an Ubuntu Linux VM for Rails development using Ansible and Vagrant.

This box provides the core packages needed for typical Rails 4 apps and nothing else.

The target setup is Ubuntu Linux, Unicorn and Nginx.

Stack

  • Ruby 2
  • Nginx
  • Postgresql

Use

# Bring both the webserver and db server online
vagrant up
# Provision the VM
./deploy.sh

# SSH into your new VM
vagrant ssh web

# Everything inside /var/www is shared with your local file system

cd /var/www

# Create your app
sudo gem install --no-rdoc --no-ri rails
sudo rails new myapp --database postgresql
cd myapp
# Create and migrate the database
bundle exec rake db:create && rake db:migrate

Configure Postgres

Since postgres is running on a separate server we need to do some groundwork. Hopefully I'll find a way to automate this.

# sudo -u postgres psql
# \password
# create user vagrant with password 'vagrant';
# create database mydb owner vagrant;
# \q

# You can now log in to postgres using the username vagrant and password vagrant
psql -h 33.33.33.20 -U vagrant -d mydb

You should now be able to connect to postgres from your web VM. An example DB config.yml is provided below

development:
  adapter: postgresql
  encoding: unicode
  database: blog_development
  pool: 5
  username: vagrant
  password: vagrant
  host: 33.33.33.20

test:
  adapter: postgresql
  encoding: unicode
  database: blog_test
  pool: 5
  username: vagrant
  password: vagrant
  host: 33.33.33.20

vagrant-ansible-rails's People

Contributors

owainlewis avatar

Watchers

 avatar  avatar  avatar

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.