Updated.
This commit is contained in:
parent
6e0cf64481
commit
2e42751aa8
|
@ -46,10 +46,10 @@ namespace :create_site do
|
||||||
if args.only_copy_installed_module == true || args.only_copy_installed_module == "true"
|
if args.only_copy_installed_module == true || args.only_copy_installed_module == "true"
|
||||||
extra_exclude_path = ",public/uploads/"
|
extra_exclude_path = ",public/uploads/"
|
||||||
end
|
end
|
||||||
|
server = SiteServer.where(:server_name => template_site.server_type).first
|
||||||
if @site_construct.server_type == template_site.server_type
|
if @site_construct.server_type == template_site.server_type
|
||||||
exec_ssh_command_for_create(ssh,"rsync -arv --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true)
|
exec_ssh_command_for_create(ssh,"rsync -arv --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true)
|
||||||
else
|
else
|
||||||
server = SiteServer.where(:server_name => template_site.server_type).first
|
|
||||||
exec_ssh_command_for_create(ssh,"sudo -p 'sudo password:' apt-get install -y sshpass")
|
exec_ssh_command_for_create(ssh,"sudo -p 'sudo password:' apt-get install -y sshpass")
|
||||||
outputs = exec_ssh_command_for_create(ssh,"sshpass -p \"#{server.password}\" rsync -arv --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{server.account}@#{server.ip}:#{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true)
|
outputs = exec_ssh_command_for_create(ssh,"sshpass -p \"#{server.password}\" rsync -arv --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{server.account}@#{server.ip}:#{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true)
|
||||||
if outputs.join("\n").include?("Host key verification failed")
|
if outputs.join("\n").include?("Host key verification failed")
|
||||||
|
|
|
@ -96,7 +96,15 @@ namespace :exec_commands do
|
||||||
else
|
else
|
||||||
sites = [@site_construct]
|
sites = [@site_construct]
|
||||||
end
|
end
|
||||||
commands = args.commands.split("////").select{|c| c != ""} rescue [args.commands]
|
if args.commands.include?("{{create_users}}")
|
||||||
|
commands = ['sudo -p "sudo password:" chmod 700 {{full_site_path}} -R',
|
||||||
|
'sudo -p "sudo password:" chmod 755 {{full_site_path}}/public -R'
|
||||||
|
'sudo -p "sudo password:" chmod 755 {{full_site_path}}/app/templates -R'
|
||||||
|
'sudo -p "sudo password:" useradd --home-dir {{full_site_path}}/app/templates {{site_name}} --no-create-home --badnames'
|
||||||
|
'sudo -p "sudo password:" bash -l -c \'echo -e "{{site_name}}\n{{site_name}}"|passwd {{site_name}}\'']
|
||||||
|
else
|
||||||
|
commands = args.commands.split("////").select{|c| c != ""} rescue [args.commands]
|
||||||
|
end
|
||||||
sites.each do |site_construct|
|
sites.each do |site_construct|
|
||||||
@site_construct = site_construct
|
@site_construct = site_construct
|
||||||
@site_construct.update!(:infos=>[])
|
@site_construct.update!(:infos=>[])
|
||||||
|
|
Loading…
Reference in New Issue