Development vs Deployment: Postgres Database handling?

System Information
  • Strapi Version: 4.1.?
  • Operating System: OSX dev, Ubuntu deploy
  • Database: PG

Not being a dev-ops expert I’m running into some weird deployment issues that are probably due to this being my first site (well, first deployed site) with Strapi.
I followed the EC2 deployment, and have a Strapi install running on AWS. I am now running the development environment locally, and the production environment on AWS.
When I make changes locally in the development install they are synced with the live database immediately.

Question: Should I be accessing the live database from my dev environment, or should I have added a staging environment or a development DB into the layers? It wasn’t talked about in any of the deployment guides I saw, so I wasn’t sure.

1 Like

After more research and reading, if someone comes across this and wants to know (or is generally new to a multi-environment deployment process), here are the basics of deployment structure:

  • Development - Develop your Strapi application locally on your host machine, then push changes into source control
  • Staging - Deploy changes from source control to a “production-like” environment for testing
  • Production - If no other changes are needed, deploy into production
  • Repeat as needed, it is recommended that you properly version and test your application as you go
    That is pulled from here:
    Troubleshooting - Strapi Developer Docs

Which is related to this: Env setup for production and local development - #20 by DMehaffy

What my research has led me to believe is that it would be much better to have a local dev DB with it’s own dataset that only lives locally, you can build models, and test routes here etc., Then, have a production database that is used by both a staging environment, and the production environment.

Just wanted to update this post with some new answers to help reduce the googling!

1 Like