compose plugin - placeholder expansion for shared folders etc

  • I read the change log for the last couple of .dot releases of the compose plugin and there are now placeholder expansions for shared folders, user, group and tz (e.g. ${{ uid:"user" }})


    What are they and how/when i would use them (if at all)?


    ryecoaaron - can you provide a quick explanation when you have a minute please?

    OMV 8 (latest) on N100 minipc (16GB) and rpi5 (8GB). OS on SSD/SD. System ext4 on SSD. Data BTRFS on HDDs

    • Official Post

    can you provide a quick explanation when you have a minute please?

    chente was going to write up a guide but they are pretty simple.


    Often, people user a variable from the env file or global env file to replace. you user ${uid} in those cases. That limits you to one user and isn't dynamic nor readable without looking at the env file. So, I added variables that look up the current value when writing the file.


    If you want to use a shared folder named music for a path in your compose file, you would put ${{ sf:"music" }} where you wanted that path.


    if you want to put a user named aaron's uid in your compose file, you would put ${{ uid:"aaron" }} where you would normally put the user's id (or a variable from the env file)


    if you want to put the users group's gid in your compose file, you would put ${{ gid:"users" }} where you would normally put the group's id (or a variable from the env file)


    if you want to put the timezone of the system in the compose file, you would put ${{ tz }} in place of something like "America/Chicago".


    The string looks complicated because the search and replace code has to be very sure that the string is not something the user wants in the code and not replaced.


    I'm sure chente will explain this better than I am.

    omv 8.0.10-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.4 | cterm 8.0 | borgbackup 8.1.6 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Official Post

    The "Docker in OMV" document for OMV8 is in progress; I'm already modifying it to reflect these changes. The global variables section is being removed from the workflow due to these substitutions; I'll include it as a separate section at the end for advanced configurations. This is what I have so far. https://wiki.omv-extras.org/do…ustomize_the_compose_file

  • Thanks both. This is very helpful and a nice feature. I currently use global environment variables so will switch over to this new approach

    OMV 8 (latest) on N100 minipc (16GB) and rpi5 (8GB). OS on SSD/SD. System ext4 on SSD. Data BTRFS on HDDs

    • Official Post

    I have to say, this change was a great idea from Aaron. It greatly simplifies the process of creating a Compose file and its subsequent maintenance.

    • Official Post

    I just moved the Docker Document in OMV from "Documents in progress" to its final location --> https://wiki.omv-extras.org/doku.php?id=omv8:docker_in_omv


    The document now reflects the new workflow, taking into account the substitutions the plugin can now make. I've finally removed the explanations about global environmental variables entirely. Since it is no longer necessary, I prefer not to be forced to maintain that text.


    I've rewritten quite a few parts; I would appreciate help in identifying and correcting any errors.

    • Official Post

    would appreciate help in identifying and correcting any errors.

    I went over it pretty fast but it looks good. You describe the substitution variables well.

    omv 8.0.10-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.4 | cterm 8.0 | borgbackup 8.1.6 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • chente - this is a very good and thorough guide for docker in OMV. Top work and thanks for all the work you do on the docs and supporting the community etc.!


    I used an earlier version of the guide a few years ago when I first started using docker in OMV and it helped me then and today I learnt something new.


    I note that the guide now uses the appdata shared folder for compose and persistent storage. I think this makes it slightly easier for new users but I prefer a separate compose and appdata (persistent data) shared folders as if/when you need to build an image, you often need quite a lot of extra files/folders within the compose folder and it could get tricky with permissions etc.


    You have done well to explain the permissions implications if you combine compose and persistent data. I have a few containers that do not have/use a config sub folder. I know it is easy to add this to the path on the host side but, for new users, I think many will follow the documentation on the interweb and this might cause permissions issues.


    Really good explanation of substitution variables. I am going to migrate all my contains to this approach.


    Given the new feature of substitution variables, the CHANGE_TO_COMPOSE_DATA_PATH is more or less redundant. I would consider making this point in the guide.

    OMV 8 (latest) on N100 minipc (16GB) and rpi5 (8GB). OS on SSD/SD. System ext4 on SSD. Data BTRFS on HDDs

    • Official Post

    the CHANGE_TO_COMPOSE_DATA_PATH is more or less redundant. I would consider making this point in the guide.

    It can still serve a purpose. If you use it in all of your compose files, you can move every instance with one shared folder change on the Settings tab. There is almost no work to keep it in the plugin. So, it will just stay an option.

    omv 8.0.10-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.4 | cterm 8.0 | borgbackup 8.1.6 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Sure. Wasn’t suggesting to remove the functionality. My post was unclear.


    What I meant was to add an additional point in that section of the guide saying to refer to substitute variables for another way to add flexibility and to simplify mapping volumes.


    And I see what you mean about one change working across multiple containers now. I do the same using symlinks so I will need to think through switching everything to substitute vars

    OMV 8 (latest) on N100 minipc (16GB) and rpi5 (8GB). OS on SSD/SD. System ext4 on SSD. Data BTRFS on HDDs

    • Official Post

    Good observation :thumbup:


    Regarding permissions, this is why the guide insists that each mapped volume should always point to a subfolder, never to the root of a shared folder. This is the only real precaution needed to avoid permission issues, and it is explicitly stated in the documentation.

    If a container does not define a configuration subfolder by default, it is simply a matter of adding one to the host path, as you mentioned.


    As for flexibility in volume mapping, I completely agree. The plugin’s substitution variables greatly simplify configuration and make it easier to adapt compose files to different systems without structural changes.

    In the guide, I chose to present a single, clear, and proven method to avoid mixing approaches and confusing new users, but that additional level of flexibility is there for anyone who wants to take advantage of it.


    Thanks for the feedback and for sharing your experience.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!