Skip to content

natify/capistrano-runit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capistrano-runit-core

Base core capistrano3 module for managing various services via runit supervisor.

Installation

Add to Gemfile:

group :development do
  gem "capistrano-runit-core", "~> 0.1.0"
end

Run:

$ bundle install

runit setup

We need to create specific runit service for our whole application: Create service folder inside /etc/sv:

mkdir /etc/sv/runsvdir-your_application
mkdir /etc/sv/runsvdir-your_application/log

Create run shell script /etc/sv/runsvdir-your_application/run:

#!/bin/sh
exec 2>&1
exec chpst -udeployer runsvdir /home/deployer/apps/your_application/runit/enabled

In current example expected what you deploying with deployer user to the /home/deployer/apps/your_application folder.

Create log run shell script /etc/sv/runsvdir-your_application/log/run:

#!/bin/sh
exec svlogd -tt /var/log/runsvdir-your_application

Create log folder:

mkdir /var/log/runsvdir-your_application

And make this scripts executable:

chmod a+x /etc/sv/runsvdir-your_application/run /etc/sv/runsvdir-your_application/log/run

And after this we will need to make symlink in /etc/service/

ln -s /etc/sv/runsvdir-your_application /etc/service/runsvdir-your_application

Usage

Add this line in Capfile:

require "capistrano/runit"

Tasks

  • runit:setup -- prepare runit directories in the project directory.

Variables

  • runit_roles -- what host roles uses runit to run processes. Default value: [:app, :db].
  • runit_sv_path -- Path to the runit sv binary. Default value: /sbin/sv

About

Manage runit-services with capistrano

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%