Friday, October 30, 2009

Run db:migrate in jruby from warfile

If you have production servers running jruby/rails applications packaged as war files and dont actually have the full jruby installed to run your migrations, you can follow these steps. This will allow you to run db:migrate without a jruby installation on your java application servers

Assuming you are deploying your app called 'myapp' into tomcat5, you would have a warfile located in $CATALINA_HOME/webapps/myapp.war. if your war is not unwar'd you can run "jar xvf myapp.war" to generate the unwar'd directory of your app (which you will need)

# cp $YOUR_REPISTORY/Rakefile .
# mkdir -p db/migrate
# cp $YOUR_REPISITORY/db/migrate/* db/migrate
# java -jar lib/jars/jruby-complete-1.3.1.jar -S rake db:migrate

Thats it.


Ed Allen said...

I'll probably be doing this pretty soon. Looks like we'll be moving an app to jRuby for warfile deployment next month.

Unknown said...

e-commerce designing & services in affordable price!!! We are offering Apps for Android and IOS.......