This commit is contained in:
BoHung Chiu 2021-12-17 09:36:01 +08:00
parent 2f1888f568
commit bcc584ca17
1 changed files with 4 additions and 2 deletions

View File

@ -46,14 +46,14 @@ namespace :exec_commands do
elsif args.type == 'open_site' elsif args.type == 'open_site'
default_rails_env = 'development' default_rails_env = 'development'
enable_rails_env = ['development','production'] enable_rails_env = ['development','production']
rails_env = default_rails_env rails_env = @site_construct.rails_env.blank? ? default_rails_env : @site_construct.rails_env
cmd_output = exec_ssh_command_by_sudo_and_see_output(ssh,"ps -o args= -p `cat #{@site_construct.path}/#{@site_construct.site_name}/tmp/pids/unicorn.pid`",false) rescue [] cmd_output = exec_ssh_command_by_sudo_and_see_output(ssh,"ps -o args= -p `cat #{@site_construct.path}/#{@site_construct.site_name}/tmp/pids/unicorn.pid`",false) rescue []
enable_rails_env.each do |env| enable_rails_env.each do |env|
if( cmd_output[0].include?(env) rescue false) if( cmd_output[0].include?(env) rescue false)
rails_env = env rails_env = env
break break
elsif( cmd_output[0].include?("No such file or directory") rescue false) elsif( cmd_output[0].include?("No such file or directory") rescue false)
site_construct.update(:status => "closed") @site_construct.update(:status => "closed")
break break
end end
end end
@ -72,6 +72,8 @@ namespace :exec_commands do
update_infos_for_exec("This site include an private git project.") update_infos_for_exec("This site include an private git project.")
@site_construct.update(:status =>"error") @site_construct.update(:status =>"error")
break break
else
exec_ssh_command_by_sudo_and_see_output(ssh,"bundle exec unicorn_rails -c config/unicorn.rb -D -E #{rails_env}",false)
end end
end end
update_infos_for_exec("finish starting #{@site_construct.site_name}") update_infos_for_exec("finish starting #{@site_construct.site_name}")