Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/apontini/mina-proteus

support for multiple apps and multiple stages for Mina using Hanami ruby framework
https://github.com/apontini/mina-proteus

deploy hanami mina multiapp multienvironment ruby

Last synced: about 2 months ago
JSON representation

support for multiple apps and multiple stages for Mina using Hanami ruby framework

Awesome Lists containing this project

README

        

[![Gem Version](https://badge.fury.io/rb/mina-proteus.svg)](https://badge.fury.io/rb/mina-proteus) ![Gem](https://img.shields.io/gem/dt/mina-proteus.svg?color=brightgreen)

# Mina::Proteus

Plugin for Mina that adds support for multiple stages and multiple apps to Mina, specifically built for [Hanami ruby framework](https://hanamirb.org/).
This gem is based on [endoze's mina-multistage gem](https://github.com/endoze/mina-multistage), huge thanks to him!

## Installation & Usage

Add this line to your application's Gemfile:

```rb
gem 'mina-proteus', require: false
```

And then execute:

```shell
$ bundle install
```

Or install it yourself as:

```shell
$ gem install mina-proteus
```

Require `mina/proteus` in your `config/deploy.rb`:

```rb
# config/deploy.rb

require 'mina/proteus'
require 'mina/bundler'
require 'mina/git'

...

task setup: do
...
end

desc 'Deploys the current version to the server.'
task deploy: do
...
end
```
You then need to specify your hanami apps like this:

```rb
# config/deploy.rb

set :hanami_apps, %w(app1 app2 app3)
```

That's the only required parameter, optional parameters are:

```rb
# config/deploy.rb

set :stages, %w(staging production) #specify your stages
set :stages_dir, 'config/deploy' #specify which directory will have all the configurations files
set :default_stage, 'staging' #specify your default stage

#this is used to deploy a single application in a specific environment
set :bundle_prefix, -> { %{HANAMI_ENV="#{fetch(:current_stage)}" HANAMI_APPS="#{fetch(:current_app)}" #{fetch(:bundle_bin)} exec} }
```
Note that `current_stage` and `current_app` are respectively the stage and the application being called.

Then to create every file run:

```shell
$ bundle exec mina proteus:init
```

This will create `config/deploy/staging.rb` and `config/deploy/production.rb` stage files and
`config/deploy/staging/app1.rb`, `config/deploy/staging/app1.rb`, etc.
Use them to define stage and app specific configuration.

Now you can deploy the default stage with:

```shell
$ mina deploy # this deploys to :default_stage
```

Or specify a stage explicitly:

```shell
$ mina staging deploy
$ mina production deploy
```

# Maintenance and Contribution
I'll be rarely maintaining this source code due to lack of time, but i will do as much as i can to resolve any open issues.
If you want to contribute, feel free to fork it, branch it and to create a pull request.