T
Twenty2mo ago
TwoPigs

Permission denied - PostgreSQL

For me, this compose file is resulting in the following error https://github.com/twentyhq/twenty/blob/main/packages/twenty-docker/docker-compose.yml
postgresql 10:48:15.42 INFO ==> ** Starting PostgreSQL setup **

postgresql 10:48:15.44 INFO ==> Validating settings in POSTGRESQL_* env vars..

postgresql 10:48:15.45 INFO ==> Loading custom pre-init scripts...

postgresql 10:48:15.46 INFO ==> Initializing PostgreSQL database...

mkdir: cannot create directory ‘/bitnami/postgresql/data’: Permission denied
postgresql 10:48:15.42 INFO ==> ** Starting PostgreSQL setup **

postgresql 10:48:15.44 INFO ==> Validating settings in POSTGRESQL_* env vars..

postgresql 10:48:15.45 INFO ==> Loading custom pre-init scripts...

postgresql 10:48:15.46 INFO ==> Initializing PostgreSQL database...

mkdir: cannot create directory ‘/bitnami/postgresql/data’: Permission denied
I tried updating the change-vol-ownership trickery but with no luck
change-vol-ownership:
image: ubuntu
user: root
volumes:
- /mnt/user/appdata/twenty:/tmp/server-local-data
- docker-data:/tmp/docker-data
- /mnt/user/appdata/twenty/db-data:/tmp/db-data # Add this line
command: >
bash -c "
chown -R 1000:1000 /tmp/server-local-data
&& chown -R 1000:1000 /tmp/docker-data
&& chown -R 1001:1001 /tmp/db-data" # Add this line
change-vol-ownership:
image: ubuntu
user: root
volumes:
- /mnt/user/appdata/twenty:/tmp/server-local-data
- docker-data:/tmp/docker-data
- /mnt/user/appdata/twenty/db-data:/tmp/db-data # Add this line
command: >
bash -c "
chown -R 1000:1000 /tmp/server-local-data
&& chown -R 1000:1000 /tmp/docker-data
&& chown -R 1001:1001 /tmp/db-data" # Add this line
Any advise?
10 Replies
TwoPigs
TwoPigsOP2mo ago
Update - I was able to overide permissions to clear the error. however, the following issue is now present.
postgresql 11:03:46.96 INFO ==> ** Starting PostgreSQL **

2024-10-08 11:03:46.983 GMT [1] FATAL: data directory "/bitnami/postgresql/data" has wrong ownership

2024-10-08 11:03:46.983 GMT [1] HINT: The server must be started by the user that owns the data directory.
postgresql 11:03:46.96 INFO ==> ** Starting PostgreSQL **

2024-10-08 11:03:46.983 GMT [1] FATAL: data directory "/bitnami/postgresql/data" has wrong ownership

2024-10-08 11:03:46.983 GMT [1] HINT: The server must be started by the user that owns the data directory.
charles
charles2mo ago
First time I see this issue and there was no recent change to this section in the docker-compose so I'm a bit surprised. Could you share more about how you are using this docker-compose?
TwoPigs
TwoPigsOP2mo ago
yes. My lab is running on UnRaid with a Compose plugin on top.
charles
charles2mo ago
I think it has something to do with it
charles
charles2mo ago
No description
charles
charles2mo ago
No description
charles
charles2mo ago
this is what I see from the postgres container perspective
charles
charles2mo ago
this is the Dockerfile of twenty-postgres:
No description
charles
charles2mo ago
so I don't know why you have this error, I would investigate what user is running postgres (if it's 1001 indeed) and/or compare what you see doing ls -al from the container perspective to do that you can override the postgres-container run command in your docker-compose to be "tail -f /dev/null" (does nothing but keeps the container open), then ssh into it and check whoami to get the user and run ls -al to check folders ownerhip good luck!
TwoPigs
TwoPigsOP2mo ago
great feedback... thank you. I'll report back with my progress.
Want results from more Discord servers?
Add your server