fix deploy rake process

This commit is contained in:
Xavier J 2016-02-24 11:12:18 +01:00
parent 774ad95cc6
commit e1d1e356e5

View file

@ -1,7 +1,7 @@
require 'mina/bundler' require 'mina/bundler'
require 'mina/rails' require 'mina/rails'
require 'mina/git' require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org) require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io) # require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings: # Basic settings:
@ -20,7 +20,7 @@ print "Deploy to #{ENV['to']} environment branch #{branch}\n"
# set :domain, '5.135.190.60' # set :domain, '5.135.190.60'
set :domain, ENV['domain'] set :domain, ENV['domain']
set :repository,'https://github.com/sgmap/tps.git' set :repository, 'https://github.com/sgmap/tps.git'
set :port, 2200 set :port, 2200
set :deploy_to, '/var/www/tps_dev' set :deploy_to, '/var/www/tps_dev'
@ -33,7 +33,7 @@ if ENV["to"] == "staging"
set :branch, ENV['branch'] set :branch, ENV['branch']
end end
set :deploy_to, '/var/www/tps_dev' set :deploy_to, '/var/www/tps_dev'
set :user, 'tps_dev' # Username in the server to SSH to. set :user, 'tps_dev' # Username in the server to SSH to.
appname = 'tps_dev' appname = 'tps_dev'
elsif ENV["to"] == "production" elsif ENV["to"] == "production"
if ENV['branch'].nil? if ENV['branch'].nil?
@ -42,7 +42,7 @@ elsif ENV["to"] == "production"
set :branch, ENV['branch'] set :branch, ENV['branch']
end end
set :deploy_to, '/var/www/tps' set :deploy_to, '/var/www/tps'
set :user, 'tps' # Username in the server to SSH to. set :user, 'tps' # Username in the server to SSH to.
appname = 'tps' appname = 'tps'
end end
@ -54,24 +54,24 @@ set :rails_env, ENV["to"]
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. # Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step. # They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, [ set :shared_paths, [
'log', 'log',
'bin', 'bin',
'uploads', 'uploads',
'tmp/pids', 'tmp/pids',
'tmp/cache', 'tmp/cache',
'tmp/sockets', 'tmp/sockets',
'public/system', 'public/system',
'public/uploads', 'public/uploads',
'config/database.yml', 'config/database.yml',
'config/initializers/secret_token.rb', 'config/initializers/secret_token.rb',
"config/environments/#{ENV['to']}.rb", "config/environments/#{ENV['to']}.rb",
"config/initializers/token.rb", "config/initializers/token.rb",
"config/initializers/super_admin.rb", "config/initializers/super_admin.rb",
"config/unicorn.rb", "config/unicorn.rb",
"config/initializers/raven.rb", "config/initializers/raven.rb",
'config/france_connect.yml', 'config/france_connect.yml',
'config/initializers/mailjet.rb' 'config/initializers/mailjet.rb'
] ]
set :rbenv_path, "/usr/local/rbenv/bin/rbenv" set :rbenv_path, "/usr/local/rbenv/bin/rbenv"
@ -79,7 +79,7 @@ set :rbenv_path, "/usr/local/rbenv/bin/rbenv"
# Optional settings: # Optional settings:
# set :user, 'foobar' # Username in the server to SSH to. # set :user, 'foobar' # Username in the server to SSH to.
# set :port, '30000' # SSH port number. # set :port, '30000' # SSH port number.
set :forward_agent, true # SSH forward_agent. set :forward_agent, true # SSH forward_agent.
# This task is the environment that is loaded for most commands, such as # This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`. # `mina deploy` or `mina rake`.
@ -109,13 +109,13 @@ task :setup => :environment do
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"] queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
queue! %[touch "#{deploy_to}/shared/config/database.yml"] queue! %[touch "#{deploy_to}/shared/config/database.yml"]
queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."] queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
queue! %[touch "#{deploy_to}/shared/environments/production.rb"] queue! %[touch "#{deploy_to}/shared/environments/production.rb"]
queue %[echo "-----> Be sure to edit 'shared/environments/production.rb'."] queue %[echo "-----> Be sure to edit 'shared/environments/production.rb'."]
queue! %[touch "#{deploy_to}/shared/environments/staging.rb"] queue! %[touch "#{deploy_to}/shared/environments/staging.rb"]
queue %[echo "-----> Be sure to edit 'shared/environments/staging.rb'."] queue %[echo "-----> Be sure to edit 'shared/environments/staging.rb'."]
end end
desc "Deploys the current version to the server." desc "Deploys the current version to the server."
@ -128,11 +128,14 @@ task :deploy => :environment do
invoke :'deploy:link_shared_paths' invoke :'deploy:link_shared_paths'
invoke :'bundle:install' invoke :'bundle:install'
invoke :'rails:db_migrate' invoke :'rails:db_migrate'
invoke :'rails:db_seed'
invoke :'rails:assets_precompile' invoke :'rails:assets_precompile'
to :launch do to :launch do
queue "/etc/init.d/#{user} upgrade " queue "/etc/init.d/#{user} upgrade "
queue "cd #{deploy_to}/#{current_path}/"
queue "bundle exec rake db:seed RAILS_ENV=#{rails_env}"
queue %[echo "-----> Rake Seeding Completed."]
end end
end end
end end