Is there a way to initially provide with custom db, user and password for postgres during installation. I am using self-hosted docker installation. If I try to give custom user and password, I get an error Password Authentication failed for user "postgres" even though I want to change my user which I provided with environment variable POSTGRES_USER. Why does db get created only with superuser postgres?
If I provide the DATABASE_URL=postgres://def:xyz@localhost:1234/database_name
example - server ip - 12.23.34.45
docker-compose.yaml -
plausible_db:
supported versions are 12, 13, and 14
image: postgres:14-alpine
restart: always
ports:
1234 : 5432
volumes:
db-data:/var/lib/postgresql/data
environment:
POSTGRES_DB=abc
POSTGRES_USER=def
POSTGRES_PASSWORD=xyz
plausible:
image: plausible/analytics:v1.5
restart: always
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
depends_on:
plausible_db
plausible_events_db
mail
ports:
**** : ****
env_file:
plausible-conf.env
volumes:
db-data:
driver: local
event-data:
driver: local
DATABASE_URL=postgres://def:xyz@12.23.34.45:1234/abc
Is it postgres://user:password@server-ip:port-mapped-to/$POSTGRES_DB ?
I get the following error -
Error - * (MatchError) no match of right hand side value: {:error, "connection not available and request was dropped from queue after 2000ms. This means requests are coming in and your connection pool cannot serve them fast enough. You can address this by:\n\n 1. Ensuring your database is available and that you can connect to it\n 2. Tracking down slow queries and making sure they are running fast enough\n 3. Increasing the pool_size (although this increases resource consumption)\n 4. Allowing requests to wait longer by increasing :queue_target and :queue_interval\n\nSee DBConnection.start_link/2 for more information\n"}
If provided with -
postgres://def:xyz@localhost:1234/$POSTGRES_DB
I get the following error -
Failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:1234): connection refused - :econnrefused
Tried giving - postgres://user:password@server-ip:port-mapped-to/$POSTGRES_DB
image: postgres:14-alpine
restart: always
ports:
1234 : 5432
volumes:
db-data:/var/lib/postgresql/data
environment:
POSTGRES_DB=abc
POSTGRES_USER=def
POSTGRES_PASSWORD=xyz