stack icon indicating copy to clipboard operation
stack copied to clipboard

docker-compose does not create necessary roles on postgresql

Open AIsaacCastro opened this issue 2 years ago • 3 comments

image

Running docker compose on wsl2 does not create the necessary roles for the database, causing FATAL error

AIsaacCastro avatar Jul 19 '23 18:07 AIsaacCastro

image got this error

Here is the log image

arockiyastephenl avatar Aug 01 '23 09:08 arockiyastephenl

image

Running docker compose on wsl2 does not create the necessary roles for the database, causing FATAL error

me too

cowboybkit avatar Nov 09 '23 03:11 cowboybkit

you can create init.sql file with the blow content and place it under the following path stack.local\postgres it works with me

DROP DATABASE IF EXISTS ledger; DROP DATABASE IF EXISTS payments;

CREATE USER ledger WITH PASSWORD 'ledger_password';

CREATE DATABASE ledger; CREATE DATABASE payments;

GRANT ALL PRIVILEGES ON DATABASE ledger TO ledger; GRANT ALL PRIVILEGES ON DATABASE payments TO ledger;

CREATE ROLE formance WITH LOGIN PASSWORD 'formance';

GRANT ALL PRIVILEGES ON DATABASE ledger TO formance;

CREATE ROLE formance WITH LOGIN PASSWORD 'formance';

GRANT ALL PRIVILEGES ON DATABASE ledger TO formance;

MohdSalahFouad avatar Jul 17 '24 13:07 MohdSalahFouad