How to use rake from tomcat environment?

I’d like to have the same model so if there are also batch procedures,
how do you manage it?

On Fri, Oct 9, 2009 at 4:17 AM, Marco M.
[email protected] wrote:

I’d like to have the same model so if there are also batch procedures,
how do you manage it?

Is this basically a question about how you can run migrations from
within an app server (like on deploy)?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Fri, Oct 9, 2009 at 1:58 PM, Charles Oliver N.
[email protected] wrote:

On Fri, Oct 9, 2009 at 4:17 AM, Marco M. [email protected] wrote:

I’d like to have the same model so if there are also batch procedures,
how do you manage it?

Is this basically a question about how you can run migrations from
within an app server (like on deploy)?

We have the same question on migrations- specifically for an app which
will be installable by users on their own environment. Our ideas are:

  1. For each release with migrations, distribute a separate executable
    jar file which contains the migrations to be run

  2. Add an admin interface that allows migrations to be run. This
    would probably have to be something (rack?) that detects if migrations
    are out-of-date, and redirects to an admin interface which allows
    migrations to be run (a separate ‘embedded’ rails app?)

Any ideas/experience along these lines would be great…

– Chad


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

cd tomcat5/webapps/YOURAPP/WEB-INF

export GEM_HOME=tomcat5/webapps/YOURAPP/WEB-INF/gems

cp Rakefile .

mkdir -p db/migrate

cp SOURCE/db/migrate/* db/migrate

run “java -jar lib/jars/jruby-complete-1.3.1.jar -S rake db:migrate”

-AD

On Mon, Oct 26, 2009 at 7:13 AM, Marco M.
[email protected] wrote:

…but i wouldn’t duplicate an application so how do you manage your


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Charles Nutter wrote:

On Fri, Oct 9, 2009 at 4:17 AM, Marco M.
[email protected] wrote:

I’d like to have the same model so if there are also batch procedures,
how do you manage it?

Is this basically a question about how you can run migrations from
within an app server (like on deploy)?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Yes, migrations are an example but generally i would like to know how to
exec a rake task in production environment. I have always used mongrel
for the production and i am testing java way but at the moment i’m using
an ugly solution: i’ve the application .war that runs under tomcat and,
in another path, the rails structure that let me to exec rake task
…but i wouldn’t duplicate an application so how do you manage your
production environment?

On Mon, Oct 26, 2009 at 5:46 AM, [email protected]
[email protected] wrote:

cd tomcat5/webapps/YOURAPP/WEB-INF

export GEM_HOME=tomcat5/webapps/YOURAPP/WEB-INF/gems

cp Rakefile .

mkdir -p db/migrate

cp SOURCE/db/migrate/* db/migrate

run “java -jar lib/jars/jruby-complete-1.3.1.jar -S rake db:migrate”

…and ideally all of that could be encapsulated with a command-line
option to an executable WAR file. Look at how Hudson CI server
manages executable WAR files for ideas. We are planning to do this
with embedded Glassfish, anyone have existing code to share?


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

[email protected] wrote:

cd tomcat5/webapps/YOURAPP/WEB-INF

export GEM_HOME=tomcat5/webapps/YOURAPP/WEB-INF/gems

cp Rakefile .

mkdir -p db/migrate

cp SOURCE/db/migrate/* db/migrate

run “java -jar lib/jars/jruby-complete-1.3.1.jar -S rake db:migrate”

-AD

Thanks for this solution

Don’t forget that there’s nothing special about rake - it’s just ruby.
You
don’t necessarily need to fork/exec/run a script - just load in the
files
and run your tasks. That might be easier where you don’t know much
about
your target environment (windows/linux/etc).

some_ruby_file.rb

require ‘rubygems’
require ‘rake’

load ‘my_rake_file.rb’

Rake::Task[:my_task].invoke

(Just typed into mail, not tested, but you get the idea)

I found this great guide to using rake with Tomcat

http://blog.groundhog.com.au/?p=168

Hope it helps!