sprinkle-tool / sprinkle

Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails, or Sinatra stack on a brand new slice directly after its been created
https://github.com/sprinkle-tool/sprinkle
MIT License
1.15k stars 138 forks source link

Installing Ruby hangs #58

Closed mrrooijen closed 11 years ago

mrrooijen commented 12 years ago
→ sprinkle -c -s provision.rb 
--> Cloud hierarchy for policy application

Policy application requires package rails
    Package rails requires rubygems
        Package rubygems requires ruby
            Package ruby requires ruby_dependencies
                Package ruby_dependencies requires core
    Package rails requires rubygems
        Package rubygems requires ruby
            Package ruby requires ruby_dependencies
                Package ruby_dependencies requires core

--> Normalized installation order for all packages: core, ruby_dependencies, ruby, rubygems, rails
--> Installing core for roles: application
*** [err :: xxx.xx.xx.xxx] Extracting templates from packages: 76%
*** [err :: xxx.xx.xx.xxx] Extracting templates from packages: 100%
--> Installing ruby_dependencies for roles: application
--> Checking if ruby is already installed for roles: application
    --> Verifying ruby...
--> Installing ruby for roles: application

It hangs forever at --> Installing ruby for roles: application - when I manually SSH in to the server and perform the operations manually it all works fine.

This is the package that's being run:

package :ruby, :provides => :language do
  requires :ruby_dependencies
  version "1.9.3"
  patchlevel "0"
  source "ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}-p#{patchlevel}.tar.gz"

  verify do
    has_executable_with_version "ruby", version
    has_executable "gem"
  end
end

Anyone have any idea why this never finishes?

Thanks!

mrrooijen commented 12 years ago

The above was run from my local machine and the target machine was a Linode 512. I also tried this on Rackspace Cloud Servers, same result.

However, I just now used Vagrant (a Linux install on my local machine) and now it simply finished without any issues. So it isn't the above package script I guess. But why would this package fail for me on Linode or Rackspace Cloud Servers? Does it hang? Is it a time out?

Any info much appreciated!

mrrooijen commented 12 years ago

Here is a backtrace when I eventually CTRL+C to kill the process after it hangs for an hour.


/Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/processable.rb:25:in `select': Interrupt
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/processable.rb:25:in `process_iteration'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/command.rb:165:in `block (2 levels) in process!'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/command.rb:164:in `loop'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/command.rb:164:in `block in process!'
    from /Users/Michael/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/command.rb:163:in `process!'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/command.rb:134:in `process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/actions/invocation.rb:178:in `block in run_tree'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/connections.rb:198:in `block in execute_on_servers'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/connections.rb:186:in `each'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/connections.rb:186:in `each_slice'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/connections.rb:186:in `execute_on_servers'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/actions/invocation.rb:176:in `run_tree'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/actions/invocation.rb:148:in `run'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/actions/invocation.rb:214:in `sudo'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/actions/invocation.rb:89:in `invoke_command'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:64:in `block (2 levels) in process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:63:in `each'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:63:in `block in process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly_with_callbacks'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.9.0/lib/capistrano/configuration/namespaces.rb:104:in `block in task'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:103:in `run'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:69:in `process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/installers/installer.rb:75:in `process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/package.rb:248:in `block in process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/package.rb:246:in `each'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/package.rb:246:in `process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:92:in `block in process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:121:in `each'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:121:in `normalize'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:91:in `process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/deployment.rb:68:in `block in process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/deployment.rb:67:in `each'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/deployment.rb:67:in `process'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/script.rb:20:in `sprinkle'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/lib/sprinkle/script.rb:16:in `sprinkle'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/gems/sprinkle-0.4.2/bin/sprinkle:95:in `<top (required)>'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/bin/sprinkle:19:in `load'
    from /Users/Michael/.rvm/gems/ruby-1.9.3-p0/bin/sprinkle:19:in `<main>'
mrrooijen commented 12 years ago

It seems to hang after it finishes the "Ruby Build" stage. I only see three logs in the /usr/local/build/ruby-1.9.3-p0 folder:

-rw-r--r-- 1 root root config.log
-rw-r--r-- 1 root root ruby-build.log
-rw-r--r-- 1 root root ruby-configure.log

It never starts the Ruby Install process as the log doesn't exist. When I re-run the whole sprinkle command it re-configures everything and then it for some reason does continue from where it hung the first time, so now I see the following logs were written:

-rw-r--r-- 1 root root config.log
-rw-r--r-- 1 root root ruby-build.log
-rw-r--r-- 1 root root ruby-configure.log
-rw-r--r-- 1 root root ruby-install.log
-rw-r--r-- 1 root root ruby-post.log

It works but it's not ideal having to restart the whole process again. I think it recreated the logs when I re-ran the process so I'm not sure what the last lines of the ruby-build.log was. I recall seeing an exit(0) - could that be the reason why it hangs? I I didn't see it in the second run-through.

I might want to consider seeing if I can do an alternative install using RVM or RBEnv instead of installing directly from the official source.

mrrooijen commented 12 years ago

I re-ran it from scratch again and I don't see the exit(0) this time either. Might be seeing things. But it still stops right after it finishes the build process.

These are the last lines in the ruby-build.log

linking ruby
make[2]: Leaving directory `/usr/local/build/ruby-1.9.3-p0'
make[1]: Leaving directory `/usr/local/build/ruby-1.9.3-p0'
Generating RDoc documentation
lib/mkmf.rb:1117:29: Couldn't find STRING_OR_FAILED_FORMAT. Assuming it's a module
lib/irb/inspector.rb:36:36: Couldn't find INSPECTORS. Assuming it's a module
Enclosing class/module 'mDigest' for class MD5 not known
Enclosing class/module 'mDigest' for class RMD160 not known
Enclosing class/module 'mDigest' for class SHA1 not known
Enclosing class/module "cASN1ObjectId" for alias short_name sn not known
Enclosing class/module "cASN1ObjectId" for alias long_name ln not known

Generating RI format into /usr/local/build/ruby-1.9.3-p0/.ext/rdoc...

Files:        767

Classes:     1351 ( 696 undocumented)
Modules:      301 ( 148 undocumented)
Constants:   2245 ( 826 undocumented)
Attributes:  1001 ( 431 undocumented)
Methods:    10265 (3068 undocumented)

Total:      15163 (5169 undocumented)
 65.91% documented

Elapsed: 148.7s

After that, nothing happens unless I re-run the script and it goes through the whole process again, then that time it'll just finish for some reason. Any ideas?

This is the entire script that's running during this process:

mkdir -p /usr/local
mkdir -p /usr/local/build
mkdir -p /usr/local/sources
wget -cq -O '/usr/local/sources/ruby-1.9.3-p0.tar.gz' ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
bash -c 'cd /usr/local/build && tar xzf /usr/local/sources/ruby-1.9.3-p0.tar.gz'
bash -c 'cd /usr/local/build/ruby-1.9.3-p0 && ./configure --prefix=/usr/local  > ruby-configure.log 2>&1'
bash -c 'cd /usr/local/build/ruby-1.9.3-p0 && make > ruby-build.log 2>&1'
bash -c 'cd /usr/local/build/ruby-1.9.3-p0 && make install > ruby-install.log 2>&1'
bash -c 'cd /usr/local/build/ruby-1.9.3-p0 && gem -v >> ruby-post.log 2>&1'
bash -c 'cd /usr/local/build/ruby-1.9.3-p0 && gem update --system > /dev/null 2>&1 >> ruby-post.log 2>&1'

It would seem that this is the last line that runs (and finishes):

bash -c 'cd /usr/local/build/ruby-1.9.3-p0 && make > ruby-build.log 2>&1'

And it never gets here:

bash -c 'cd /usr/local/build/ruby-1.9.3-p0 && make install > ruby-install.log 2>&1'
mrrooijen commented 12 years ago

I now tried to install Ruby 1.8.7 and Ruby 1.9.2p290 and both successfully installed from source without any issues. So it seems this issue is specific to Ruby 1.9.3p0 -- I still have no idea why the issue occurs though. Just wanted to point that out for anyone else attempting to install Ruby 1.9.3p0 and see it fail.

cvincent commented 12 years ago

+1, having the same exact issue. Currently re-running the script to see if it works the second time around as you've observed.

Hoping Sprinkle is still a living project! It really hits the sweet spot for my needs.

seigel commented 12 years ago

+1 I get the hang on 1.9.2 as well.

seigel commented 12 years ago

Socket timing out in capistrano?

seigel commented 12 years ago

No updates?

joshgoebel commented 11 years ago

No idea. Anyone figure this out?

joshgoebel commented 11 years ago

Can anyone confirm that this is still an issue? If I don't hear back I'm going to close this.

joshgoebel commented 11 years ago

Closing based on lack of feedback.