Forum: JRuby Trinidad cannot find the config yaml file

3b8ad006781b1a3ab36dc76e2a05ce9c?d=identicon&s=25 Cris Shupp (cshupp)
on 2014-02-12 22:11
I cannot seem to get trinidad to find my config file on windows.  If I
launch via:

C:\vamu\PSTDashboard>C:\languages\Java\jdk1.7.0_51\jre\bin\java  -server
-XX:MaxPermSize=256M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx512m
-Xms256m  -jar .\lib\jars\jruby-complete-1.7.10.jar sc
ript/rails server trinidad --config trinidad2.yml
=> Booting Trinidad
=> Rails 4.0.0 application starting in development on
http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
LoadError: no such file to load -- C:/vamu/PSTDashboard/trinidad2.yml
                            require at org/jruby/RubyKernel.java:1083
                            require at
C:/vamu/PSTDashboard/gem_home/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228

If I delete trinidad2.yml from rails root the error message changes to:

C:\vamu\PSTDashboard>C:\languages\Java\jdk1.7.0_51\jre\bin\java  -server
-XX:MaxPermSize=256M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx512m
-Xms256m  -jar .\lib\jars\jruby-complete-1.7.10.jar sc
ript/rails server trinidad --config trinidad2.yml
=> Booting Trinidad
=> Rails 4.0.0 application starting in development on
http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
configuration C:/vamu/PSTDashboard/trinidad2.yml not found
Exiting

I have validated the yml file via:

jruby -e "require 'yaml'; y=YAML.load_file('./trinidad2.yml'); puts y"

and jruby gives me my hash...

We are just switching from developing with Mongrel to developing with
Trinidad so we are new to Trinidad.


Thanks,

Cris
Caa2df9372ffa0a9e95b2bab1e8fea34?d=identicon&s=25 Karol Bucek (Guest)
on 2014-02-13 07:44
(Received via mailing list)
I'm not sure how File methods would work when you start Trinidad + JRuby
that way ... instead of a simple jruby -S ...

Please report this if you feel it's buggy on Trinidad's issue tracker.
But
it's likely that the rack handler version does not (and won't) support
the
--config option.
This is confusing, but there was simply no time to remove/change this.
It's
fine as is for development to use `rails s trinidad` but for production
rather run `jruby -S trinidad` ...

Regarding development you do not need to be starting JRuby in a way you
are
with all the JVM options.
Simply install JRuby - add it to the PATH (after MRI is fine if you
prefix
everything with jruby -S than e.g. jruby -S gem install trinidad) or use
https://github.com/vertiginous/pik/.

You can omit all the JVM options than, but since you're setting
class-unloading enabled (I can assume for "hot" re-deploys) please note
that it's currently leaking but should work much better in the next
stable
release - I already got it zero down-time re-deploys pretty much release
classes correctly.

K.
B05d3cbc64b0031a24c2887fb6ddc173?d=identicon&s=25 christian (Guest)
on 2014-02-13 10:21
(Received via mailing list)
jruby -S ...
and
C:\languages\Java\jdk1.7.0_51\jre\bin\java  -server
-XX:MaxPermSize=256M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx512m
-Xms256m  -jar .\lib\jars\jruby-complete-1.7.10.jar -S ...

should basically do the same thing beside the differences in the jvm
options. jruby-complete.jar is really a handy way to "install" jruby ;)
IMO

regards,
christian
3b8ad006781b1a3ab36dc76e2a05ce9c?d=identicon&s=25 Cris Shupp (cshupp)
on 2014-02-13 18:36
Karol,

Thanks for the reply.  We are a very Java centric shop so invoking via
straight java with jruby-complete.jar avoids some annoying questions...

That being said, launching via:

C:\vamu\PSTDashboard>jruby -S trinidad --config ./config/trinidad.yml
jruby: No such file or directory -- trinidad (LoadError)

also fails.

launching via (and hoping it takes the default):

C:\vamu\PSTDashboard>jruby -S script/rails server trinidad

Does bring the app up but it ignores the yml file (port 3001 and test is
set -- it comes up on port 3000 in dev).

The behavior is unchanged if launched via java as I was doing
previously.

What exactly am I supposed to do to have the yml file be seen?


Thanks,

Cris

