Deploying the data

I think I have a fundamental misunderstanding of the deployment
process that I’m hoping someone can clear up for me.

I’ve been developing a rails app on my local machine in the
development environment. All data is writing to railsapp_development.

Over the last couple of days I’ve been trying to deploy the app to a
production environment on a remote server. I did this with deprec.
It worked, but only the database schema went with it. The actual data
did not move. I believe that this is normal. If so, how do you get
your data to deploy?

write a capistrano task?
export it off the local machine, and import it to a database on the
remote server manually?

Any help would be appreciated.

Generally, the data in the development database is not “real”. It’s
just play data that you use while you develop the product. Once your
product is minimally usable (and well before actual “launch”) you
start deploying your application to the production environment, which
is where you actually starting using it with real data.

It sounds like you’ve been using your dev database for real data. This
isn’t a bad thing, it’s just different from the assumptions that
Capistrano makes. As a result, you’ll need to move the development
data to your production database. There’s not a lot of reason to write
a task to do this, since it will probably be something you just do
once. Just do a dump of your database to a file, copy that file (via
scp or sftp or whatever) to your production server, and then import it
into your production database. How you actually export and import data
is largely database dependent. Each database has it’s own utility for
dumping data.

  • Jamis

Great. Thanks for clearing that up.

So, as I continue to develop this app, and I pull down a version from
the repository to work on, I should not be adding records unless I
want to move the data again? In other words, records should only be
added to the app running on the production server?

Furfey, that’s pretty much spot on. Sometimes I would write a
migration to add a couple of default records to ensure they are added
to multiple environments databases.

There are a couple of capistrano recipes floating about on this user
group for syncing database down from production back to your local
development copy, which as it sounds should help you a good bit.

Best,
Dave