https://github.com/hovancik/mina-supervisord
Supervisor wrapper for mina
https://github.com/hovancik/mina-supervisord
deployment mina rails ruby supervisord
Last synced: 2 months ago
JSON representation
Supervisor wrapper for mina
- Host: GitHub
- URL: https://github.com/hovancik/mina-supervisord
- Owner: hovancik
- License: mit
- Created: 2017-06-15T11:40:53.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-04-28T07:01:25.000Z (about 6 years ago)
- Last Synced: 2024-05-02T00:56:59.709Z (about 2 years ago)
- Topics: deployment, mina, rails, ruby, supervisord
- Language: Ruby
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Mina::Supervisord
This is a [Supervisor](http://supervisord.org/) (process control system) wrapper for [mina](https://github.com/mina-deploy/mina).
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'mina-supervisord', require: false
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install mina-supervisord
## Usage
To restart your app during deploy you might add this to `deloy.rb`:
```ruby
require 'mina/supervisord'
task deploy: :environment do
deploy do
...
on :launch do
invoke :'supervisord:restart', 'puma'
end
end
end
```
To call it as mina task, eg. to start your puma, you would run this from command line:
```ruby
bundle exec mina supervisord:start['puma']
```
`puma` is a supervisord [program](http://supervisord.org/running.html#adding-a-program).
### Supported tasks
- `supervisord:restart`- to restart a program (eg. `bundle exec mina supervisord:restart['program']`)
- `supervisord:start`- to start a program (eg. `bundle exec mina supervisord:start['program']`)
- `supervisord:stop`- to stop a program (eg. `bundle exec mina supervisord:stop['program']`)
- `supervisord:status`- to get status of a program (eg. `bundle exec mina supervisord:status['program']`)
- `supervisord:signal`- to send a signal to a program (eg. `bundle exec mina supervisord:signal['program,signal']`)
#### Extra tasks
- `supervisord:signal:or_start`- to send a signal to a program, or start it if not running (eg. `bundle exec mina supervisord:signal:or_start['program,signal']`)
- `supervisord:restart:or_start`- to restart a program, or start it if not running (eg. `bundle exec mina supervisord:restart:or_start['program']`)
You might find these extra tasks useful when you are not sure whether your program is running.
Eg. when we do our deploy, we want our `puma` server to be restarted or started if not running already. To do that, we have following in our `deploy.rb`:
```ruby
desc "Phased restart of the application"
task :phased_restart => :environment do
invoke :'supervisord:signal:or_start', fetch(:application_supervisor_file), "SIGUSR1"
end
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/hovancik/mina-supervisord. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Development of this gem is sponsored by [Mix.it](http://mix.it).
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).