Code Monkey home page Code Monkey logo

unicorn's Introduction

Description

Installs and configures unicorn, and provides a definition to manage configuration file for Rack apps running under unicorn.

Requirements

Should work anywhere.

Definitions

unicorn_config

The unicorn_config definition manages the configuration template for an application running under unicorn.

Parameters:

  • listen - Default is nil.
  • working_directory - Default is nil.
  • worker_timeout - Default is 60.
  • preload_app - Default is false.
  • worker_processes - Number of worker processes to spawn. Default is 4.
  • unicorn_command_line - If set, specifies the unicorn commandline to set in the config file. Usefull when sandboxing your unicorn installation.
  • forked_user - User to run children as. Default is nil.
  • forked_group - Group to run children as. You must specify a forked_user as well to use this attribute. Default is nil.
  • before_exec - Default is nil.
  • before_fork - Default is nil.
  • after_fork - Default is nil.
  • pid - Pidfile location. Default is nil.
  • stderr_path - Where stderr gets logged. Default is nil.
  • stdout_path - Where stdout gets logged. Default is nil.
  • notifies - How to notify another service if specified. Default is nil.
  • owner - Owner of the template. Default is nil.
  • group - group of the template. Default is nil.
  • mode - mode of the template. Default is nil.
  • unicorn_command_line - Specify the command-line for the unicorn binary as a string. Populates Unicorn::HttpServer::START_CTX[0]. Default is nil.
  • copy_on_write - Whether the app should take advantage of REE Copy On Write feature. Default is false.
  • enable_stats - Whether the app should have GC profiling enabled for instrumentation. Default is false.

For more information on copy_on_write and enable_stats, see:

Respectively.

Examples:

Setting some custom attributes in a recipe (this is from Opscode's application::unicorn.

node.default[:unicorn][:worker_timeout] = 60
node.default[:unicorn][:preload_app] = false
node.default[:unicorn][:worker_processes] = [node[:cpu][:total].to_i * 4, 8].min
node.default[:unicorn][:preload_app] = false
node.default[:unicorn][:before_fork] = 'sleep 1'
node.default[:unicorn][:port] = '8080'
node.set[:unicorn][:options] = { :tcp_nodelay => true, :backlog => 100 }

unicorn_config "/etc/unicorn/#{app['id']}.rb" do
  listen({ node[:unicorn][:port] => node[:unicorn][:options] })
  working_directory ::File.join(app['deploy_to'], 'current')
  worker_timeout node[:unicorn][:worker_timeout]
  preload_app node[:unicorn][:preload_app]
  worker_processes node[:unicorn][:worker_processes]
  before_fork node[:unicorn][:before_fork]
end

License and Author

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.

unicorn's People

Contributors

cwebberops avatar d1plo1d avatar dwradcliffe avatar grantr avatar jschneiderhan avatar nathenharvey avatar switchflip avatar threetee avatar

Watchers

 avatar  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.