-
-
Notifications
You must be signed in to change notification settings - Fork 218
Description
Pre-work
- I have read the docs.
- I have searched open and closed issues.
- I agree to follow this project's Code of Conduct.
Description
If using PostgreSQL, it is possible to separate database tables per application by using schemas. I have a central PostgreSQL cluster for all my systems and use a single database production with one schema per application. I have installed all tables for speedtest-tracker in the database schema speedtesttracker.
Usually the correct schema is automatically selected when the schema name is the same as the database username. This is because the search path is set to the following by default within PostgreSQL:
SHOW search_path;
search_path
--------------
"$user", public
However this does not work with speedtest-tracker, as /app/www/bootstrap/cache/config.php sets the following:
'search_path' => 'public'
There is no other way to select the PostgreSQL schema. Usually this should be possible by using the ENV with DB_SCHEMA. This variable is not available as per https://docs.speedtest-tracker.dev/getting-started/database-drivers
For additional references, here is my full config:
services:
app:
image: lscr.io/linuxserver/speedtest-tracker:1.4.2
restart: unless-stopped
ports:
- <REDACTED>:80
environment:
- PUID=1000
- PGID=1000
- APP_KEY=<REDACTED>
- DISPLAY_TIMEZONE=Europe/Berlin
- DB_CONNECTION=pgsql
- DB_HOST=<REDACTED>
- DB_PORT=5432
- DB_DATABASE=production
- DB_SCHEMA=speedtesttracker
- DB_USERNAME=speedtesttracker
- DB_PASSWORD=<REDACTED>
- SPEEDTEST_SCHEDULE=<REDACTED>
- SPEEDTEST_SERVERS=<REDACTED>
- PRUNE_RESULTS_OLDER_THAN=365
volumes:
- app_data:/config
volumes:
app_data:
The system does not start correctly, as the database tables are not found (see screenshot and logs below).
I currently work around this by executing the following command after each container start:
sed -i "s/'search_path' => 'public',/'search_path' => 'speedtesttracker, public',/g" /app/www/bootstrap/cache/config.php
Expected Behavior
I am able to set the PostgreSQL schema by setting DB_SCHEMA=speedtesttracker in the environment.
Steps to Reproduce
- Use a central PostgreSQL system with a single database and application separation by utilizing database schemas.
- Fire up a container with the config above. The database schema setting is not available.
Deployment Environment
Docker Compose
Application Information
{"environment":{"application_name":"Speedtest Tracker","laravel_version":"12.9.2","php_version":"8.3.19","composer_version":"2.8.8","environment":"production","debug_mode":false,"url":"localhost","maintenance_mode":false,"timezone":"UTC","locale":"en"},"cache":{"config":true,"events":true,"routes":true,"views":true},"drivers":{"broadcasting":"null","cache":"database","database":"pgsql","logs":"stderr","mail":"log","queue":"database","session":"database"},"storage":{"\/app\/www\/public\/storage":false},"filament":{"version":"v3.3.10","packages":"filament, forms, notifications, support, tables","views":"NOT PUBLISHED","blade_icons":"CACHED","panel_components":"CACHED"},"livewire":{"livewire":"v3.6.3"},"speedtest_tracker":{"version":"v1.4.2"}}What browser(s) are you seeing the problem on?
all
Logs
[2025-04-13 19:26:27] production.ERROR: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "cache" does not exist
LINE 1: select * from "cache" where "key" in ($1)
^ (Connection: pgsql, SQL: select * from "cache" where "key" in (laravel_cache_illuminate:queue:restart))