Giter Club home page Giter Club logo

core's Introduction

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

core's People

Contributors

antage avatar nfedyashev avatar simonoff avatar

Watchers

 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.