Skip to content

Capistrano tasks for automatic and sensible unicorn + nginx configuration

License

Notifications You must be signed in to change notification settings

freibuis/capistrano-unicorn-nginx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Capistrano::UnicornNginx

IMPORTANT NOTE. When upgrading to 4.0.0, please ensure you have generated a new 2048 bits Diffie-Hellman group. Run the following command on your server before installing this gem:

openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

See https://weakdh.org/sysadmin.html for more details.

Capistrano tasks for automatic and sensible unicorn + nginx configuraion.

Goals of this plugin:

  • automatic unicorn and nginx configuration for Rails apps
  • no manual ssh to the server required
  • zero downtime deployments enabled
  • support for single node as well as cluster deployments

Specifics:

  • generates nginx config file on the server (web role)
  • generates unicorn initializer and config files (app role)
    application is started automatically after server restart
  • capistrano tasks for server management, example: unicorn:restart
    see below for all available tasks
  • automatic load balancing setup when there are multiple app nodes

capistrano-unicorn-nginx works only with Capistrano 3!

Installation

Add this to Gemfile:

group :development do
  gem 'capistrano', '~> 3.2.1'
  gem 'capistrano-unicorn-nginx', '~> 3.2.0'
end

And then:

$ bundle install

Setup and usage

Depending on your needs 2 general scenarios are covered:

  • single server setup
    A scenario where you run the webserver (nginx) and application server (unicorn) on the same node.
  • multiple server setup
    Webserver (nginx) and application server (unicorn) run on different nodes.

Default log file directories

  • nginx: /var/log/nginx/
  • unicorn: #{shared_path}/log/

Configuration

See the full options list on the wiki page. Feel free to skip this unless you're looking for something specific.

How it works

How it works wiki page contains the list of tasks that the plugin executes.

You do not have to know this unless you want to learn more about the plugin internals.

Template customization

On template customization wiki page see how to inspect, tweak and override templates for nginx and unicorn config files.

Do not do this unless you have a specific need.

More Capistrano automation?

Check out capistrano-plugins github org.

Bug reports and pull requests

...are very welcome!

Thanks

@kalys - for his capistrano-nginx-unicorn plugin.

About

Capistrano tasks for automatic and sensible unicorn + nginx configuration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 57.2%
  • HTML 33.6%
  • Shell 9.2%