diff --git a/.app_version b/.app_version index 144996ed..88541566 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.20.3 +0.21.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 32c90c57..f15d85e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,52 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -# 0.20.3 - 2024-12-20 +# 0.21.0 - 2024-12-20 + +⚠️ This release introduces a breaking change. ⚠️ + +The `dawarich_db` service now uses a custom `postgresql.conf` file. + +As @tabacha pointed out in #549, the default `shm_size` for the `dawarich_db` service is too small and it may lead to database performance issues. This release introduces a `shm_size` parameter to the `dawarich_db` service to increase the size of the shared memory for PostgreSQL. This should help database with peforming vacuum and other operations. Also, it introduces a custom `postgresql.conf` file to the `dawarich_db` service. + +To mount a custom `postgresql.conf` file, you need to create a `postgresql.conf` file in the `dawarich_db` service directory and add the following line to it: + +```diff + dawarich_db: + image: postgres:14.2-alpine + shm_size: 1G + container_name: dawarich_db + volumes: + - dawarich_db_data:/var/lib/postgresql/data + - dawarich_shared:/var/shared ++ - ./postgresql.conf:/etc/postgresql/postgresql.conf # Provide path to custom config + ... + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ] + interval: 10s + retries: 5 + start_period: 30s + timeout: 10s ++ command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config +``` + +To ensure your database is using custom config, you can connect to the container (`docker exec -it dawarich_db psql -U postgres`) and run `SHOW config_file;` command. It should return the following path: `/etc/postgresql/postgresql.conf`. ### Added -- A button on a year stats card to update stats for the whole year. -- A button on a month stats card to update stats for a specific month. +- A button on a year stats card to update stats for the whole year. #466 +- A button on a month stats card to update stats for a specific month. #466 - A confirmation alert on the Notifications page before deleting all notifications. +- A `shm_size` parameter to the `dawarich_db` service to increase the size of the shared memory for PostgreSQL. This should help database with peforming vacuum and other operations. + +```diff + ... + dawarich_db: + image: postgres:14.2-alpine ++ shm_size: 1G + ... +``` + - In addition to `api_key` parameter, `Authorization` header is now being used to authenticate API requests. #543 Example: @@ -23,6 +62,7 @@ Authorization: Bearer YOUR_API_KEY ### Changed - The map borders were expanded to make it easier to scroll around the map for New Zealanders. +- The `dawarich_db` service now uses a custom `postgresql.conf` file. # 0.20.2 - 2024-12-17 diff --git a/docker-compose.yml b/docker-compose.yml index 4a41b272..68ad7846 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,10 +18,12 @@ services: timeout: 10s dawarich_db: image: postgres:14.2-alpine + shm_size: 1G container_name: dawarich_db volumes: - dawarich_db_data:/var/lib/postgresql/data - dawarich_shared:/var/shared + - ./postgresql.conf:/etc/postgresql/postgresql.conf # Provide path to your custom config networks: - dawarich environment: @@ -34,6 +36,7 @@ services: retries: 5 start_period: 30s timeout: 10s + command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config dawarich_app: image: freikin/dawarich:latest container_name: dawarich_app diff --git a/postgres.conf.example b/postgres.conf.example new file mode 100644 index 00000000..9e1687c3 --- /dev/null +++ b/postgres.conf.example @@ -0,0 +1,36 @@ +listen_addresses = '*' +max_connections = 50 + +shared_buffers = 512MB + +work_mem = 128MB +maintenance_work_mem = 128MB + + +dynamic_shared_memory_type = posix +checkpoint_timeout = 10min # range 30s-1d +max_wal_size = 2GB +min_wal_size = 80MB +max_parallel_workers_per_gather = 4 + +log_min_duration_statement = 500 # -1 is disabled, 0 logs all statements + # -1 disables, 0 logs all temp files +log_timezone = 'UTC' + + +autovacuum_vacuum_scale_factor = 0.05 # fraction of table size before vacuum +autovacuum_analyze_scale_factor = 0.05 # fraction of table size before analyze + + +datestyle = 'iso, dmy' + +timezone = 'UTC' + +lc_messages = 'en_US.utf8' # locale for system error message + # strings +lc_monetary = 'en_US.utf8' # locale for monetary formatting +lc_numeric = 'en_US.utf8' # locale for number formatting +lc_time = 'en_US.utf8' # locale for time formatting + + +default_text_search_config = 'pg_catalog.english'