How do I set up a Dev/Prod environment for my API?

Hi All,

So as the title states, I'm building an API and trying to juggle data between machines isn't really working out for me anymore.

How do people typically spin up a dev environment for their APIs? Ideally I'm looking for something that is separate from my prod data but gets all it's writes. so I can fuss against THAT database and not ruin prod.

My Stack is Linux, Nginx, Python, MySQL.

In Over My Head :P

2 Replies

Let's talk about the different kinds of changes that will need to be made against a database during development.

Development often needs to be able to handle changes to schema and use datasets that mimic real world usage, but not be the actual data. We want to prevent customer data from leaking out, so it might not be wise to let developers walk around with an exact copy of the production database their laptops.

The production database should be left alone. It is assumed that daily dumps of the database are being made for backups, but backups are a good starting point for deriving a useful development DB.

You may wish to write a series of individual scripts that builds a new development database from backups each night, starting with PII obfuscation. i.e. If there are customer names in the db or other identifiable information, we substitute them in the fresh development db with randomized versions.

Each change to schema, constraints, etc. should have a separate script (named distinctly) from the data obfuscation script (to prevent accidental application against that script on the production db when new changes are rolled out.) These should be applied sequentially and automatically until the dev database is gradually transformed into the schema for the current development code.

In this scenario, the development db will only stay one day behind production and no changes are accidentally introduced into the production environment.

Hey @hphillips, thanks so much for the response. I think I've put a solid plan of action together with the insight you've provided and I'm looking forward to some weeknight building!

Thank you and be well!


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct