Skip to content

Commit

Permalink
docker-compose.yml: make it easy to restrict db resources
Browse files Browse the repository at this point in the history
As we learned, postgres may behave differently depending
on the available RAM.
You can now test the database nearer to production by adding
DB_MEMORY_LIMIT=1G
DB_CPU_LIMIT=1
to your .env file.

IntelliJ does not like the env variable interpolation,
but it works.

I used 128G as fallback, because normally while developing you
don't want a slow DB.
With the cpus it was not possible to limit to more cpu than
the machine has. Thus, i limited to 8 cores which
every developer machine has hopefully.
  • Loading branch information
BacLuc committed Apr 15, 2024
1 parent 04bbffa commit 67fda36
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ services:
- target: 5432
published: 5432
protocol: tcp
deploy:
resources:
limits:
memory: ${DB_MEMORY_LIMIT:-128G}
cpus: ${DB_CPU_LIMIT:-8}

mail:
image: maildev/maildev
Expand Down

0 comments on commit 67fda36

Please sign in to comment.