I have been tinkering with RoR and JRuby for about a year to create simple internal applications. I am working on my first "real" application that will be deployed for use on the internet and have some questions on proper deployment using RoR (2.2.2), JRuby (1.4) and MySQL (5.0.x). (I will be deploying everything to a hosted Tomcat/MySQL environment) I can easily enough use Warbler to create a WAR file and deploy that to Tomcat. I also setup a MySQL server on the hosting machine as the app is configured to use MySQL. The part that is causing me heartburn is getting the DB schema up to the hosting site. As a workaround for the initial release I simply used mysqldump to export the entire schema and base data. I then used the mysql command interface to load the sqldump into the server. This works well enough for now, but what is the "right" way to deploy the database schema and migration updates over time? While the app is in use over the next 3 months I will be building the "admin/reporting" interface to it so I suspect I will need to modify the schema in some way long after the app is in use and loaded with real data. I appreciate your time and assistance with this question! --Michael -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sent from my iPhone On Nov 26, 2009, at 10:36 AM, MichaelF <michael-AddfkO4XGm4dnm+yROfE0A@public.gmane.org> wrote:> I have been tinkering with RoR and JRuby for about a year to create > simple internal applications. I am working on my first "real" > application that will be deployed for use on the internet and have > some questions on proper deployment using RoR (2.2.2), JRuby (1.4) and > MySQL (5.0.x). > > (I will be deploying everything to a hosted Tomcat/MySQL environment) > > I can easily enough use Warbler to create a WAR file and deploy that > to Tomcat. I also setup a MySQL server on the hosting machine as the > app is configured to use MySQL. > > The part that is causing me heartburn is getting the DB schema up to > the hosting site. As a workaround for the initial release I simply > used mysqldump to export the entire schema and base data. I then used > the mysql command interface to load the sqldump into the server. This > works well enough for now, but what is the "right" way to deploy the > database schema and migration updates over time? > > While the app is in use over the next 3 months I will be building the > "admin/reporting" interface to it so I suspect I will need to modify > the schema in some way long after the app is in use and loaded with > real data. > > I appreciate your time and assistance with this question! > > --MichaelMichael, why don''t you simply use the glassfish gem for deployment? In any cade, if you''re trying to update the schema on the production machine, the you can simply do the following: rake db:migrate RAILS_ENV=production Good luck -Conrad> > -- > > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Conrad - Forgive me if this is a stupid question (this is my first attempt at deploying a WAR from RoR)... How can I run a rake command on the Tomcat server? All that is on there is Java / Tomcat / MySQL. Do I have access to rake somehow through the WAR that is deployed? I know the JRuby JAR is in that WAR but was not aware I could run rake tasks that way. On Nov 26, 12:33 pm, Conrad Taylor <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sent from my iPhone > > On Nov 26, 2009, at 10:36 AM, MichaelF <mich...-AddfkO4XGm4dnm+yROfE0A@public.gmane.org> wrote: > > > > > > > I have been tinkering with RoR and JRuby for about a year to create > > simple internal applications. I am working on my first "real" > > application that will be deployed for use on the internet and have > > some questions on proper deployment using RoR (2.2.2), JRuby (1.4) and > > MySQL (5.0.x). > > > (I will be deploying everything to a hosted Tomcat/MySQL environment) > > > I can easily enough use Warbler to create a WAR file and deploy that > > to Tomcat. I also setup a MySQL server on the hosting machine as the > > app is configured to use MySQL. > > > The part that is causing me heartburn is getting the DB schema up to > > the hosting site. As a workaround for the initial release I simply > > used mysqldump to export the entire schema and base data. I then used > > the mysql command interface to load the sqldump into the server. This > > works well enough for now, but what is the "right" way to deploy the > > database schema and migration updates over time? > > > While the app is in use over the next 3 months I will be building the > > "admin/reporting" interface to it so I suspect I will need to modify > > the schema in some way long after the app is in use and loaded with > > real data. > > > I appreciate your time and assistance with this question! > > > --Michael > > Michael, why don''t you simply use the glassfish gem for deployment? > In any cade, if you''re trying to update the schema on the production > machine, the you can simply do the following: > > rake db:migrate RAILS_ENV=production > > Good luck > > -Conrad > > > > > > > -- > > > You received this message because you are subscribed to the Google > > Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails- > > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > . > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en > > .-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, I have similar set up as yours. My production Linux server has plain Glassfish & MySQL, and no JRuby is installed (it is packed in WAR file). I ended up with running migration on my development computer. In my database.yml , I put the address of my production server. My production server is located in private network for security purposes, so I am using SSH tunneling to access from outside. Glen On Nov 26, 4:27 pm, MichaelF <mich...-AddfkO4XGm4dnm+yROfE0A@public.gmane.org> wrote:> Conrad - > > Forgive me if this is a stupid question (this is my first attempt at > deploying a WAR from RoR)... > > How can I run a rake command on the Tomcat server? All that is on > there is Java / Tomcat / MySQL. Do I have access to rake somehow > through the WAR that is deployed? I know the JRuby JAR is in that WAR > but was not aware I could run rake tasks that way. > > On Nov 26, 12:33 pm, Conrad Taylor <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Sent from my iPhone > > > On Nov 26, 2009, at 10:36 AM, MichaelF <mich...-AddfkO4XGm4dnm+yROfE0A@public.gmane.org> wrote: > > > > I have been tinkering with RoR and JRuby for about a year to create > > > simple internal applications. I am working on my first "real" > > > application that will be deployed for use on the internet and have > > > some questions on proper deployment using RoR (2.2.2), JRuby (1.4) and > > > MySQL (5.0.x). > > > > (I will be deploying everything to a hosted Tomcat/MySQL environment) > > > > I can easily enough use Warbler to create a WAR file and deploy that > > > to Tomcat. I also setup a MySQL server on the hosting machine as the > > > app is configured to use MySQL. > > > > The part that is causing me heartburn is getting the DB schema up to > > > the hosting site. As a workaround for the initial release I simply > > > used mysqldump to export the entire schema and base data. I then used > > > the mysql command interface to load the sqldump into the server. This > > > works well enough for now, but what is the "right" way to deploy the > > > database schema and migration updates over time? > > > > While the app is in use over the next 3 months I will be building the > > > "admin/reporting" interface to it so I suspect I will need to modify > > > the schema in some way long after the app is in use and loaded with > > > real data. > > > > I appreciate your time and assistance with this question! > > > > --Michael > > > Michael, why don''t you simply use the glassfish gem for deployment? > > In any cade, if you''re trying to update the schema on the production > > machine, the you can simply do the following: > > > rake db:migrate RAILS_ENV=production > > > Good luck > > > -Conrad > > > > -- > > > > You received this message because you are subscribed to the Google > > > Groups "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails- > > > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > . > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en > > > .-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Nov 26, 2009 at 11:33 AM, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Michael, why don''t you simply use the glassfish gem for deployment?It''s not always suitable, especially if you have an existing Tomcat installation with other non-JRuby apps.> In any cade, if you''re trying to update the schema on the production > machine, the you can simply do the following: > > rake db:migrate RAILS_ENV=productionNo, you can''t; that''s the whole point -- none of those rake tasks are packaged with the WAR file. The legacy app I inherited uses Capistrano to check out and deploy a JRuby app in standard Rails format, which is useful for running migrations, scripts via cron jobs, etc., and then builds and deploys the WAR file from there. It seems a little redundant, but it works :-) FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
rake db:schema:load instead of rake db:migrate in your production server. On Fri, Nov 27, 2009 at 12:44 PM, Hassan Schroeder < hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Nov 26, 2009 at 11:33 AM, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > Michael, why don''t you simply use the glassfish gem for deployment? > > It''s not always suitable, especially if you have an existing Tomcat > installation with other non-JRuby apps. > > > In any cade, if you''re trying to update the schema on the production > > machine, the you can simply do the following: > > > > rake db:migrate RAILS_ENV=production > > No, you can''t; that''s the whole point -- none of those rake tasks are > packaged with the WAR file. > > The legacy app I inherited uses Capistrano to check out and deploy > a JRuby app in standard Rails format, which is useful for running > migrations, scripts via cron jobs, etc., and then builds and deploys > the WAR file from there. > > It seems a little redundant, but it works :-) > > FWIW, > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- Liu Lantao College of Information Science and Technology, Beijing Normal University EMAIL: liulantao ( at ) gmail ( dot ) com ; WEBSITE: http://www.liulantao.com/ . ------ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Nov 26, 2009 at 12:36 PM, MichaelF <michael-AddfkO4XGm4dnm+yROfE0A@public.gmane.org> wrote:> I have been tinkering with RoR and JRuby for about a year to create > simple internal applications. I am working on my first "real" > application that will be deployed for use on the internet and have > some questions on proper deployment using RoR (2.2.2), JRuby (1.4) and > MySQL (5.0.x). > > (I will be deploying everything to a hosted Tomcat/MySQL environment) > > I can easily enough use Warbler to create a WAR file and deploy that > to Tomcat. I also setup a MySQL server on the hosting machine as the > app is configured to use MySQL. > > The part that is causing me heartburn is getting the DB schema up to > the hosting site. As a workaround for the initial release I simply > used mysqldump to export the entire schema and base data. I then used > the mysql command interface to load the sqldump into the server. This > works well enough for now, but what is the "right" way to deploy the > database schema and migration updates over time? > > While the app is in use over the next 3 months I will be building the > "admin/reporting" interface to it so I suspect I will need to modify > the schema in some way long after the app is in use and loaded with > real data. > > I appreciate your time and assistance with this question!You can have warbler include your db/ directory as well as your Rakefile in the war. Then, on the server, unpack the war file somewhere and run rake as follows inside the WEB-INF directory: java -jar lib/jruby-complete-X.Y.jar -S rake db:migrate RAILS_ENV=production Some folks have gone so far as to have a custom servlet context listener run db:migrate inside the app server once the app is deployed, but that always seemed a little dodgy to me... /Nick> > --Michael > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
straightflush-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Dec-06 14:21 UTC
Re: Rails/JRuby WAR deployment and Migrations
http://blog.dberg.org/2009/10/run-dbmigrate-in-jruby-without-rails.html On Wed, Dec 2, 2009 at 11:35 AM, Nick Sieger <nicksieger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Nov 26, 2009 at 12:36 PM, MichaelF <michael-AddfkO4XGm4dnm+yROfE0A@public.gmane.org> wrote: >> I have been tinkering with RoR and JRuby for about a year to create >> simple internal applications. I am working on my first "real" >> application that will be deployed for use on the internet and have >> some questions on proper deployment using RoR (2.2.2), JRuby (1.4) and >> MySQL (5.0.x). >> >> (I will be deploying everything to a hosted Tomcat/MySQL environment) >> >> I can easily enough use Warbler to create a WAR file and deploy that >> to Tomcat. I also setup a MySQL server on the hosting machine as the >> app is configured to use MySQL. >> >> The part that is causing me heartburn is getting the DB schema up to >> the hosting site. As a workaround for the initial release I simply >> used mysqldump to export the entire schema and base data. I then used >> the mysql command interface to load the sqldump into the server. This >> works well enough for now, but what is the "right" way to deploy the >> database schema and migration updates over time? >> >> While the app is in use over the next 3 months I will be building the >> "admin/reporting" interface to it so I suspect I will need to modify >> the schema in some way long after the app is in use and loaded with >> real data. >> >> I appreciate your time and assistance with this question! > > You can have warbler include your db/ directory as well as your > Rakefile in the war. Then, on the server, unpack the war file > somewhere and run rake as follows inside the WEB-INF directory: > > java -jar lib/jruby-complete-X.Y.jar -S rake db:migrate RAILS_ENV=production > > Some folks have gone so far as to have a custom servlet context > listener run db:migrate inside the app server once the app is > deployed, but that always seemed a little dodgy to me... > > /Nick > >> >> --Michael >> >> -- >> >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >> > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.