Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,22 @@ Open http://dhis2-127-0-0-1.nip.io in your favourite browser.

Custom configuration for Postgresql can be done by adding to the files in the `./config/postgresql/conf.d/` directory. If your configuration doesn't belong in either of the existing files, you can create a new file. However, it's advised not to make changes to the [postgresql.conf](config/postgresql/postgresql.conf) file.

Any changes to these files won't take effect until the container is restarted or the below command is executed:
Some postgresql configuration parameters can be applied by reloading the configuration. Others will only take effect when the database is restarted. The detailed description of each configuration option (on postgresql v16) is avalable [here](https://www.postgresql.org/docs/16/runtime-config.html). The documentation for each setting generally indicates whether the setting requires a restart in order to take effect.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have multiple double spaces in this paragraph


A configuration reload can be triggered by executing the following SQL command:

```sql
SELECT pg_reload_conf();
```

If you need to restart the database server, it is safest to stop the application container first, restart the database, then start the application again. This will mean some minutes of downtime for your users so it is best to co-ordinate such operations with users or execute during quiet times of the day. A typical sequence might look like:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have multiple double spaces in this paragraph


```bash
docker compose stop app
docker compose restart database
docker compose start app
```

## Overlays

### Traefik Dashboard
Expand Down
3 changes: 3 additions & 0 deletions config/postgresql/conf.d/10-memory.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ work_mem = 16MB # memory per sort/hash operation
maintenance_work_mem = 128MB
effective_cache_size = 6GB # usually ~75% of RAM

# for locally attached spinning disk
random_page_cost = 1.1

# max_wal_size = 5GB
4 changes: 2 additions & 2 deletions config/postgresql/conf.d/30-logging.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
log_destination = 'stderr'
logging_collector = off # disable writing to files
log_statement = 'ddl' # or 'all' if you want full query logging
log_min_duration_statement = 500 # log queries slower than 500ms
log_statement = 'none' # or 'all' if you want full query logging
log_min_duration_statement = 300s # log queries slower than 5 minutes
log_timezone = 'UTC'
3 changes: 3 additions & 0 deletions config/postgresql/conf.d/40-wal.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
checkpoint_completion_target = 0.8
synchronous_commit = off
wal_writer_delay = 10000ms
9 changes: 9 additions & 0 deletions config/postgresql/postgresql.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# These settings are required to run DHIS2
# Make local customisations under /etc/postgresql/conf.d
listen_addresses = '*'

# affects the performance of program indicators
jit = off

# required for flyway
max_locks_per_transaction = 128

include_dir = '/etc/postgresql/conf.d'