Clean up document and make config more generic

This commit is contained in:
Dan Milne
2025-02-19 19:12:44 +11:00
parent 5dd89d3621
commit ce9b79f612
3 changed files with 17 additions and 5 deletions

View File

@@ -1,5 +1,9 @@
# Multi Database PostgreSQL with PGBouncer
This Compose project will let you run multiple database within one PostgreSQL container. It's based on (Cristian Angulo)[https://dev.to/nietzscheson/multiples-postgres-databases-in-one-service-with-docker-compose-4fdf]'s post on the subject.
It also starts up a PGBouncer.
## ENV file
Create a .env file with the following keys:
@@ -26,3 +30,12 @@ Alternatively, bind mount a local directory for PostgreSQL to use.
## Logging
This configuration will log to a mounted volume, using PostgreSQL logging, and not to Stderr / Docker logging as per the default image.
## PGBouncer
Add PGBouncer accounts with:
```bash
./generate-userlist pgb_admin >> userlist.txt
```
Update `pgbouncer.ini` adding the databases defined in POSTGRES_MULTIPLE_DATABASES to the `[databases]` section.

View File

@@ -1,5 +1,5 @@
services:
solid-pg:
postgres:
restart: always
image: postgres:17
environment:
@@ -21,7 +21,7 @@ services:
restart: always
image: edoburu/pgbouncer:latest
depends_on:
- solid-pg
- postgres
ports:
- "${HOST_IP}:6432:5432"
volumes:

View File

@@ -1,12 +1,11 @@
[databases]
solid_cache = host=solid-pg port=5432 dbname=solid_cache user=postgres password=Zie6ioloo5ehi0oosei4fahg
solid_queue = host=solid-pg port=5432 dbname=solid_queue user=postgres password=Zie6ioloo5ehi0oosei4fahg
database1 = host=solid-pg port=5432 dbname=solid_cache user=postgres password=somepassword
database1 = host=solid-pg port=5432 dbname=solid_queue user=postgres password=somepassword
[pgbouncer]
listen_addr = 0.0.0.0
listen_port = 5432
#auth_type = scram-sha-256
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
logfile = /var/log/pgbouncer/pgbouncer.log