How would you run a Postgres Server in production? [closed]
Asked Answered
S

1

7

I am currently using Django and Postgres with Docker. When trying to go into production, would I keep my current setup, with a local Postgres database server running alongside my django?

Sycamore answered 9/2, 2021 at 15:44 Comment(1)
Depends on your requirements.Punke
B
19

As @LaurenzAlbe said, it depends what you are looking for. But before going to production there is a few things to check for sure.

Postgres performance with default config is poor. One thing you should do is optimize your Postgres settings. For me this site has been huge help: https://pgtune.leopard.in.ua/#/ . It may be a bit old, but gives nice starting point for optimizing.

Setting up your backup is important. One big decision to make is do you use WAL or do you just rely on database dumps. Of course you can have some third party backup system. Postgres reference here: https://www.postgresql.org/docs/13/backup.html.

Security is important point of view. https://www.upguard.com/blog/10-ways-to-bolster-postgresql-security is a nice checklist for that.

It is nice to have decent logging. For me long query logs have been great help to look at performance problems. Usually there is a poorly written query which make your users to wait. https://www.postgresql.org/docs/13/runtime-config-logging.html

There probably is many other things to look at before going to production. But start with these ones.

*** EDIT ***

I might understood your question a bit wrong. You probably asked if you should have DB and App on same node / container or should you have separate ones. That depends on how much scaling you need and what kind of server environment you have in your hands.

Anyway, you need to configure your DB no matter where it is running. So I leave my original answer here.

Bork answered 9/2, 2021 at 17:34 Comment(1)
Okay, thank you for the response! So, if my application is relatively small, it is fine to run a local postgres server as long as it is configured?Sycamore

© 2022 - 2024 — McMap. All rights reserved.