-
Notifications
You must be signed in to change notification settings - Fork 0
Rails_2_3_2
» JRuby Project Wiki Home Page » JRuby on Rails: War File Deployment
Hello all,
Since the Rails 2.3.2 update, some problems can come up with Ruby using Tomcat or Glassfish when deploying a production Rails application. These problems are in the area of session management.
Since Rails 2.3.2, database sessions must be activated with JRuby. In the file initializers/session_store.rb, you have to uncomment the line ActionController::Base.session_store = :active_record_store.
Then execute the following Rake commands:
rake db:sessions:create rake db:migrate
This is necessary to deploy the tables that manage sessions. After having performed a « warble config », you need to add this line:
config.webxml.jruby.session_store = 'db'
That will tell the Java container that you want to use database sessions. This line will modify only the file WEB-INF/web.xml.
Finally , you need to use a little hack. In the file environment.rb, just above the line Rails::Initializer.run do |config|, add the following code:
if defined?(JRUBY_VERSION)
# hack to fix jruby-rack's incompatibility with rails edge
module ActionController
module Session
class JavaServletStore
def initialize(app, options={}); end
def call(env); end
end
end
end
end
That's all !
Bonjour à tous,
Depuis la mise à jour de rails en 2.3.2, lors du déploiement d’une application rails en production avec JRUBY sur Tomcat ou Glassish, certains problèmes se présentent. Pour faire court, c’est la gestion des sessions qui pose problème. Je vous fais profiter de mon retour car j’ai un peu galérer pour trouver de la doc dessus.
Donc, depuis la version 2.3.2 de rails pour une mise en production avec JRUBY, il faut activer les sessions en base de données.
Dans le fichier initializers/session_store.rb, il faut décommenter la ligne
ActionController::Base.session_store = :active_record_store
Puis, comme sugéré, exécuter les commandes rake suivantes :
rake db:sessions:create rake db:migrate
Ceci, afin de déployer les tables nécessaires à la gestion des sessions.
Après avoir fait un « warble config », il est nécessaire d’ajouter la ligne :
config.webxml.jruby.session_store = 'db'
Ceci dans le but, d’informer le container java que l’on désire utiliser les sessions en base. Cette ligne aura simplement pour effet de modifier le fichier WEB-INF/web.xml.
Puis utiliser un petit hack. Dans le fichier environment.rb, au dessus de la ligne Rails::Initializer.run do |config|, mettre :
if defined?(JRUBY_VERSION)
# hack to fix jruby-rack's incompatibility with rails edge
module ActionController
module Session
class JavaServletStore
def initialize(app, options={}); end
def call(env); end
end
end
end
end
Voilà !