Make postgres config optional && add health check header && add photon api key

This commit is contained in:
Eugene Burmakin
2024-12-24 16:50:53 +01:00
parent d640af4036
commit 462df9e796
6 changed files with 16 additions and 6 deletions

View File

@@ -1 +1 @@
0.21.0
0.21.1

View File

@@ -5,11 +5,17 @@ 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.21.1 - 2024-12-23
# 0.21.1 - 2024-12-24
### Added
- Cache cleaning and preheating upon application start.
- `PHOTON_API_KEY` env var to set Photon API key. It's an optional env var, but it's required if you want to use Photon API as a Patreon supporter.
- 'X-Dawarich-Response' header to the `GET /api/v1/health` endpoint. It's set to 'Hey, I\'m alive!' to make it easier to check if the API is working.
### Changed
- Custom config for PostgreSQL is now optional in `docker-compose.yml`.
# 0.21.0 - 2024-12-20
@@ -29,7 +35,7 @@ To mount a custom `postgresql.conf` file, you need to create a `postgresql.conf`
volumes:
- dawarich_db_data:/var/lib/postgresql/data
- dawarich_shared:/var/shared
+ - ./postgresql.conf:/etc/postgresql/postgresql.conf # Provide path to custom config
+ - ./postgresql.conf:/etc/postgresql/postgres.conf # Provide path to custom config
...
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ]
@@ -37,7 +43,7 @@ To mount a custom `postgresql.conf` file, you need to create a `postgresql.conf`
retries: 5
start_period: 30s
timeout: 10s
+ command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config
+ command: postgres -c config_file=/etc/postgresql/postgres.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`.

View File

@@ -4,6 +4,8 @@ class Api::V1::HealthController < ApiController
skip_before_action :authenticate_api_key
def index
response.set_header('X-Dawarich-Response', 'Hey, I\'m alive!')
render json: { status: 'ok' }
end
end

View File

@@ -17,4 +17,6 @@ if defined?(PHOTON_API_HOST)
settings[:photon] = { use_https: PHOTON_API_USE_HTTPS, host: PHOTON_API_HOST }
end
settings[:http_headers] = { 'X-Api-Key' => PHOTON_API_KEY } if defined?(PHOTON_API_KEY)
Geocoder.configure(settings)

View File

@@ -23,7 +23,7 @@ services:
volumes:
- dawarich_db_data:/var/lib/postgresql/data
- dawarich_shared:/var/shared
- ./postgresql.conf:/etc/postgresql/postgresql.conf # Provide path to your custom config
# - ./postgresql.conf:/etc/postgresql/postgresql.conf # Optional, uncomment if you want to use a custom config
networks:
- dawarich
environment:
@@ -36,7 +36,7 @@ services:
retries: 5
start_period: 30s
timeout: 10s
command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config
# command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config, uncomment if you want to use a custom config
dawarich_app:
image: freikin/dawarich:latest
container_name: dawarich_app