cookbook 'application_ruby', '= 4.0.1'
application_ruby
(18) Versions
4.0.1
-
Follow70
A Chef cookbook for deploying application code.
cookbook 'application_ruby', '= 4.0.1', :supermarket
knife supermarket install application_ruby
knife supermarket download application_ruby
Application_Ruby Cookbook
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 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
– Runrake 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 updateconfig/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, 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.
Dependent cookbooks
poise-service ~> 1.0 |
poise ~> 2.0 |
application ~> 5.0 |
poise-ruby ~> 2.1 |
Contingent cookbooks
Application_Ruby Changelog
v4.0.1
- Correct
gem_binary
results forapplication_ruby
.
v4.0.0
- Massive rewrite on top of newer Chef patterns. See the 4.0 README for details.
v3.0.2
- No changes, bumping version to get bits in various places in sync.
v3.0.0
- Major version bump. Breaking backwards compatibility with Chef 10.
v2.2.0
- COOK-3895 - application_ruby use_omnibus_ruby attr needs to default to false.
- COOK-3894 - application_ruby cookbook needs version bump to pick up application v4.0 cookbook.
- COOK-2079 - Attempting to touch restart.txt should not cause a chef-client run to fail.
v2.1.4
- COOK-3625 - Fix an issue where unicorn fails when node does not provide cpu count.
v2.1.2
- COOK-3616 - Simplify log symlinking for rails apps.
v2.1.0
- COOK-3367 - Support more of unicorn's configuration.
-
COOK-3124 - Add
memcached_template
attribute to so alternative templates may be used.
v2.0.0
Bug
- [COOK-3306]: Multiple Memory Leaks in Application Cookbook.
- [COOK-3219]:
application_ruby
cookbook bundle install in 1.9.3-based omnibus installs 1.9.x gems into ruby 2.0 apps.
v1.1.4
- [COOK-2806]: Including
passenger_apache2::mod_rails
does not enable passenger.
v1.1.2
- [COOK-2638]: cookbook attribute is not treated as a string when specifying
database_yml_template
. - [COOK-2525]: application_ruby: split runit template into multiple lines.
v1.1.0
- [COOK-2362] -
application_ruby
unicorn usesrun_restart
. - [COOK-2363] -
application_ruby
unicorn should setlog_template_name
andrun_template_name
.
v1.0.10
- [COOK-2260] - pin runit version.
v1.0.8
- [COOK-2159] - cookbook attribute is not treated as a string.
v1.0.6
- [COOK-1481] - unicorn provider in application_ruby cookbook should run its restart command as root.
v1.0.4
- [COOK-1572] - allow specification of 'bundle' command via attribute.
v1.0.2
- [COOK-1360] - fix typo in README.
- [COOK-1374] - use runit attribute in unicorn run script.
- [COOK-1408] - use user and group from parent resource for runit service.
v1.0.0
- [COOK-1247] - Initial release - relates to COOK-634.
- [COOK-1248] - special cases memcached.
- [COOK-1258] - Precompile assets for Rails 3.
- [COOK-1297] - Unicorn sub-resource should allow strings for 'port' attribute.
Collaborator Number Metric
4.0.1 failed this metric
Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
4.0.1 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 http://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
4.0.1 passed this metric
License Metric
4.0.1 failed this metric
application_ruby does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
4.0.1 passed this metric
Testing File Metric
4.0.1 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 http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
4.0.1 passed this metric
4.0.1 failed this metric
4.0.1 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 http://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
4.0.1 passed this metric
License Metric
4.0.1 failed this metric
application_ruby does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
4.0.1 passed this metric
Testing File Metric
4.0.1 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 http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
4.0.1 passed this metric
4.0.1 passed this metric
4.0.1 failed this metric
application_ruby does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
4.0.1 passed this metric
Testing File Metric
4.0.1 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 http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
4.0.1 passed this metric
4.0.1 passed this metric
4.0.1 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 http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
4.0.1 passed this metric
4.0.1 passed this metric