Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

railsbox (1) Versions 0.1.0

auto deploy railsapp with rbenv+nginx+unicorn+postgresql

Policyfile
Berkshelf
Knife
cookbook 'railsbox', '~> 0.1.0', :supermarket
cookbook 'railsbox', '~> 0.1.0'
knife supermarket install railsbox
knife supermarket download railsbox
README
Dependencies
Quality 17%

Railsbox: auto deploy rails app

railsbox cookbook (v0.1.0)

Setup a Rails application server to run Nginx+Unicorn+Psql+Cap+Github apps.

edit from:

It performs the following tasks when setup the server:

  • Install and setup Ruby environment using rbenv.
  • Install Nginx from source as front-end server.
  • Setup Unicorn apps as backend server (if any).
  • Setup runit service.
  • Install nodejs from package to complie assest.
  • Using the Github API to authorise the new public key (if any).

Requirements

Supported Platforms

  • ubuntu - tested on Ubuntu 12.04

Cookbook Dependencies

  • "appbox" # apt\sudo\user\curl\htop\git\tmux
  • 'rbenv'
  • 'nginx'
  • 'unicorn', ">= 1.2.2"
  • 'runit', '>= 1.1.2'
  • "postgresql"
  • "database"
  • "nodejs"

Install

To install with Berkshelf, add this into Berksfile:

cookbook 'railsbox', git: 'git://github.com/ouyangzhiping/railsbox.git'

and run:

bundle exec berks install -p cookbooks/

And overwrite attributes to customize the cookbook. then add the default recipe to your runlist.

example:

{
  "run_list":[
    "railsbox"
  ],
  "appbox": {
    "deploy_keys": ["ssh-rsa, 1. run cat ~/.ssh/id_rsa.pub on your mac 2. copy it"],
    "admin_keys": ["ssh-rsa, 1. run cat ~/.ssh/id_rsa.pub on your mac 2. copy it"]
  },
  "railsbox": {
    "db_root_password": "welcome!",
    "databases": {
      "postgresql": [
        { "username": "psyapp",
          "password": "psqlpassword",
          "database_name": "appname_production" }
      ]
    },
    "ruby": {
      "versions": ["2.0.0-p247", "2.0.0-p247"],
      "global_version": "2.0.0-p247"
    },
    "apps": {
      "unicorn": [
        { "appname": "railsbox-example-app1",
          "hostname": "33.33.33.10"
        }
      ]
    }
  },
    "github_deploys": {
    "deploy_user": "deploy",
    "github_api": {
      "username": "set your github username",
      "email": "set your github user email",
      "password": "set your github password"
    }
  },
  "nginx":
{
  "version": "1.5.2"
}
}

See also ouyangzhiping/railsbox-example for railsbox usage example with chef-solo.

Attributes

You may change the default config settings:

  • nginx:
    • node["railsbox"]["default_config"]["nginx"]["template_name"] (default: "nginx_vhost.conf.erb") - nginx vhost/site config template.
    • node["railsbox"]["default_config"]["nginx"]["template_cookbook"] (default: "railsbox") - cookbook containing the nginx vhost/site config template.
    • node["railsbox"]["default_config"]["nginx"]["listen_port"] (default: "80") - nginx vhost/site listen port.
    • node["railsbox"]["upstream_start_port"]["unicorn"] (default: 10001) - start number for unicorn app listen port.
    • node["railsbox"]["upstream_start_port"]["passenger"] (default: 20001) - start number for passenger app listen port.
  • unicorn:
    • node["railsbox"]["default_config"]["unicorn"]["listen_port_options"] (default: { :tcp_nodelay => true, :backlog => 100 }) - unicorn listen port options.
    • node["railsbox"]["default_config"]["unicorn"]["worker_timeout"] (default: 60) - unicorn worker timeout.
    • node["railsbox"]["default_config"]["unicorn"]["preload_app"] (default: false) - unicorn preload app flag.
    • node["railsbox"]["default_config"]["unicorn"]["worker_processes"] (default: [node[:cpu][:total].to_i * 4, 8].min) - total unicorn worker.
    • node["railsbox"]["default_config"]["unicorn"]["before_fork"] (default: 'sleep 1') - unicorn before_fork handler.
  • unicorn_runit:
    • node["railsbox"]["default_config"]["unicorn_runit"]["template_name"] (default: "unicorn") - name to lookup unicorn runit templates (templates: "sv-#{template_name}-run.erb", "sv-#{template_name}-log-run.erb).
    • node["railsbox"]["default_config"]["unicorn_runit"]["template_cookbook"] (default: "railsbox") - cookbook containing the templates.
    • node["railsbox"]["default_config"]["unicorn_runit"]["rack_env"] (default: "production") - default RACK_ENV to run a unicorn app.
    • postgresql:
    • node["railsbox"]["db_root_password"] (default: nil) - postgresql root password string.
    • node["railsbox"]["databases"]["postgresql"]["username"]- Rails app database username
    • node["railsbox"]["databases"]["postgresql"]["password"]- Rails app database password
    • node["railsbox"]["databases"]["postgresql"]["database_name"]- Rails app database name
  • github-deploys:
    • node["railsbox"]["github_deploys"]["deploy_user"] (default: "deploy") - don't edit !
    • node["railsbox"]["github_deploys"]["github_api"]["endpoint_path"] (default: "/user/keys") - User Public Keys | GitHub API !
    • node["railsbox"]["github_deploys"]["username"] - set your github username
    • node["railsbox"]["github_deploys"]["email"] - set your github email
    • node["railsbox"]["github_deploys"]["password"] - set your github password

Recipes

  • recipe "railsbox", "Includes all recipes."
  • recipe "railsbox::ruby", "Install and setup Ruby environment using rbenv"
  • recipe "railsbox::nginx", "Install Nginx from source as front-end server."
  • recipe "railsbox::unicorn", "Setup Unicorn apps as backend server (if any)."
  • recipe "railsbox::postgresql", "Install PostgreSQL and create PostgreSQL databases."
  • recipe "railsbox::nodejs", "Install nodejs from package to complie assest."
  • recipe "railsbox:github-deploys", "Using the Github API to authorise the new public key (if any)"

Change History

See [CHANGELOG](CHANGELOG.md).

Author

Author:: zhiping (http://yangzhiping.com)

Dependent cookbooks

appbox >= 0.0.0
rbenv >= 0.0.0
nginx >= 0.0.0
unicorn >= 1.2.2
runit >= 1.1.2
postgresql >= 0.0.0
database >= 0.0.0
nodejs >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

0.1.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.1.0 failed this metric

FC064: Ensure issues_url is set in metadata: railsbox/metadata.rb:1
FC065: Ensure source_url is set in metadata: railsbox/metadata.rb:1
FC066: Ensure chef_version is set in metadata: railsbox/metadata.rb:1
FC069: Ensure standardized license defined in metadata: railsbox/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.1.0 passed this metric

Testing File Metric
            

0.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number