Code cleanup. Redo deploy to unicorn. Refs #2261
This commit is contained in:
parent
37e7f757d9
commit
2bee3bd25d
|
@ -55,7 +55,6 @@ GEM
|
||||||
chronic (0.6.6)
|
chronic (0.6.6)
|
||||||
cocaine (0.2.0)
|
cocaine (0.2.0)
|
||||||
columnize (0.3.5)
|
columnize (0.3.5)
|
||||||
daemon_controller (0.2.6)
|
|
||||||
daemons (1.1.4)
|
daemons (1.1.4)
|
||||||
delayed_job (2.1.4)
|
delayed_job (2.1.4)
|
||||||
activesupport (~> 3.0)
|
activesupport (~> 3.0)
|
||||||
|
@ -72,7 +71,6 @@ GEM
|
||||||
factory_girl_rails (1.4.0)
|
factory_girl_rails (1.4.0)
|
||||||
factory_girl (~> 2.3.0)
|
factory_girl (~> 2.3.0)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
fastthread (1.0.7)
|
|
||||||
grit (2.4.1)
|
grit (2.4.1)
|
||||||
diff-lcs (~> 1.1)
|
diff-lcs (~> 1.1)
|
||||||
mime-types (~> 1.15)
|
mime-types (~> 1.15)
|
||||||
|
@ -121,11 +119,6 @@ GEM
|
||||||
activesupport (>= 2.3.2)
|
activesupport (>= 2.3.2)
|
||||||
cocaine (>= 0.0.2)
|
cocaine (>= 0.0.2)
|
||||||
mime-types
|
mime-types
|
||||||
passenger (3.0.11)
|
|
||||||
daemon_controller (>= 0.2.5)
|
|
||||||
fastthread (>= 1.0.1)
|
|
||||||
rack
|
|
||||||
rake (>= 0.8.1)
|
|
||||||
pg (0.11.0)
|
pg (0.11.0)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
rack (1.2.4)
|
rack (1.2.4)
|
||||||
|
@ -228,7 +221,6 @@ DEPENDENCIES
|
||||||
omniauth (~> 1.0.1)
|
omniauth (~> 1.0.1)
|
||||||
omniauth-openid (~> 1.0.1)
|
omniauth-openid (~> 1.0.1)
|
||||||
paperclip (~> 2.3)
|
paperclip (~> 2.3)
|
||||||
passenger (~> 3.0.11)
|
|
||||||
pg (~> 0.11.0)
|
pg (~> 0.11.0)
|
||||||
rails (= 3.0.11)
|
rails (= 3.0.11)
|
||||||
rails-xmlrpc (~> 0.3.6)
|
rails-xmlrpc (~> 0.3.6)
|
||||||
|
|
|
@ -16,22 +16,6 @@ class Product < ActiveRecord::Base
|
||||||
|
|
||||||
scope :recent, order("name ASC")
|
scope :recent, order("name ASC")
|
||||||
|
|
||||||
# attr_accessor :tmp_upload_dir
|
|
||||||
# after_save lambda { FileUtils.rm_rf(tmp_upload_dir) if tmp_upload_dir and File.directory?(tmp_upload_dir) }
|
|
||||||
#
|
|
||||||
# def tar_with_fast=(file)
|
|
||||||
# if file.present? and file.respond_to?('[]')
|
|
||||||
# self.tmp_upload_dir = "#{file['filepath']}_1"
|
|
||||||
# tmp_file_path = File.join tmp_upload_dir, file['original_name']
|
|
||||||
# FileUtils.mkdir_p tmp_upload_dir
|
|
||||||
# FileUtils.mv file['filepath'], tmp_file_path
|
|
||||||
# self.tar_without_fast = File.open tmp_file_path, 'rb'
|
|
||||||
# else
|
|
||||||
# self.tar_without_fast = file
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# alias_method_chain :tar=, :fast
|
|
||||||
|
|
||||||
def delete_tar
|
def delete_tar
|
||||||
@delete_tar ||= "0"
|
@delete_tar ||= "0"
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,6 +24,7 @@ set :repository, "git@github.com:warpc/rosa-build.git"
|
||||||
set :scm, "git"
|
set :scm, "git"
|
||||||
|
|
||||||
set :user, "rosa"
|
set :user, "rosa"
|
||||||
|
# set :sudo, "rvmsudo"
|
||||||
set :use_sudo, false
|
set :use_sudo, false
|
||||||
set :deploy_to, "/srv/#{application}"
|
set :deploy_to, "/srv/#{application}"
|
||||||
# set :deploy_via, :copy
|
# set :deploy_via, :copy
|
||||||
|
@ -31,6 +32,11 @@ set :deploy_to, "/srv/#{application}"
|
||||||
|
|
||||||
set :keep_releases, 3
|
set :keep_releases, 3
|
||||||
|
|
||||||
|
set :rails_env, :production
|
||||||
|
set :unicorn_binary, "bundle exec unicorn"
|
||||||
|
set :unicorn_config, "#{current_path}/config/unicorn.rb"
|
||||||
|
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
|
||||||
|
|
||||||
task :symlink_config_files do
|
task :symlink_config_files do
|
||||||
run "mkdir -p #{deploy_to}/#{shared_dir}/config"
|
run "mkdir -p #{deploy_to}/#{shared_dir}/config"
|
||||||
|
|
||||||
|
@ -53,12 +59,26 @@ task :symlink_tmp_dir do
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :deploy do
|
namespace :deploy do
|
||||||
|
task :start, :roles => :app, :except => { :no_release => true } do
|
||||||
|
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
|
||||||
|
end
|
||||||
|
task :stop, :roles => :app, :except => { :no_release => true } do
|
||||||
|
run "#{try_sudo} kill `cat #{unicorn_pid}`"
|
||||||
|
end
|
||||||
|
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
|
||||||
|
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
|
||||||
|
end
|
||||||
|
task :reload, :roles => :app, :except => { :no_release => true } do
|
||||||
|
run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
|
||||||
|
end
|
||||||
task :restart, :roles => :app, :except => { :no_release => true } do
|
task :restart, :roles => :app, :except => { :no_release => true } do
|
||||||
run "touch #{current_release}/tmp/restart.txt"
|
stop
|
||||||
|
start
|
||||||
|
# run "touch #{current_release}/tmp/restart.txt"
|
||||||
restart_dj
|
restart_dj
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(start).each { |name| task name, :roles => :app do deploy.restart end }
|
# %w(start).each { |name| task name, :roles => :app do deploy.restart end }
|
||||||
|
|
||||||
desc "Restart delayed job"
|
desc "Restart delayed job"
|
||||||
task :restart_dj, :roles => :web do
|
task :restart_dj, :roles => :web do
|
||||||
|
|
Loading…
Reference in New Issue