Giter Club home page Giter Club logo

vader's Introduction

vader

Vagrant

Ansible

Development

Environment for

Ruby.

Spin up a stack for development that is similar to what might be used in production.

Right now the stack consists of:

  • NGINX 1.4.7
  • Haproxy 1.4.24
  • PostgreSQL 9.3
  • Ruby 2.1 (via rbenv & ruby-build)
  • Rails 4.1

Tested To Work On

  • OS X 10.9.2
  • Vagrant 1.5.2
  • Ansible 1.5 (master 29110c31ea)

Installation

Prerequisites

Clone vader

Clone the repository into a directory where you want to keep your project files. I place it in ~/src.

Setup Hosts

Edit /etc/hosts on your local development machine:

192.168.2.10    haproxy.dev
192.168.2.10    rails-test.dev

Start the VMs

  1. vagrant up app_ruby_1 --provider=vmware_fusion
  2. vagrant up app_ruby_2 --provider=vmware_fusion
  3. vagrant up postgres --provider=vmware_fusion
  4. vagrant up haproxy --provider=vmware_fusion
  5. vagrant up web --provider=vmware_fusion

You should let both of the app servers finish starting up before starting HAproxy, as it will need to pull information from them.

Create Your Rails App

vagrant ssh app_ruby_1
$ cd /srv/www/
$ rails new rails_test

Update your config/database.yml

default: &default
    adapter: postgresql
    pool: 5
    timeout: 5000

development:
    <<: *default
    host: 192.168.2.30
    port: 5432
    database: test
    username: tester
    password: insecure

Start Your Rails App

vagrant ssh app_ruby_1
$ cd /srv/www/rails_test
$ rails s -d
$ exit

And...

vagrant ssh app_ruby_2
$ cd /srv/www/rails_test
$ rails s -d
$ exit

Take A Peek

The Setup

NGINX

  • 192.168.2.10
  • Listening on port 80
  • At the moment, all requests sent on to HAProxy

HAProxy

  • 192.168.2.20
  • Listening on port 80 & 8080
  • Port 80 services HAProxy's stats UI
  • Port 8080 is balanced out to the 2 app servers.

PostgreSQL

  • 192.168.2.30
  • Listening on port 5432
  • Will accept requests from app servers (configured in pg_hba.conf)

App Server

  • 192.168.2.100 & 192.168.2.101
  • Webrick listens on port 3000

vader's People

Contributors

jpease avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.