Closed IlanVivanco closed 3 years ago
Thanks for checking out the project, @IlanVivanco! And, for sharing this method for mounting!
Do you encounter any issues with file permissions using this, ie if you edit, does it keep the root:root
ownership within the container's files? If you do some editing of those mounted files from within the container, will that set incorrect permissions on the host?
I imagine this will work fine across all platforms, as Windows users seem to use Docker in a way that uses unix-style filepaths, but I'm not 100% sure on that.
I'd like not to force share any access to host's files by default, but can see this being an big need for anyone doing plugin/theme development, like you (and me, but I don't do any syncing as yet, I can get away with small edits with Vim within the container, but would definitely use a mounting option if available!). There is an issue/feature request to add a browser-based code editor, which will be nice for some users, but in your case, you may want to sync same dir to say a PHP7 and PHP8 container or a whole bunch of containers with different WP configs simultaneously.
A few ideas of approach:
$HOME/.lokl
dir, containing confs for different sites, which you could choose to launch from in the wizard, if it detects that dir exists, presenting templates to choose fromNot exclusive options, I still want Lokl to be as simple as possible for users who don't want to touch any code/config files.
Note, please be aware of a pretty severe issue (with workaround) reported in Lokl here that you may encounter soon.
Hey @leonstafford, I'm really sorry I missed this notification.
Do you encounter any issues with file permissions using this, ie if you edit, does it keep the root:root ownership within the container's files? If you do some editing of those mounted files from within the container, will that set incorrect permissions on the host?
I haven't had any issues so far.
I imagine this will work fine across all platforms, as Windows users seem to use Docker in a way that uses unix-style filepaths, but I'm not 100% sure on that.
That is correct, I'm using WSL2 and Docker for Windows. But the containers basically run on the Ubuntu 20.04 side. You can run Docker directly from Windows, but I have no experience with that I'm afraid.
I'd like not to force share any access to host's files by default, but can see this being an big need for anyone doing plugin/theme development, like you (and me, but I don't do any syncing as yet, I can get away with small edits with Vim within the container, but would definitely use a mounting option if available!). There is an issue/feature request to add a browser-based code editor, which will be nice for some users, but in your case, you may want to sync same dir to say a PHP7 and PHP8 container or a whole bunch of containers with different WP configs simultaneously.
I don't hate this idea, but that only would work for quick changes/tweaks. I don't think it'll be reliable for long-term development.
Last, but not least, the idea of a templating system seems like a good approach to me.
Hola @IlanVivanco~ No worries re timing - I miss/delay a lot of comms.
Great feedback and templating seems certainty to get built in! If you have time/interest, I'm happy to let you build it - my main constraint I'd like to keep is no requirement to do anything else on the host system, so if it can allow current workflow to continue for other users, but provide that great functionality for others, that would be awesome!).
Doesn't have to do all the magic for first iteration, just allowing to mount volumes if template is detected (maybe global vs site-specific rules in tpl?). Things like specifying ports, plugins, themes, integration with wizard, etc could be incremental improvements later).
Also, no pressure at all, I'm happy to work on this, just can't guarantee how soon I'll get to it. I can definitely help test/feedback.
Unfortunately, I don't have the time available now. But I'll be watching your progress and ping you if I manage to free my calendar.
@IlanVivanco, @mtplr, I aim to get at least a simple version of this functionality done quite soon, as I am in need of it myself for some projects. Will update when ready to test!
Thinking out loud...
In my case and for plugin/theme devs, they may want to spin up multiple sites with same development files mounted.
From Docker Volumes page:
If your container generates non-persistent state data, consider using a tmpfs mount to avoid storing the data anywhere permanently, and to increase the container’s performance by avoiding writing into the container’s writable layer.
This may be important consideration, as we're going to have a bunch of Composer or Node packages (re)generating on the host...
looked at a yaml parser for bash, but not POSIX friendly enough, so creating own simple templating system for now.
tmpfs mounting has limitations, limited to Linux, so will use regular volume mounts
making some progress:
Lokl Site Templates Found
Please choose one to use for this site:
1) default
2) php8-with-all-plugins-mounted
This is now working quite well for mounting volumes from a chosen template file.
Will sync with the leonstafford/lokl
repo and release in version 5.0.0 soon.
This is released now in 5.0.0. Please give it a try and let me know any issues:
It'll be ideal to be able to mount volumes to an instance for developing themes/plugins locally.
There is no option on the CLI yet, but I was able to do it manually using the Lokl image.