user2473015
user2473015

Reputation: 1442

How to migrate Rails Application to different hosting provider

I started rails app with mysql2. First I'm going to deploy it to cheap server.When users get increased i need to migrate it to AWS or digitalocean.How to get database backup and restore it to new one?

Upvotes: 1

Views: 1069

Answers (2)

Frederic Henri
Frederic Henri

Reputation: 53713

Marc's answer is good but there might be more rails way

You can use an existing gem rails-backup-migrate

Add this to your GemFile

gem 'rails-backup-migrate'

and then do

bundle install

OR install directly

gem install rails-backup-migrate

Once this is installed you can backup your data using

rake site:backup

It creates a .tgz backup of your DB data with schema of your app.

Then to restore to some other Rails Application, move your .tgz file to the directory of your rails app and do

rake site:restore

Upvotes: 5

Marc Young
Marc Young

Reputation: 4012

MySQL backup and restore is common. Guides can be found on virtually any google result.

General idea:

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

Upvotes: 1

Related Questions