by LandR · 9y ago · 0 comments
Hope everything doesn't blow up.
It's not ideal.
All dev and testing is dont against the live database. YOu just have to be very, very, very careful.
It's something we are trying to implement now, honestly. It's on the TODO list.
The problem I'm having is where do you start? How do you simulate the data flowing through live in the test / dev enviornment.
It doesn't take that long to put some safeguards.
Here is the thing: WHENEVER you say "you have to be VERY careful" or blame someone for making a mistake, that's a place you need to put more checks. The computer should check routine things, not people.
"The problem I'm having is where do you start? How do you simulate the data flowing through live in the test / dev enviornment."
I am guessing you use MySQL so simply set up MYSQL REPLICATION and test all your stuff on the replica database first. Actually you should periodically dump the replica and test on a snapshot, so you can mess up the snapshot.
Main db -> Replica -> Snapshot.
Got any good articles on how to setup test environments. I would then need all the dev code to point to the test one, not the live db and any Web APIs to be able to switch to point to the test db (which must mean running 2 web apis, a live and a test one...)
Seems like it gets very complicated, but probably worth figuring out.
We don't even have CI yet.
> How do you simulate the data flowing through live in the test / dev enviornment.
Most don't, rolling with the schema and 'minimum viable' data flow instead.
Make darn sure your backups work by testing restores regularly. Restoring a production backup elsewhere may be an option if it's possible to avoid sensitive data (scrubbing afterward introduces risk of missing something, and should be scripted/repeatable).
Exactly matching production data flow is not as important as avoiding accidentally hosing the prod db.
1. Set up replication, with your test db the replication slave of your production database, such that changes in production are mirrored in testing nearly instantly.
2. Take your production database backups (you do have those, right?) and restore them to the test database. This is less fresh than a replication setup but if you're just doing functional testing it should be enough to say "Well, okay, this little change isn't going to blow everything up."
Depending on what you're working on, chances are there even are people who use _security_ as an excuse to basically prevent any halfway useful emergency strategy one could think of when handling data impossible to pull off (oh the irony).