endoze / mina-multistage Goto Github PK
View Code? Open in Web Editor NEWPlugin for Mina that adds support for multiple stages.
Home Page: https://endoze.github.io/mina-multistage/
License: MIT License
Plugin for Mina that adds support for multiple stages.
Home Page: https://endoze.github.io/mina-multistage/
License: MIT License
The documentation for mina-multistage, for example
task setup: :environment do #...
conflicts with mina best practice
! :environment is DEPRECATED! Please use local_environment and remote_environment
From config/deploy.rb
require 'mina/multistage'
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :rvm_path, '$HOME/.rvm/bin/rvm'
task :remote_environment do
invoke :'rvm:use', 'ruby-2.4'
end
task :'db:configure' do
invoke :'rails:db_create'
invoke :'rails:db_migrate'
command "#{fetch(:rails)} db:seed"
end
From config/deploy/production.rb
set :domain, ENV['SOMEENVNAME']
set :deploy_to, ENV['SOMEOTHERENV']
set :repository, '[email protected]:name/codebase.git'
set :branch, 'master'
set :term_mode, nil
set :rails_env, 'production'
task :deploy => :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'db:configure'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
command %[sudo /bin/systemctl restart httpd.service]
end
end
Running the appropriate setup steps and then mina production deploy
(or staging, omitted for simplicity), produces
# ...
-----> Moving build to /path/to/deployment/releases/1
-----> Build finished
-----> Launching
Connection to 1.2.3.4 closed.
-----> Updating the /path/to/deployment/current symlink
-----> Done. Deployed version 1
Elapsed time: 206.62 seconds
-----> Creating a temporary build path # <= starting on version 2
-----> Using RVM environment "ruby-2.4"
Using /home/rakuten-publishers/.rvm/gems/ruby-2.4.1
-----> Fetching new git commits
# ...
and
$ cd /path/to/deployment
$ ls releases/
1 2
Both with seemingly correct deployments.
The change from 1.0.2 to 1.0.3 broke compatibility with mina 0.3.x which is a breaking change in a patch release.
I guess this project does not yet adhere to http://semver.org but it would be awesome if this breaking change was in a new major version.
My suggestion would be, revert 1.0.3 (maybe release 1.0.4 or 1.1) and then release the current 1.0.3 as 2.0. What do you think?
I followed the installation steps but I've got an error when trying to generate config/deploy/staging.rb
and config/deploy/production.rb
stage files.
My Gemfile
group :development, :test do
gem 'mina'
gem 'mina-multistage', require: false
end
The error I got:
$ mina multistage:init --trace
mina aborted!
Don't know how to build task 'staging'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/task_manager.rb:62:in `[]'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:149:in `invoke_task'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/lib/mina/helpers.rb:19:in `invoke'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-multistage-0.1.0/lib/mina/multistage.rb:20:in `<top (required)>'
/vagrant/p/angariador/config/deploy.rb:1:in `require'
/vagrant/p/angariador/config/deploy.rb:1:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:46:in `block (2 levels) in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:26:in `block in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:25:in `instance_eval'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:25:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/mina:23:in `load'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/mina:23:in `<main>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/ruby_executable_hooks:15:in `<main>'
Error loading Rakefile!
mina aborted!
There may be a problem with config/deploy.rb and/or Rakefile
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:49:in `rescue in block (2 levels) in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:45:in `block (2 levels) in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:26:in `block in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:25:in `instance_eval'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:25:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/mina:23:in `load'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/mina:23:in `<main>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/ruby_executable_hooks:15:in `<main>'
SystemExit: exit
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:192:in `exit'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:192:in `exit_because_of_exception'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:186:in `rescue in standard_exception_handling'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:46:in `block (2 levels) in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:26:in `block in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:25:in `instance_eval'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/gems/mina-0.3.0/bin/mina:25:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/mina:23:in `load'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/mina:23:in `<main>'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-2.1.2@angariator/bin/ruby_executable_hooks:15:in `<main>'
i running into an error executing mina deploy
, and wanted to know if its a compatibility issue or another problem
One question...
The migration from mina gem to mina-multistage gem is simple? I need to remove the mina gem first?
Note.: actually I have this gems configured:
gem 'mina'
gem 'mina-unicorn', :require => false
Hi @endoze
When are you think to release new version?
Thank you very much.
Great work.
After installing mina-multistage with mina 1.0 when I run the mina command I get the following error
mina aborted!
NameError: undefined local variable or method `all_stages' for main:Object
/Library/Ruby/Gems/2.0.0/gems/mina-multistage-1.0.2/lib/mina/multistage.rb:36:in `<top (required)>'
/tmp/project/config/deploy.rb:5:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/mina-1.0.0/lib/mina/application.rb:16:in `run'
/Library/Ruby/Gems/2.0.0/gems/mina-1.0.0/bin/mina:4:in `<top (required)>'
/usr/local/bin/mina:23:in `load'
/usr/local/bin/mina:23:in `<main>'
(See full trace by running task with --trace)
I am using mina/whenver with mine/multistage, the whenever_name
variable has missing domain
set_default :whenever_name, "#{domain}_#{rails_env}"
Provide a changelog for new releases, please
Are all set
options supported? I'm setting identity_file
in deploy/production.rb but it is not being picked up.
set :identify_file, 'keys/key.pem'
=====config/deploy.rb =====
set default_stage, 'test'
require 'mina/multistage'
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
...
...
config/deploy
βββ production.rb
βββ qa.rb
βββ stage.rb
βββ test.rb
run mina deply I got:
mina aborted!
Mina::Error: Setting :domain is not set
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/settings.rb:17:in method_missing' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/helpers.rb:308:in
method_missing'
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/ssh_helpers.rb:51:in ssh_command' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/ssh_helpers.rb:89:in
invoke'
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/ssh_helpers.rb:36:in ssh' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/helpers.rb:57:in
block in run!'
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/helpers.rb:84:in measure' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/helpers.rb:73:in
report_time'
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/helpers.rb:57:in run!' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/lib/mina/helpers.rb:94:in
mina_cleanup!'
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/bin/mina:55:in block (2 levels) in <top (required)>' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/bin/mina:26:in
block in <top (required)>'
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/bin/mina:25:in instance_eval' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/gems/mina-0.3.2/bin/mina:25:in
<top (required)>'
/Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/bin/mina:23:in load' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/bin/mina:23:in
eval' /Users/zhanghuan/.rvm/gems/ruby-2.1.5@hire/bin/ruby_executable_hooks:15:in
'A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.