poise / application_ruby

Development repository for Opscode Cookbook application_ruby
Apache License 2.0
124 stars 153 forks source link

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_puma

The application_puma resource creates a service for puma.

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

Actions

Properties

application_rackup

The application_rackup resource creates a service for rackup.

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

Actions

Properties

application_rails

The application_rails resource

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

Actions

Properties

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

Properties

application_unicorn

The application_unicorn resource creates a service for unicorn.

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

Actions

Properties

Sponsors

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

The Poise test server infrastructure is sponsored by Rackspace.

License

Copyright 2015-2017, 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.