photonix
photonix copied to clipboard
Postgres authentication fails in docker container
Describe the bug After creating the service as per the docs, logs show that password authentication fails. The Photonix service does run and is accessible, but login is impossible
To Reproduce Steps to reproduce the behavior:
- Follow docs on installation
- Only change essential variables (no variables were added)
- Start docker container and follow logs
Expected behavior Container should connect to postgres without error
Screenshots If applicable, add screenshots to help explain your problem.
Server (please complete the following information):
- Device: Contabo VPS 300
- OS: Ubuntu Linux 20.04
- ARM64
Desktop (please complete the following information):
- OS: Fedora 34 GNOME
- Browser: Firefox
- Version:
:latest
as of Aug 2
Additional context
Changing the postgres username changes the password, evidence that it is the postgres connection that is the issue. Adding POSTGRES_USER
and PASSWORD_AUTHENTICATION: md5
do not help. Installation is behind reverse proxy, and is on a network with other apps. All containers (postgres, redis, and photonix) are on this same network. Below is the docker-compose.yml after some attempts to fix the issue.
version: '3'
services:
postgres:
container_name: photonix-postgres
image: postgres:11.1-alpine
environment:
POSTGRES_DB: photonix
POSTGRES_USER: photonix
POSTGRES_PASSWORD: photonix
volumes:
- ./data/db:/var/lib/postgresql/data
networks:
- proxy
redis:
container_name: photonix-redis
image: redis:6.2.2
networks:
- proxy
photonix:
container_name: photonix
image: photonixapp/photonix:latest
environment:
ENV: prd
POSTGRES_HOST: photonix-postgres
POSTGRES_DB: photonix
POSTGRES_USER: photonix
POSTGRES_PASSWORD: photonix
REDIS_HOST: redis
ALLOWED_HOSTS: '*'
VIRTUAL_PORT: 80
VIRTUAL_HOST: photonix.myurl.tld
LETSENCRYPT_HOST: photonix.myurl.tld
ADMIN_USERNAME: admin
ADMIN_PASWORD: admin
# More configuration options here: https://photonix.org/docs/configuration/
volumes:
- ./data/photos:/data/photos
- ./data/raw-photos-processed:/data/raw-photos-processed
- ./data/cache:/data/cache
- ./data/models:/data/models
links:
- postgres
- redis
networks:
- proxy
networks:
proxy:
external: true
I saw somewhere else that there was interest in using MySQL or MariaDB. I'll add here that this would likely help this issue in my case since I already have a working instance of MariaDB and could easily add Photonix to it.
Hi @logburn. Thanks for reporting this. Could you try exposing the Postgres port by adding this under image: postgres:11.1-alpine
:
ports:
- '5432:5432'
Could you then try confirm you can connect with the psql
CLI tool (psql -h localhost -p 5432 -U photonix photonix
). Thanks.
Another thing to note is that the Postgres username/password only gets created on the first run of the Postgres container so if you changed that it would still be the original value. To get back to a clean DB state and recreate user you can do:
- Kill docker compose
-
sudo rm -rf data/db
- Start docker compose again (
make start
)
i also cannot change the username it is hard-coded to 'postgres' that's all