netbox-chart icon indicating copy to clipboard operation
netbox-chart copied to clipboard

Not able to get the Plugins Custom image to work

Open viperbmw opened this issue 11 months ago • 1 comments

          > @manusys64 One way how you can install the plugins is to create custom Netbox Docker image.

Example of Dockerfile config :

FROM netboxcommunity/netbox:v3.5.1

RUN 
    echo "netbox-plugin-dns" >> requirements.txt && \
    echo "netbox-plugin-dns" >> local_requirements.txt 

RUN . /opt/netbox/venv/bin/activate && \
    pip install netbox-plugin-dns 

RUN echo "PLUGINS = [ 'netbox_dns'']" >> /opt/netbox/netbox/netbox/configuration.py

Add reference to the custom Dockerfile in Helm chart :

netbox:
  commonValue:
  image:
    repository: YOUR_REPOSITORY
    tag: "IMAGE_TAG"

Do not add 'netbox_dns' into plugins section of Helm chart, keep it empty, do it in Dockerfile

I have tried to use this Dockerfile to build a custom image.

FROM netboxcommunity/netbox:latest
RUN echo "netbox-secrets" >> requirements.txt && \
    echo "netbox-secrets" >> local_requirements.txt \
    echo "netbox-topology-views" >> requirements.txt && \
    echo "netbox-topology-views" >> local_requirements.txt \
    echo "netbox-bgp" >> requirements.txt && \
    echo "netbox-bgp" >> local_requirements.txt
RUN . /opt/netbox/venv/bin/activate && pip install netbox-secrets netbox-topology-views netbox-bgp
RUN mkdir -p /opt/netbox/netbox/static/netbox_topology_views/img
SHELL ["/bin/bash", "-c"]
RUN echo $'\n\
PLUGINS = ["netbox_secrets", "netbox_bgp","netbox_topology_views"]\n\
PLUGINS_CONFIG = {\n\
    \'netbox_topology_views\': {\n\
        \'static_image_directory\': \'netbox_topology_views/img\',\n\
        \'allow_coordinates_saving\': True,\n\
        \'always_save_coordinates\': True\n\
    }\n\
}' >> /opt/netbox/netbox/netbox/configuration.py
RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input

When I try to use the custom image in the Helm Chart I get

/opt/netbox/docker-entrypoint.sh: line 20: ./manage.py: No such file or directory
[ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
⏳ Waiting on DB... (18s / 30s)

What am I doing wrong?

When using the image in docker compose it works.........

Originally posted by @viperbmw in https://github.com/bootc/netbox-chart/issues/173#issuecomment-2012760730

viperbmw avatar Mar 21 '24 16:03 viperbmw

In the next weeks I'll start developing a custom image: if I can make it work, I am going to share here what I found :)

elmazzun avatar Apr 18 '24 15:04 elmazzun

https://github.com/netbox-community/netbox-docker/issues/1249 seems to be related

danielskowronski avatar Jun 06 '24 22:06 danielskowronski

Closing as related issue closed. If there is still an issue regarding image build, please open an issue on https://github.com/netbox-community/netbox-docker.

LeoColomb avatar Jun 13 '24 16:06 LeoColomb