In my app I’d like to offer a demo account, so potential users can log
in and play around with the system to their hearts content. To
prevent the data from becoming too cluttered, I intend to reset the
reference data for this account every day.
I see two possible options of achieving this, but I’d appreciate some
feedback from the group before I dive in:
-
Run a separate instance of the app (probably on a separate machine)
using a different database, create fixtures for all my base reference
data, and get cron call ‘rake db:bootstrap’ every night. This is
fairly straightforward but the downside is having to run another
server (or VPS) and having a more complicated deployment process. -
Use the production instance of the app and database and write some
explicit code which deletes and reloads the reference data for this
account only. This might be more work to set up, is a little riskier,
but there is no separate deployment issue since it’s using the
production application. The demo account will also be on a production
server so there will be performance benefits.
There are advantages and disadvantages to both methods, but at the
moment I’m more inclined to go for (2). I don’t really think having
the reference data in Ruby code rather than YAML is a disadvantage,
and I like that fact that deployment isn’t affected – we deploy the
app and the demo account is available automatically.
Am I thinking along the right lines or is there a glaringly obvious
third way which I’m failing to see?
Cheers, Olly.