How can I move an existing Ruby on Rails application that is hosted elsewhere to Digital Ocean?

March 20, 2015 463 views
Ruby on Rails MySQL

It is a pretty straight-forward–yet critical– rails app that has a 50,000 row database (mostly text). What would the steps be beyond setting up a RoR droplet and then copying the files over?

1 Answer

First, you would want to backup your MySQL database by using this the mysqldump tool:
mysqldump -u root -p --all-databases > alldb_backup.sql

Then you would create your new RoR server, copying over your configuration files from your RoR directory using rsync, or another method. Once it's running, import your MySQL backup:

mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]

Be sure to test to make sure the app is running well, and as expected before you modify DNS data or shut off your old app server.

Have another answer? Share your knowledge.