No commit activity in last 3 years
No release in over 3 years
Capistrano3 core recipe to manage runit services
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0

Runtime

>= 1.3
 Project Readme

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:deployer -e /home/deployer/apps/your_application/runit/.env 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_search_path -- Path of $PATH where we will try to found sv binary. Default value: /sbin:/usr/sbin