Here is my yml file (for whatever reason I cannot attach files).

  address: localhost # set to '*' to bind to all interfaces
  port: 3001 # port where Trinidad is running
  #environment: development # specify with `trinidad -e production`
  environment: test # specify with `trinidad -e production`
  #environment: production # specify with `trinidad -e production`
  http: # HTTP connector setup
    acceptCount: 100
    maxThreads: 200
    maxKeepAliveRequests: 100
    # @see https://github.com/trinidad/trinidad/wiki/HTTP-Connector
  #ssl: # SSL configuration
    #port: 3443
    # @see https://github.com/trinidad/trinidad/wiki/Secure-S...
  #ajp: # AJP configuration
    #port: 8009
    # @see https://github.com/trinidad/trinidad/wiki/AJP-Configuration
  #apps_base: # directory where several applications are located
  #
  # Begin: Configuration options that can be overrided per
web-application
  #
  threadsafe: true # overrides config.threadsafe! detection
  jruby_min_runtimes: 1 # min number of JRuby runtimes to use
  jruby_max_runtimes: 1 # max number of JRuby runtimes to use
  #jruby_compat_version: 1.9 # or 1.8 by default uses the same as
trinidad is running
  context_path: / # default context path
  root_dir: "." # system path where the application is located, by
default is PWD
  #rackup: config.ru # rackup script if you are running a (non-Rails)
Rack application
  public: public # system path (relative to root) where your public
files are located
  # If you do not put a web-server in front of Trinidad you might tune
asset caching :
  #public:
  #  root: public # same as the above "public: public" setting
  #  aliases: # allows to "link" other directories into the public root
e.g. :
  #    /home: /var/local/www
  #  cached: true # enable (in-memory) asset caching on for env !=
'development'
  #  cache_ttl: 5000 # cache TTL in millis (might want to increase this)
  #  cache_max_size: 10240 # the maximum cache size in kB
  #  cache_object_max_size: 512 # max size for a cached object (asset)
in kB
  java_lib: lib/java # directory where libraries packed as jars can be
found
  java_classes: lib/java/classes # directory where compiled java classes
can be found
  default_web_xml: config/trinidad-web.xml # if you are using a custom
web.xml
  reload_strategy: default # alternatively you might use "rolling"
  #
  # End: Configuration options that can be overrided per web-application
  #
  extensions: # if you are using any Trinidad extension
    #daemon: # sample daemon extension
      #pid_file: # pid file
      #jvm_args: # additional arguments for the thread that runs the
daemon
  #
#  web_apps: # if running more than one application or using web apps
extensions
#    default: # by default the name is used as the context path,
'default' means the root path '/'
#       # here you can override any already configured options or add
new ones e.g. :
#       extensions:
#          mysql_dbpool:
#            jndi: 'jdbc/BarDB'
#            url: 'localhost:3306/bar'
#            username: root
#            password: pass
#            maxActive:  100 # maximum number of connections managed by
the pool
#            initialSize: 10 # initial number of connections created in
the pool
#            maxWait:  10000 # ms the pool waits for a connection to be
returned
#    # configuring another application :
#    foo_app:
#      context_path: /foo # this will be the path rather than '/foo_app'
#      web_app_dir: /var/www/foo_app # system path where this
application is located
3b8ad006781b1a3ab36dc76e2a05ce9c?d=identicon&s=25 Cris Shupp (cshupp)
on 2014-02-13 18:46
Oh I meant to include this just in case there was any doubt...

C:\vamu\PSTDashboard>ls -la ./config | grep trinidad
-rw-r--r--  1 vhaiswshuppc Administrators  3527 Feb 12 15:59
trinidad.yml
B05d3cbc64b0031a24c2887fb6ddc173?d=identicon&s=25 christian (Guest)
on 2014-02-13 18:47
(Received via mailing list)
when looking through the output of yours, it looks like the absolute
path
is creating the trouble. doesn't it have the wrong slashes. could you
try
the
--config C:\vamu\PSTDashboardt\rinidad2.yml
!?

-christian
B05d3cbc64b0031a24c2887fb6ddc173?d=identicon&s=25 christian (Guest)
on 2014-02-13 19:07
(Received via mailing list)
Cris I was talking about the first email of yours, where the path of the
NOT found trinidad2.yml has clearly the wrong slashes thus can not find
it.
when you supply the full path with right slashes that might work !!! the
idea is related to
https://github.com/jruby/jruby/issues/1489#issueco...

-christian
3b8ad006781b1a3ab36dc76e2a05ce9c?d=identicon&s=25 Cris Shupp (cshupp)
on 2014-02-13 20:07
Karol,

OK I decided to fight a little harder with jruby -S trinidad.

initially it did not work which is why I used the server/trinidad
approach...

We can see that this fails...
C:\vamu\PSTDashboard>jruby -S trinidad
jruby: No such file or directory -- trinidad (LoadError)

But I did get it to work via (adding in the -S here also works) :

C:\vamu\PSTDashboard>jruby gem_home\bin\trinidad
Deploying from C:/vamu/PSTDashboard as /
Initializing ProtocolHandler ["http-bio-127.0.0.1-3001"]

Note it "sees" trinidad.yml which mandates port 3001.

I can also get the same thing with pure java via:

C:\vamu\PSTDashboard>C:\languages\Java\jdk1.7.0_51\jre\bin\java -server
-jar .\lib\jars\jruby-complete-1.7.10.jar gem_home/bin/trinidad
Deploying from C:/vamu/PSTDashboard as /
Initializing ProtocolHandler ["http-bio-127.0.0.1-3001"]

BTW the immortality of Trinidad still occurs even launching this way
:-(.

I will continue to play and then e-mail you.


Thanks,

Cris
3b8ad006781b1a3ab36dc76e2a05ce9c?d=identicon&s=25 Cris Shupp (cshupp)
on 2014-02-13 20:11
Thanks for the reply Christian.

Yes I tried it windows style and unix style on my windows box.  Neither
approach works.  Based on my previous approach I really think Trinidad
simply cannot load the configuration yml file when launched via:

script/rails server trinidad

When I eliminated the --config and had my yml file in the config
directory as 'trinidad.yml' it still cannot find it!


Thanks,

//Cris


christian wrote in post #1136575:
> when looking through the output of yours, it looks like the absolute
> path
> is creating the trouble. doesn't it have the wrong slashes. could you
> try
> the
> --config C:\vamu\PSTDashboardt\rinidad2.yml
> !?
>
> -christian
Caa2df9372ffa0a9e95b2bab1e8fea34?d=identicon&s=25 Karol Bucek (Guest)
on 2014-02-13 20:17
(Received via mailing list)
Unfortunately I did not have that much experience with JRuby on Windows
...
I'll boot it up tomorrow and see.
But for sure `jruby -S trinidad` was not an issue for me ... that
LoadError
is weird - likely a GEM_HOME/GEM_PATH issue (not sure).

Also Ctrl+C was fine last time I checked - actually I'm working every
now
and then with folks doing Trinidad on Windows and they seem to Ctrl+C
just
fine.

As I mentioned previously ... script/rails server trinidad "rackup" mode
is
really not doing any configuration thus no trinidad.yml loading ...

K.
3b8ad006781b1a3ab36dc76e2a05ce9c?d=identicon&s=25 Cris Shupp (cshupp)
on 2014-02-13 21:37
Oh and Christian...

Here it is with a full path.  Still no go :-(

C:\vamu\PSTDashboard>jruby script/rails server trinidad --config
c:\vamu\PSTDashboard\config\trinidad.yml
=> Booting Trinidad
=> Rails 4.0.0 application starting in development on
http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
LoadError: no such file to load --
c:/vamu/PSTDashboard/config/trinidad.yml
                            require at org/jruby/RubyKernel.java:1083

C:\vamu\PSTDashboard>jruby script/rails server trinidad --config
c:/vamu/PSTDashboard/config/trinidad.yml
=> Booting Trinidad
=> Rails 4.0.0 application starting in development on
http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
LoadError: no such file to load --
c:/vamu/PSTDashboard/config/trinidad.yml
                            require at org/jruby/RubyKernel.java:1083
                            require at
C:/vamu/PSTDashboard/gem_home/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228
                    load_dependency at C:/vamu/PSTDashboard/gem_home
B05d3cbc64b0031a24c2887fb6ddc173?d=identicon&s=25 christian (Guest)
on 2014-02-14 10:57
(Received via mailing list)
thanx for trying that out ;) I am sure with coming jruby-1.7.11 that
could
be solved.
Caa2df9372ffa0a9e95b2bab1e8fea34?d=identicon&s=25 Karol Bucek (Guest)
on 2014-02-18 21:04
(Received via mailing list)
I can confirm that the Ctrl+C issue is not Windows specific and it's
definitely caused by the scheduler extension ...

I'm working on an update ... as I'm trying to get reloads to not leak
memory - hopefully I'll manage the beast, any testing against the repo
than
would be appreciated.

you can track when this is fixed by watching
https://github.com/trinidad/trinidad_scheduler_ext...

K.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.