Giter Club home page Giter Club logo

capistrano-nginx-unit's Introduction

capistrano-nginx-unit

Installation

# Gemfile
gem "capistrano-nginx-unit"

Usage

Require in Capfile.

# Capfile
require "capistrano/nginx-unit"

Defined following tasks.

cap nginx_unit:attach              # Attach listener and application configuration to NGINX Unit
cap nginx_unit:attach_app          # Attach application configuration to NGINX Unit
cap nginx_unit:attach_listener     # Attach listener configuration to NGINX Unit
cap nginx_unit:detach              # Detach listener and application configuration from NGINX Unit
cap nginx_unit:detach_app          # Detach application configuration from NGINX Unit
cap nginx_unit:detach_listener     # Detach listener configuration from NGINX Unit
cap nginx_unit:start               # Start NGINX Unit process
cap nginx_unit:stop                # Stop NGINX Unit process

nginx_unit:attach is main task.
The task sends HTTP request to configure NGINX Unit on server.
When NGINX Unit process received the request, launches rack application process.
If you want to apply new code when deployed, please invoke nginx_unit:attach task after deploy:published.

# deploy.rb
after "deploy:published", "nginx_unit:attach"

Options

set :nginx_unit_roles,        -> { :app }
set :nginx_unit_control_sock, -> { "/var/run/control.unit.sock" }
set :nginx_unit_listen,       -> { "*:3000" }
set :nginx_unit_listener,     -> { { pass: "applications/#{fetch(:nginx_unit_app_name)}" } }
set :nginx_unit_app_name,     -> { fetch(:application) }
set :nginx_unit_processes,    -> { nil }
set :nginx_unit_user,         -> { nil }
set :nginx_unit_group,        -> { nil }
set :nginx_unit_working_dir,  -> { nil }
set :nginx_unit_script,       -> { "config.ru" }
set :nginx_unit_environment,  -> { {} }
set :nginx_unit_limits,       -> { nil }
  • :nginx_unit_roles

    Roles to run tasks for NGINX Unit. Default: :app

  • :nginx_unit_control_sock

    Path to NGINX Unit's unix domain socket path. Default: "/var/run/control.unit.sock"

  • :nginx_unit_listen

    IP Address and port where rack application listens on. Default: "*:3000"
    See Listeners configuration

  • :nginx_unit_listener

    Listener configuration of rack application processes. Default: { pass: "applications/#{fetch(:nginx_unit_app_name)}" }
    If you are using NGINX Unit that doesn`t support pass option, you can overwrite this configuration with { application: fetch(:nginx_unit_app_name) }
    (However, application option is currently deprecated.)
    See Listeners configuration

  • :nginx_unit_app_name

    Application name.
    See Applications configuration

  • :nginx_unit_processes

    Number of rack application processes. Default: 1
    You can also set the Hash that has keys max, spare and idle_timeout.
    See Processes and Limits

  • :nginx_unit_user, :nginx_unit_group

    Username and group of rack application process. Default: "nobody"
    See Application Object configuration

  • :nginx_unit_working_dir

    Working directory of rack application process. Default: RELEASE_PATH
    See Application Object configuration

  • :nginx_unit_script

    Rack application script path. Default: RELEASE_PATH/config.ru
    See Ruby application configuration

  • :nginx_unit_environment (NGINX Unit >= 1.2)

    Environment variable setting. Default value is empty.
    This variable accepts Hash. e.g., { "RAILS_ENV" => "production" }.

  • :nginx_unit_limits

    Request limits of rack application processes. Default: nil(not specified)
    You can set the Hash that has keys requests and timeout.
    See Processes and Limits

capistrano-nginx-unit's People

Contributors

tab10id avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

stc-elins

capistrano-nginx-unit's Issues

Not compatible with Unit 1.4

In 1.4 changed path for config object https://unit.nginx.org/CHANGES.txt
Now it '/config' instead of '/'.
We fixed it in 73548e7
But it broke backward compatibility with 1.3 and below.
If you want to save backward compatibility we need to check version of unit.
Version of unit can be parsed from http headers.
What do you think?

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.