rvm use system
And then it will work right. Once you’re done with the torquebox work, you can go back to using rvm.
rsh does not like nohup — rather than returning, as one would expect, it just hangs.
This has to do with stdin, stdout and stderr.
The short of it is….
By preference use ssh.
If you must use rsh, make sure that stdin, stdout, and stderr are all redirected properly.
Torquebox and Cygwin don’t work as nicely together as one might hope.
That said, here are a couple of findings:
export JBOSS_PATH=`cygpath -w PATH_TO_JBOSS`.
org.jruby.exceptions.RaiseException: no such file to load — date
That’s it so far, more to follow as discovered….
For political reasons, I needed to ship a single jar file. I didn’t want to have the overhead of a war & an appserver, so I set out to embed my rails app within a single jar file. I needed to make some changes in order to get it to work.
This assumes Rails 2.3.5 and JRuby 1.4.0.
First, you need to create your rails app. Freeze rails and any gems required.
Next download jruby-complete. Once you’ve done so, unzip it. I’m assuming you’ve unzipped it to complete.
Note: When you repackage the jar file, DO NOT use jar. Use zip. This is very important. If you don’t, you’ll trash your jruby instance.
Copy your rails instance to
complete/META-INF/jruby.home. I assume it will be
complete/META-INF/jruby.home/bin/server with the following content:
#!/usr/bin/env ruby RAILS_ROOT = File.join(File.dirname(File.dirname(__FILE__)),'rails') require File.join(RAILS_ROOT,'config/boot') require 'commands/server'
RAILS_ROOT needs to be set in order to have the proper paths within the jar file.
complete/META-INF/jruby.home/rails/vendor/rails/railties/lib/initializer.rb In the
set_root_path method, edit it so it looks like this:
def set_root_path! raise 'RAILS_ROOT is not set' unless defined?(::RAILS_ROOT) raise 'RAILS_ROOT is not a directory' unless File.directory?(::RAILS_ROOT) # I changed this... mkw21 20100301 @root_path = RAILS_ROOT # Pathname is incompatible with Windows, but Windows doesn't have # real symlinks so File.expand_path is safe. # if RUBY_PLATFORM =~ /(:?mswin|mingw)/ # File.expand_path(::RAILS_ROOT)# # Otherwise use Pathname#realpath which respects symlinks. # else # Pathname.new(::RAILS_ROOT).realpath.to_s # end Object.const_set(:RELATIVE_RAILS_ROOT, ::RAILS_ROOT.dup) unless defined?(::RELATIVE_RAILS_ROOT) ::RAILS_ROOT.replace @root_path end
This is related to paths within the jar file.
Additionally, you need to change the
initialize_logger method. (this might not be needed, see below). Change
logger = ActiveSupport::BufferedLogger.new(configuration.log_path)
logger = ActiveSupport::BufferedLogger.new("/tmp/transfer.log")
The idea is to change it to something definitely outside the jar. The reason I did this, and didn’t change the config in
environment.rb was that the changes in environment.rb were not getting picked up. I’ve since come to the belief that this is due to an issue with the Rack
LogTailer detailed at https://rails.lighthouseapp.com/projects/8994/tickets/2350-logtailer-ignores-configlog_path. So
complete/META-INF/jruby.home/rails/vendor/rails/railties/lib/rails/rack/log_tailer.rb needs to be edited. Edit the
EnvironmentLog assignment to match the file we’d specified. (You may be able to substitute
RAILS_DEFAULT_LOGGER but I have not tested that)
EnvironmentLog = "/tmp/transfer.log"
That’s pretty much it. Zip up your exploded jar from the
zip -r ../complete.zip *. Then you can run it via
java -jar complete.jar -S server.
We ran into a case where JBoss was unable to come up; it gave the following (partial) exception:
java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Cannot assign requested address
After poking around with netstat and lsof, we couldn’t find anything that was binding to the port. I’d made the assumption that it was bound, totally missing the next line. As it turns out, we were attempting to bind to a vip which, although it existed in DNS, was not defined on the host on which the error occurred. The “cannot assign requested address” was the clue.
The nice thing about standards is that there are so many of them to choose from. Andrew S. Tanenbaum
I’ve been working with a Apache proxy to force SSL and https. Well, I haven’t had any control over the certificates. And they can come in so many versions, especially given that Microsoft wants to do things its own way and the Apache web server instance is sitting on a windows virtual instance.
I’ve gotten the private key in two different formats, .pfx and .pvk.
.pfx can be converted to the pem file format which Apache is expecting via the following:
openssl pkcs12 -nodes -in infile.pfx -out out.pem
You then need to edit it, stripping out everything but the private key. Once that’s accomplished you’re good to go.
.pvk, however, isn’t supported in openssl until version 1.0. Joy!
First off, let me say that I really like DIY Map. It’s quick, and responsive, with an easy to use interface, as well as allowing you to make changes on the fly easily.
First of all, the only way I’ve been able to get paths to resources to work is via relative paths. More on why I think that is the case in a moment. I was finding that resources were not being found until I used relative paths. Once I did so, that part worked just fine.
Second, in order to be able to update the map, it needs to be fed an XML data file, which is fine. Wherein lies the trouble is when you are attempting to feed a dynamic file (like a cgi script or php) — I’ve not been able to get it to work, despite having the right data in the output and the proper content type — the data works just fine when loaded from a file, however… So, my workaround is to write to a temporary file and use that file to make the changes.
4+ hours spent on this. Meh. It’d be a bit more amusing if I’d gotten more sleep. I napped for about an hour around midnight, and another nap at 7:30am until I had to get up for work @ 9.
Been a while since I’ve written. I’ve been sick and working on a side project. That said, I’ll be writing more……
Today’s note/reminder is a gotcha about YUI datasources. If you have JSON feeding the datasource and you’re getting back more fields in the results than you’re expecting, the datasource will not behave properly. For example, if you’ve declared that you’re getting back
But in reality you get
it will just sit there. Very frustrating. Very fun trying to debug, too!