Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a different username on the image fails #679

Open
2 tasks done
maxboone opened this issue Jun 26, 2023 · 1 comment
Open
2 tasks done

Setting a different username on the image fails #679

maxboone opened this issue Jun 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@maxboone
Copy link

maxboone commented Jun 26, 2023

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When a different username is passed using POSTGRES_USER the container will exit as the user doesn't exist:

docker run \        
-e POSTGRES_PASSWORD=custom \
-e POSTGRES_USER=custom \
-e POSTGRES_DB=custom \
supabase/postgres
...
server started
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "custom"
[local] 2023-06-26 10:09:42.844 UTC [68] custom@postgres LOG:  provided user name (custom) and authenticated user name (postgres) do not match
[local] 2023-06-26 10:09:42.844 UTC [68] custom@postgres FATAL:  Peer authentication failed for user "custom"
[local] 2023-06-26 10:09:42.844 UTC [68] custom@postgres DETAIL:  Connection matched pg_hba.conf line 83: "local  all  all    peer"
Error: exit status 2

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

docker run \      
-e POSTGRES_PASSWORD=custom \
-e POSTGRES_USER=custom \
-e POSTGRES_DB=custom \
supabase/postgres

Expected behavior

Database & user are created with passed environment variables

Screenshots

NA

System information

NA

Additional context

NA

@maxboone maxboone added the bug Something isn't working label Jun 26, 2023
@maxboone
Copy link
Author

maxboone commented Jun 26, 2023

Main difference that "causes" this is that the base image doesn't use peer authentication for local executed commands, but rather trusts anything that comes from the unix domain.

Possible fix would be to add something in the entrypoint that appends the postgres$POSTGRES_USER mapping to pg_ident if $POSTGRES_USER != postgres. I'd gladly write this and do a PR but not sure if opinions differ on that approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant