I was able to get this working today. It only took two changes.
Here's my setup and use case:Git clones of the contributed projects I have ever worked on live on my computer (MacOS) at ~/_backdrop/_contributions
. When I am working on one of these modules from an active development site, I remove the module from that site's codebase, and replace it with a symlink to the git clone of contrib:
rm -r metatag
ln -s ~/_backdrop/_contributions/metatag
Then I do all the work for metatag on the site where I had the problem or want the feature, until I'm done. At this point I have a patch/PR (or new release) for the module. So I restore the previous module to the site, apply the patch (or update to the lates version), and commit the change.
rm metatag
git checkout metatag
patch -p1 metatag < diff.patch
git add ../PATCHES.txt metatag
git commit -m "Applied metatag patch and documented patched module."
I love this workflow as it allows me to keep my project work from my community work, but still bring the two together when needed (without needing to remember to copy files from place to place)
In this case, my contributed projects ~/_backdrop/_contributions
are never going to be "inside" a ddev project, but they can be available to all of them.
1 Add a post-start hook to create an identical path inside ddev as outside.
On ddev my first directory is /home
and on MacOS it was /Users
. After that, the paths are identical.
hooks:
post-start:
- exec: sudo ln -s /home /Users;
2 mount the contributed directory as a volume inside Docker:
I created a new file named docker-compose.mounts.yaml
and added the following
services:
web:
volumes:
- "$HOME/_backdrop/_contributions:/Users/jenlampton/_backdrop/_contributions"
Then I did a ddev restart
and now I can add a symlink on my workstation that is copied via mutagen into docker, and it still works!
To test that you got the paths right, change into the destination directory in terminal cd /Users/jenlampton/_backdrop/_contributions
and make sure you are in the right place. Then use the exact same command on the ddev container and make sure you can see the same files: cd /Users/jenlampton/_backdrop/_contributions
.
If so, profit.