Weird symlink behavior


#1

Hi,

I’ve been having some issues with setting up devilbox after migrating to windows from debian.
On my linux system I had my projects stored in /home/www and symlinked into the devilbox data directory. After adding $HOME:$HOME volumes settings into docker-compose.override.yml it worked flawlessly.

Now, on windows I have a different setup (duh):

  1. My projects are located in: Y:\projects\project
  2. Devilbox is located in Y:\devilbox (data folder Y:\devilbox\data\www, so default)
  3. I’m using WSL and it’s set up so the windows disks mount in /, so /c /y etc. This translates the two locations above to /y/projects/project and /y/devilbox
  4. I’ve added volumes to the PHP container, so the /y directory is mapped to /y in the shell.
  5. I’ve added symlinks (in WSL): ln -s /y/projects/project/web /y/devilbox/data/www/project/htdocs

Now what happens, is that after checking in the container shell, the symlink /shared/httpd/project/htdocs is red (points to nowhere), even though the path /y/projects/project exists in the shell (due to volume mapping).
What I’ve tried is creating the symlink while in the container’s shell -> it does work, BUT it’s not stable. For some reason, the php script in my project cannot open the log file (located in /y/projects/project/var/logs/dev.log and yes, it’s there).

Any ideas on what might be the problem?

[EDIT]
Just found about about this thread -> https://github.com/docker/for-win/issues/2005
That’s the same issue I’m having, looks totally docker related.

Regards,
Alex


#2

Hi @aowrew instead of symlinking your projects, can you try to set the Devilbox datadir to Y:\projects instead.

https://devilbox.readthedocs.io/en/latest/howto/devilbox/move-projects-to-different-directory.html#howto-move-projects-to-a-different-directory

That would eliminate the need for symlinks alltogether.


#3

Also regarding Symlinks and Windows (if using Docker Toolbox) have a look at this article:

https://devilbox.readthedocs.io/en/latest/howto/docker-toolbox/docker-toolbox-and-the-devilbox.html#howto-docker-toolbox-and-the-devilbox-windows-symlinks


#4

Thanks for your reply. I have tried your idea, but this still doesn’t work. What I’ve done:

  1. Set datadir to Y:\projects (intranet correctly picks up site as project.local)
  2. Set docroot dir to web (since this is a symfony app and we’re not symlinking)
  3. Mounting /y:/y in the php container and httpd

From the link https://github.com/docker/for-win/issues/2005 - it turns out that php-fpm somehow can’t find files in the container on concurrent requests when WSL is involved. The workaround is to limit the process max_children to 1 does work, but unbearably slows down app.

I’ve tried skipping WSL at all, so tried running docker-compose from powershell and setting datadir to Y:\projects - the site is accessible, but the problem with fpm seems to remain - files cannot be found leading to random “file not found” errors in PHP like in the attached image -

.

This all leads me to believe this is not a WSL problem, but windows mounted volumes and php-fpm conflict?