coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
33.49k stars 1.81k forks source link

[Bug]: Bind source path does not exist (development) #3918

Open peaklabs-dev opened 2 weeks ago

peaklabs-dev commented 2 weeks ago

Error Message and Logs

When deploying a MongoDB on MacOS in development, the following error occurs:

Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /data/coolify/databases/zkgg04owwck0kw00800g84cg/docker-entrypoint-initdb.d

-> I think this only happens on MacOS because of the strict filesystem restrictions, but I could be wrong.

Steps to Reproduce

  1. Create a MongoDB on MacOS
  2. Start it

-> Discord thread: https://discord.com/channels/459365938081431553/1291781262016774198

Coolify Version

v4.0.0-beta.360

Additional Information

I investigated this Bug for a few hours today and found the following things.

https://github.com/coollabsio/coolify/blob/5d62a46a16f252e6ece4d25fe56838e99883d91b/app/Actions/Database/StartMongodb.php#L110-L115

Note I added one more line in addition to the commands to make sure the directory is present: https://github.com/coollabsio/coolify/blob/5d62a46a16f252e6ece4d25fe56838e99883d91b/app/Actions/Database/StartMongodb.php#L28-L31 I added this line to the commands

"mkdir -p $this->configuration_dir/docker-entrypoint-initdb.d/",

Same thing happens for the Postgres config:

Why does the second option work in both cases and not the first? Ofc I could just change it everywhere to the second one which works and call it a day, but I would like to investigate and know why the first option does not seem to work.

djsisson commented 2 weeks ago

@peaklabs-dev i have never used mac os, but does it use docker desktop at all?

if so whats here? Docker Desktop, "Settings > Resources > File sharing > Virtual file shares.

peaklabs-dev commented 2 weeks ago

@djsisson It is a difficult problem (very know if you develop on MacOS). In the file sharing there is nothing (I added nothing, also will not work if you want to add something, so you could not add /data or so that is not possible) see details in my fix that seems to work except for MongoDB: https://github.com/coollabsio/coolify/pull/3542. I also use Orbstack, a much better Docker experience for MacOS people.