Skip to content

[FR] packages.txt in a similar way to plugins.txt #5718

Open

Description

@Petrox

Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find a similar feature request

Problem statement

Some plugins require extra packages installed in the OS.
(eg wirewiz depends on graphviz, which means local customization of the stable docker images)

Suggested solution

It could be done that a file containing the required extra packages could be stored together with the plugins.txt and any packages (at specific versions) would be installed via apt-get before the packages.

Describe alternatives you've considered

Note: while graphviz can be installed via pip (and thus could be in a requirements.txt for the plugin which could be installed by inventree at startup, the generic idea of being able to add common tools (image or document or media conversion from ffmpeg to imagemagick) would open easily accessible possibilities. (And since those packages should be secure-by-default, in theory this should not open attack surfaces)

Examples of other systems

plugins.txt?

Do you want to develop this?

  • I want to develop this.

Activity

  1. added
    enhancement
    triage:not-checked
    on Oct 17, 2023
  2. SchrodingersGat commented on Oct 17, 2023

    @SchrodingersGat
    Member

    @Petrox would be a potential addition, although we would need to carefully consider the security implications.

    Edit: (I was trying to find the previous discussion as mentioned by @matmair below). This would be for a very advanced use case.

  3. added
    docker
    setup
    and removed
    triage:not-checked
    on Oct 17, 2023
  4. matmair commented on Oct 17, 2023

    @matmair
    Member

    We had long discussions between core devs about this already (multiple times), this makes the docker images unstable and hard to debug.

  5. added this to the horizon milestone on Oct 17, 2023
  6. added
    question
    on Oct 17, 2023
  7. removed this from the horizon milestone on Oct 17, 2023
  8. Petrox commented on Oct 17, 2023

    @Petrox
    ContributorAuthor

    Ok, agreed it makes them more fragile, but I see not much difference than installing pip packages.

    Just for reference:

    graphviz is available through pip so it could be set as wireviz plugin dep, installed automatically by pip
    inventree/inventree-wireviz#37

  9. Petrox commented on Oct 17, 2023

    @Petrox
    ContributorAuthor

    @Petrox would be a potential addition, although we would need to carefully consider the security implications.

    From security viewpoint I think it is much easier to distribute malicious pip packages than malicious ubuntu signed packages, but both lists are managed by the admin, so if he installs something that breaks the container, he can just redo it without the broken package.

  10. Petrox commented on Oct 17, 2023

    @Petrox
    ContributorAuthor

    Edit: (I was trying to find the previous discussion as mentioned by @matmair below). This would be for a very advanced use case.

    I don't think trying to use the wirewiz plugin as it is written in the readme is considered a very advanced use case.

    IMHO To have happy endusers plugins should work smoothly out of the box (limited by security ofc, but no containerimage-and-database-restore-process-manipulation-magic should be necessary)

  11. matmair commented on Oct 17, 2023

    @matmair
    Member

    @Petrox I am happy to review a solution with full test coverage and a stable set of e2e tests.
    The burden on a hobby user to execute the necessary steps is small, everything else is probably an enterprise use case. I do not intend to spend time on them for free in my spare time. You are welcome to tough.

  12. wolflu05 commented on Oct 17, 2023

    @wolflu05
    Member

    Related to #3562, but this is not the only discussion about this, I think there is a continuation somewhere else.

  13. 9 remaining items

  14. github-actions commented on Feb 23, 2024

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  15. added
    inactive
    on Feb 23, 2024
  16. SchrodingersGat commented on Feb 26, 2024

    @SchrodingersGat
    Member

    not stale. @Petrox where are you at with this?

  17. removed
    inactive
    on Feb 26, 2024
  18. Petrox commented on Mar 4, 2024

    @Petrox
    ContributorAuthor

    Thx for pinging, I'll create some dockerfiles and a brief description to help new users "mod" their images easily.

  19. github-actions commented on May 4, 2024

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  20. added
    inactive
    on May 4, 2024
  21. Petrox commented on May 9, 2024

    @Petrox
    ContributorAuthor

    I will merge it info https://docs.inventree.org/en/latest/start/docker_install/ after approval, but it's probably easier to just chat about the content here.

    Feel free to comment.

    Inventree Container Customization

    In some cases changing the official docker images might be necessary for additional features. For example the WireWiz Plugin depends on graphviz which is not installed in the official docker images.

    To solve this problem we will create our own inventree images based on a specific inventree image, store it in the local docker image store, and then use it with the normal docker compose instead of the original image.

    You already have a folder with the .env, docker-compose.yml files, so that would be a place for our own Dockerfile:

    ARG sourcetag=stable
    FROM inventree/inventree:$sourcetag
    ARG packagelist
    ENV packages $packagelist
    RUN apt-get update && (for pkg in $packages ; do echo "Installing apt-get install $pkg"; apt-get install $pkg -y ; done) || (apk update ; for pkg in $packages ; do echo "Installing apk add $pkg"; apk add $pkg ; done )

    To make it more flexible, this Dockerfile needs two parameters: sourcetag a tag from docker hub and a list of packages to install.

    Note: while the new images are minimal alpine based images the older inventree versions were built on debian based images, and there might be situations where it is beneficial, so the above script tries to install the packages with apt-get and then with apk (the alpine package manager).

    To build our image with graphviz and lsof extra packages:

    sourcetag="0.14.3"
    docker build . --build-arg sourcetag=$sourcetag --build-arg "packagelist=graphviz lsof" -t inventree/inventree:custom-$sourcetag -t inventree/inventree:custom

    Then edit your .env file:

    INVENTREE_TAG=custom-0.14.5

    Note: we don't use docker push since we don't want to upload our modded images anywhere right now (and luckily we are not authorized to push an image to the official repo), so it will stay just in the docker hosts image file cache. It is not an issue, since we can recreate the images should we have to.

    Note: it's best to use a specific version rather than "stable", since then you will build 0.14.3, 0.14.4, 0.14.5 images independently and can upgrade and maybe roll back to previous versions.

    Upgrading versions quickly

    A good practice is to have a staging environment running on the same host (with just a little change in the .env file) and the staging system could be updated with the production database, upgraded to any new version and when it is proven to work properly the production system can be upgraded nearly instantly since the image is already there.

    Of course maintaining a production system means you must make backups often and store it remotely.

    If you plan to switch inventree versions quickly, you might want to use a version independent (inventree/inventree:custom) tag in your .env file:

    INVENTREE_TAG=custom

    Then you might run this to upgrade to any specific version:

    sourcetag=0.14.5
    docker compose down
    docker build . --build-arg sourcetag=$sourcetag --build-arg "packagelist=graphviz mc lsof" -t inventree/inventree:custom-$sourcetag -t inventree/inventree:custom
    docker compose run inventree-server invoke migrate
    docker compose down
    docker compose up
  22. removed
    inactive
    on May 10, 2024
  23. github-actions commented on Jul 9, 2024

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  24. added
    inactive
    on Jul 9, 2024
  25. added this to the horizon milestone on Jul 27, 2024
  26. matmair commented on Apr 16, 2025

    @matmair
    Member

    @SchrodingersGat is this still in scope?

  27. SchrodingersGat commented on Apr 16, 2025

    @SchrodingersGat
    Member

    I think it makes sense. Certain plugins (e.g wireviz) will require extra packages to function on the docker image

  28. matmair commented on Apr 23, 2025

    @matmair
    Member

    I do not see how this can be done without impacting stability but intrigued about the solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dockerenhancementinactivequestionsetup

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions