This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 150002 - Rails Environment setting not sent to GlassFish plugin
Summary: Rails Environment setting not sent to GlassFish plugin
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Rails (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-14 01:06 UTC by Chris Kutler
Modified: 2011-01-28 20:12 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Kutler 2008-10-14 01:06:32 UTC
I made this a P2 instead of a P3 because I don't know of any work arounds.

If I change the Rails Environment setting from development (the default) to test or production, stop the WEBrick server,
and run the application, the server runs in the mode that I set it to. 

When running with the GF V3 server, it always runs in development mode. I have stopped the server but that doesn't make
a difference. How do I get GF V3 to honor my Rails Environment settings?
Comment 1 _ pcw 2008-10-16 02:12:51 UTC
The project setting for (development, test, production) is not passed to GlassFish on launching.

There are two workarounds:

1) Set RAILS_ENV to what you want before launching NetBeans (this means that to change it, you have to restart NetBeans
and restart the server - not very nice)
2) Set the desired value in config/environment.rb and either restart the server or undeploy/rerun the application to for
reinitialization of the Rails instance.

Since GlassFish V3 in server from (ie not the gem) runs multiple Rails applications in the same JVM.  If it is desired
that these applications have their own distint "RAILS_ENV" value (and I assume it is), then option #1 is out, as it is
global for the server.

I talked with Vivek P. about possibly having a deployment property define this on a per application basis.  Hopefully we
can get something like that for GlassFish V3 Final.

I looked into fixing this, where "fix" means set RAILS_ENV for the server process (if not yet set) to the value for the
current Rails project and while this is feasible, it's rather convoluted  and involves changing friend api between
ruby.railsproject and glassfish.jruby.  Not something I want to do this close to release of 6.5.  We'll fix this for 7.0.

So again, my recommended workaround is "Set the RAILS_ENV mode you want in config/environment.rb and be sure to either
restart the server or manually undeploy and rerun the application to get it to take effect."

We'll handle this better for 7.0.
Comment 2 Chris Kutler 2008-10-17 00:00:34 UTC
This is too late to fix the 6.5 online help. I will make a note in the setting-up.html and add a FAQ. By the way, I will
write that you should restart the server. Undeploying an app from the Services window on Mac or Windows is a good way to
hose the app on GlassFish so that you can't get it to run again. I still haven't figured out how to get the server to
run an app once you have undeployed it from the Services window, other than by reinstalling the server. I am sure there
is a way, but I don't know what it is. Let me know and I will write a FAQ for that too.
Comment 3 Erno Mononen 2009-03-16 13:56:19 UTC
Changing the component to serverplugins/glassfish_v3.
Comment 4 _ pcw 2009-03-16 20:58:22 UTC
Not a P2 (see workaround in second comment and P2 justification in original description).

Downgrading to P3.
Comment 5 Vince Kraemer 2009-09-16 23:55:30 UTC
Assigned engineer: please correct the tm value.  nb 6.7 has shipped, so a tm of
6.7  is invalid at this point
Comment 6 Vince Kraemer 2009-09-16 23:58:43 UTC
pickup half of pcw's issues
Comment 7 Vince Kraemer 2009-09-17 20:16:38 UTC
reset the tm to be realistic... I have no idea when this will get fixed.
Comment 8 Vince Kraemer 2009-09-28 21:52:36 UTC
emononen: is there an api that will communicate the project's environment info when the user hits Run to the plugin?
Comment 9 Vince Kraemer 2009-09-30 00:07:00 UTC
according to Vivek:

there is a deployment property that can be set to indicate what env user wants. So lets say, a user wants to deploy
their application using 'production' environment using asadmin CLI as follows:

asadmin deploy --property jruby.rackEnv=production railsApplicationDir/
Comment 10 Erno Mononen 2009-10-01 08:53:42 UTC
Wrt. the API: there is no such API at the moment. Rails environment is a project property, but I don't think the plugin 
knows what project it is running. We should change the server spi in ruby.railsproject so that the env gets passed to 
the plugin.
Comment 11 Vince Kraemer 2009-10-12 18:08:33 UTC
OK. so I will assign this issue to railsproject for the API change...  Once the API is available, you can assign the
issue back to the plugin.
Comment 12 Erno Mononen 2010-04-27 12:02:08 UTC
Lowering the priority as per the current GF team priorities.