You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom non Rails and it seems that when I run mina deploy it executes certain tasks twice (namely install:* and daemons:*). Here's the script:
require 'mina/bundler'
require 'mina/git'
require 'mina/rvm'
require 'yaml'
LOCAL_SETTINGS = YAML.load_file(File.dirname(__FILE__) + '/local_settings.yml')
set :project_local_dir, File.expand_path(File.dirname(__FILE__) + "/../" + LOCAL_SETTINGS['project_dir'])
set :domain, 'deploy@mega-app'
set :port, 22
set :forward_agent, true
set :term_mode, :pretty
set :addons, {
payment_ui: 'mega-app/payment_ui'
}
set :gems, {
'mega-app-server' => 'server',
'mega-app' => 'engine'
}
# For system-wide RVM install.
set :rvm_path, '/usr/local/rvm/scripts/rvm'
task :environment do
stage_param = ENV['to']
if stage_param == 'production'
set :stage, 'production'
set :server_port, 9695
invoke :'rvm:use[ruby-ruby-2.2-head@production]'
else
set :stage, 'staging'
set :server_port, 9696
invoke :'rvm:use[ruby-ruby-2.2-head@staging]'
end
end
desc "Deploys the current version to the server."
task :deploy => :environment do
invoke :'upload:addons'
invoke :'upload:gems'
invoke :'install:addons'
invoke :'install:gems'
invoke :'daemons:restart'
run_local!(:local)
run!
end
namespace :upload do
task :addons => :environment do
to :local do
queue "echo '-----> Packaging and uploading addons'"
addons.each do |addon_name, addon_path|
queue "echo ' Packaging and uploading #{addon_name}'"
dir = "#{project_local_dir}/#{addon_path}"
queue "#{project_local_dir}/mega-app/deployment/git-archive-all.sh #{dir}/#{addon_name}-master.tar --tree-ish master"
queue "rsync -avze 'ssh' --delete #{dir}/#{addon_name}-master.tar #{domain}:/home/deploy/.mega-app-#{stage}/addons/"
queue "rm #{dir}/#{addon_name}-master.tar"
end
end
end
task :gems => :environment do
to :local do
queue "echo '-----> Uploading gems'"
gems.each do |gem_name, gem_path|
queue "echo ' Building and uploading #{gem_name}'"
dir = "#{project_local_dir}/#{gem_path}"
queue "cd #{dir} && rake build"
queue "rsync -avze 'ssh' --delete #{dir}/pkg/*.gem #{domain}:/home/deploy/mega-app-gems/#{stage}/"
end
end
end
end
namespace :install do
task :addons => :environment do
dir = "/home/deploy/.mega-app-#{stage}/addons"
in_directory dir do
queue "echo '-----> Installing addons'"
addons.each do |addon_name, addon_path|
queue "echo ' Installing #{addon_name} into #{dir}'"
queue "mkdir -p #{addon_name}"
queue "tar -C #{addon_name} -xvf #{addon_name}-master.tar"
queue "cd #{addon_name} && bundle"
end
end
end
task :gems => :environment do
queue "echo '-----> Installing rubygems'"
dir = "/home/deploy/mega-app-gems/#{stage}/"
in_directory dir do
gems.each do |gem_name, gem_path|
queue "echo ' Installing #{gem_name}'"
queue "gem install $(ls #{gem_name}* -Art | tail -n 1) --no-ri --no-rdoc"
end
end
end
end
namespace :daemons do
task :start => :environment do
queue "echo '-----> Starting mega-app-server daemon at port #{server_port}'"
queue "mega-app-server -p #{server_port} --config-dir=~/.mega-app-#{stage} --daemonize --pid ~/.mega-app-#{stage}/mega-app.pid"
end
task :stop => :environment do
queue "echo '-----> Stopping mega-app-server daemon'"
queue "if test -f '~/.mega-app-#{stage}/mega-app.pid'; then kill $(cat ~/.mega-app-#{stage}/mega-app.pid);fi"
end
task :restart => :environment do
invoke :'daemons:stop'
invoke :'daemons:start'
end
end
Can you shed some light as to why this might be happening?
The text was updated successfully, but these errors were encountered:
snitko
changed the title
Runs tasks twice for some reason
mina:deploy runs tasks twice for some reason
May 26, 2015
I have a custom non Rails and it seems that when I run
mina deploy
it executes certain tasks twice (namelyinstall:*
anddaemons:*
). Here's the script:Can you shed some light as to why this might be happening?
The text was updated successfully, but these errors were encountered: