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

Rephrase: "Caution: If you on a mac do not clear DATABASE_SERVER #1941

Open
runephilosof-abtion opened this issue Dec 18, 2023 · 3 comments
Open
Assignees

Comments

@runephilosof-abtion
Copy link
Member

\*_Caution: If you on a mac do not clear `DATABASE_SERVER`, you might get a seemingly unrelated: `+[__NSCFConstantString initialize] may have been in progress in another thread...`_

  1. If you on a mac => If you are on a mac,

  2. do not clear DATABASE_SERVER

What does this mean?
What should mac users do, if they run the project entirely local?

@jeppester
Copy link
Contributor

jeppester commented Dec 18, 2023

I am really tired of this line.

The problem is that there is a bug with ruby on M1 macs which causes an error to happen when you connect to a local database with DATABASE_SERVER pointing to local host. Setting it to an empty string circumvents the issue.

I think the workaround works because it will cause ruby to connect to postgres through the socket rather than TCP.
Though I don't understand why connecting through TCP to a container does not trigger the same issue.

I added the line to the README because our devs on mac might face this issue, and it's not obvious at all that it can be circumvented the way it can.

@runephilosof-abtion
Copy link
Member Author

My point is. What does clear mean in this context.
Would that mean removing it from .env.local, and this using the DATABASE_SERVER from .env?
Or does it mean removing it from .env and .env.local, so the environment variable is unset?

I am surprised, if it works on Linux in the "hybrid" setup. Because psql usually connects with sockets when host is set to localhost, which won't work when it is running in a container.
Whereas it will use tcp, if you use 127.0.0.1 as host.

@jeppester
Copy link
Contributor

I am surprised, if it works on Linux in the "hybrid" setup. Because psql usually connects with sockets when host is set to localhost, which won't work when it is running in a container.
Whereas it will use tcp, if you use 127.0.0.1 as host.

It works for me. Maybe because we are also setting a port.
If I remove the line in .env (DATABASE_SERVER="postgresql://postgres@localhost:5432"), then it tries using a socket and fails. The same happens if I change it to DATABASE_SERVER="".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants