From e1d1e356e56573ecb139f51f7f53ecff5fec8d10 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Wed, 24 Feb 2016 11:12:18 +0100 Subject: [PATCH] fix deploy rake process --- config/deploy.rb | 57 +++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index aa81b70cf..8f377a78a 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,7 +1,7 @@ require 'mina/bundler' require 'mina/rails' 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) # Basic settings: @@ -20,7 +20,7 @@ print "Deploy to #{ENV['to']} environment branch #{branch}\n" # set :domain, '5.135.190.60' set :domain, ENV['domain'] -set :repository,'https://github.com/sgmap/tps.git' +set :repository, 'https://github.com/sgmap/tps.git' set :port, 2200 set :deploy_to, '/var/www/tps_dev' @@ -33,7 +33,7 @@ if ENV["to"] == "staging" set :branch, ENV['branch'] end 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' elsif ENV["to"] == "production" if ENV['branch'].nil? @@ -42,7 +42,7 @@ elsif ENV["to"] == "production" set :branch, ENV['branch'] end 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' end @@ -54,24 +54,24 @@ set :rails_env, ENV["to"] # 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. set :shared_paths, [ - 'log', - 'bin', - 'uploads', - 'tmp/pids', - 'tmp/cache', - 'tmp/sockets', - 'public/system', - 'public/uploads', - 'config/database.yml', - 'config/initializers/secret_token.rb', - "config/environments/#{ENV['to']}.rb", - "config/initializers/token.rb", - "config/initializers/super_admin.rb", - "config/unicorn.rb", - "config/initializers/raven.rb", - 'config/france_connect.yml', - 'config/initializers/mailjet.rb' -] + 'log', + 'bin', + 'uploads', + 'tmp/pids', + 'tmp/cache', + 'tmp/sockets', + 'public/system', + 'public/uploads', + 'config/database.yml', + 'config/initializers/secret_token.rb', + "config/environments/#{ENV['to']}.rb", + "config/initializers/token.rb", + "config/initializers/super_admin.rb", + "config/unicorn.rb", + "config/initializers/raven.rb", + 'config/france_connect.yml', + 'config/initializers/mailjet.rb' + ] set :rbenv_path, "/usr/local/rbenv/bin/rbenv" @@ -79,7 +79,7 @@ set :rbenv_path, "/usr/local/rbenv/bin/rbenv" # Optional settings: # set :user, 'foobar' # Username in the server to SSH to. # 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 # `mina deploy` or `mina rake`. @@ -109,13 +109,13 @@ task :setup => :environment do queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"] 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 %[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 %[echo "-----> Be sure to edit 'shared/environments/staging.rb'."] + queue %[echo "-----> Be sure to edit 'shared/environments/staging.rb'."] end desc "Deploys the current version to the server." @@ -128,11 +128,14 @@ task :deploy => :environment do invoke :'deploy:link_shared_paths' invoke :'bundle:install' invoke :'rails:db_migrate' - invoke :'rails:db_seed' invoke :'rails:assets_precompile' to :launch do 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