Coder Social home page Coder Social logo

application_ruby's Introduction

Application_Ruby Cookbook

Build Status Gem Version Cookbook Version Coverage Gemnasium License

A Chef cookbook to deploy Ruby applications.

Quick Start

To deploy a Rails application from git:

application '/srv/myapp' do
  git 'https://github.com/example/myapp.git'
  bundle_install do
    deployment true
    without %w{development test}
  end
  rails do
    database 'sqlite3:///db.sqlite3'
    secret_token 'd78fe08df56c9'
    migrate true
  end
  unicorn do
    port 8000
  end
end

Requirements

Chef 12.1 or newer is required.

Resources

application_bundle_install

The application_bundle_install resource installs gems using Bundler for a deployment.

application '/srv/myapp' do
  bundle_install do
    deployment true
    without %w{development test}
  end
end

All actions and properties are the same as the bundle_install resource.

application_rackup

The application_rackup resource creates a service for rackup.

application '/srv/myapp' do
  rackup do
    port 8000
  end
end

Actions

  • :enable – Create, enable and start the service. (default)
  • :disable – Stop, disable, and destroy the service.
  • :start – Start the service.
  • :stop – Stop the service.
  • :restart – Stop and then start the service.
  • :reload – Send the configured reload signal to the service.

Properties

  • path – Base path for the application. (name attribute)
  • port – Port to listen on. (default: 80)
  • service_name – Name of the service to create. (default: auto-detect)

user – User to run the service as. (default: application owner)

application_rails

The application_rails resource

application '/srv/myapp' do
  rails do
    database 'sqlite3:///db.sqlite3'
    secret_token 'd78fe08df56c9'
    migrate true
  end
end

Actions

  • :deploy – Create config files and run required deployments steps. (default)

Properties

  • path – Base path for the application. (name attribute)
  • database – Database settings for Rails. See the database section below for more information. (option collector)
  • migrate – Run database migrations. (default: false)
  • precompile_assets – Run rake assets:precompile. *(default: auto-detect)()
  • rails_env – Rails environment name. (default: node.chef_environment)
  • secret_token – Secret token for Rails session verification et al.
  • secrets_mode – Secrets configuration mode. Set to :yaml to generate a Rails 4.2 secrets.yml. Set to :initializer to update config/initializers/secret_token.rb. (default: auto-detect)

NOTE: At this time secrets_mode :initializer is not implemented.

Database Parameters

The database parameters can be set in three ways: URL, hash, and block.

If you have a single URL for the parameters, you can pass it directly to database:

rails do
  database 'mysql2://myuser@dbhost/myapp'
end

Passing a single URL will also set the $DATABASE_URL environment variable automatically for compatibility with Heroku-based applications.

As with other option collector resources, you can pass individual settings as either a hash or block:

rails do
  database do
    adapter 'mysql2'
    username 'myuser'
    host 'dbhost'
    database 'myapp'
  end
end

rails do
  database({
    adapter: 'mysql2',
    username: 'myuser',
    host: 'dbhost',
    database: 'myapp',
  })
end

application_ruby

The application_ruby resource installs a Ruby runtime for the deployment.

application '/srv/myapp' do
  ruby '2.2'
end

All actions and properties are the same as the ruby_runtime resource.

application_ruby_gem

The application_ruby_gem resource installs Ruby gems for the deployment.

application '/srv/myapp' do
  ruby_gem 'rake'
end

All actions and properties are the same as the ruby_gem resource.

application_ruby_execute

The application_ruby_execute resource runs Ruby commands for the deployment.

application '/srv/myapp' do
  ruby_execute 'rake'
end

All actions and properties are the same as the ruby_execute resource, except that the cwd, environment, group, and user properties default to the application-level data if not specified.

application_thin

The application_thin resource creates a service for thin.

application '/srv/myapp' do
  thin do
    port 8000
  end
end

Actions

  • :enable – Create, enable and start the service. (default)
  • :disable – Stop, disable, and destroy the service.
  • :start – Start the service.
  • :stop – Stop the service.
  • :restart – Stop and then start the service.
  • :reload – Send the configured reload signal to the service.

Properties

  • path – Base path for the application. (name attribute)
  • config_path – Path to a Thin configuration file.
  • port – Port to listen on. (default: 80)
  • service_name – Name of the service to create. (default: auto-detect)

user – User to run the service as. (default: application owner)

application_unicorn

The application_unicorn resource creates a service for unicorn.

application '/srv/myapp' do
  unicorn do
    port 8000
  end
end

Actions

  • :enable – Create, enable and start the service. (default)
  • :disable – Stop, disable, and destroy the service.
  • :start – Start the service.
  • :stop – Stop the service.
  • :restart – Stop and then start the service.
  • :reload – Send the configured reload signal to the service.

Properties

  • path – Base path for the application. (name attribute)
  • port – Port to listen on. (default: 80)
  • service_name – Name of the service to create. (default: auto-detect)

user – User to run the service as. (default: application owner)

Sponsors

Development sponsored by Chef Software, Symonds & Son, and Orion.

The Poise test server infrastructure is sponsored by Rackspace.

License

Copyright 2015-2016, Noah Kantrowitz

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

application_ruby's People

Contributors

coderanger avatar sethvargo avatar kevinreedy avatar jschneiderhan avatar lamont-granquist avatar bryanstearns avatar cap10morgan avatar rabidtester avatar mauriciosilva avatar redbeard avatar stephenlauck avatar logikal avatar rgeyer avatar jtimberman avatar josephholsten avatar wallace avatar jeanmertz avatar iafonov avatar threetee avatar dwradcliffe avatar flaccid avatar btm avatar adamstegman avatar

Watchers

James Cloos avatar Brandon McCann 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.