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

Posted March 20, 2015 2.3k views
Ruby on RailsMySQL

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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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.