2021-01-18 12:13:26 +02:00
|
|
|
# For development this compose file starts the database only. The app can then
|
2024-01-26 22:19:28 +02:00
|
|
|
# be started using `yarn start-dev`, which is useful for development, because
|
2021-01-18 12:13:26 +02:00
|
|
|
# it means the app Docker file doesn't have to be rebuilt on each change.
|
2024-05-11 17:12:54 +02:00
|
|
|
#
|
|
|
|
# Note that log is setup to give as much information as possible, including
|
|
|
|
# whether it's the master or slave database that is being used for a query.
|
|
|
|
#
|
|
|
|
# To setup and test replication, use the following config in Joplin Server. Note
|
|
|
|
# in particular the different port, which means we access the slave and not the
|
|
|
|
# master.
|
|
|
|
#
|
|
|
|
# DB_USE_SLAVE=true
|
|
|
|
# SLAVE_POSTGRES_PASSWORD=joplin
|
|
|
|
# SLAVE_POSTGRES_DATABASE=joplin
|
|
|
|
# SLAVE_POSTGRES_USER=joplin
|
|
|
|
# SLAVE_POSTGRES_PORT=5433
|
|
|
|
# SLAVE_POSTGRES_HOST=localhost
|
2021-01-18 12:13:26 +02:00
|
|
|
|
2024-05-11 17:12:54 +02:00
|
|
|
version: '2'
|
2021-01-18 12:13:26 +02:00
|
|
|
|
|
|
|
services:
|
2024-05-11 17:12:54 +02:00
|
|
|
|
|
|
|
postgresql-master:
|
|
|
|
image: 'bitnami/postgresql:16.3.0'
|
2021-01-18 12:13:26 +02:00
|
|
|
ports:
|
2024-05-11 17:12:54 +02:00
|
|
|
- '5432:5432'
|
2021-01-18 12:13:26 +02:00
|
|
|
environment:
|
2024-05-11 17:12:54 +02:00
|
|
|
- POSTGRESQL_PASSWORD=joplin
|
|
|
|
- POSTGRESQL_USERNAME=joplin
|
|
|
|
- POSTGRESQL_DATABASE=joplin
|
|
|
|
|
|
|
|
- POSTGRESQL_REPLICATION_MODE=master
|
|
|
|
- POSTGRESQL_REPLICATION_USER=repl_user
|
|
|
|
- POSTGRESQL_REPLICATION_PASSWORD=repl_password
|
|
|
|
|
|
|
|
- POSTGRESQL_LOG_HOSTNAME=true
|
|
|
|
- POSTGRESQL_PGAUDIT_LOG=READ,WRITE
|
|
|
|
- POSTGRESQL_EXTRA_FLAGS=-c work_mem=100000 -c log_statement=all
|
|
|
|
|
|
|
|
postgresql-slave:
|
|
|
|
image: 'bitnami/postgresql:16.3.0'
|
|
|
|
ports:
|
|
|
|
- '5433:5432'
|
|
|
|
depends_on:
|
|
|
|
- postgresql-master
|
|
|
|
environment:
|
|
|
|
- POSTGRESQL_REPLICATION_MODE=slave
|
|
|
|
- POSTGRESQL_REPLICATION_USER=repl_user
|
|
|
|
- POSTGRESQL_REPLICATION_PASSWORD=repl_password
|
|
|
|
- POSTGRESQL_MASTER_HOST=postgresql-master
|
|
|
|
- POSTGRESQL_PASSWORD=joplin
|
|
|
|
- POSTGRESQL_MASTER_PORT_NUMBER=5432
|
|
|
|
|
|
|
|
- POSTGRESQL_LOG_HOSTNAME=true
|
|
|
|
- POSTGRESQL_PGAUDIT_LOG=READ,WRITE
|
|
|
|
- POSTGRESQL_EXTRA_FLAGS=-c work_mem=100000 -c log_statement=all
|
|
|
|
|