netbox-community / netbox-topology-views

A netbox plugin that draws topology views
Apache License 2.0
731 stars 63 forks source link

Docker compose build not working after following instructions to add plugin #399

Closed leijonatm closed 11 months ago

leijonatm commented 11 months ago

NetBox version

v3.6.3

Topology Views version

v3.7.0

Steps to Reproduce

  1. On a working netbox docker deployment run docker compose down
  2. In the root folder touch plugin_requirements.txt Dockerfile-Plugins docker-compose.override.yml

% cat plugin_requirements.txt netbox_topology_views

% cat Dockerfile-Plugins FROM netboxcommunity/netbox:latest COPY ./plugin_requirements.txt /opt/netbox/ RUN /opt/netbox/venv/bin/pip install --no-warn-script-location -r /opt/netbox/plugin_requirements.txt COPY configuration/configuration.py /etc/netbox/config/configuration.py COPY configuration/plugins.py /etc/netbox/config/plugins.py COPY ./netbox_topology_views/static/netbox_topology_views /opt/netbox/netbox/static/netbox_topology_views RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input

% cat docker-compose.override.yml version: '3.4' # This is NOT the version of NetBox! No need to adjust :) services: netbox: image: netbox:latest-plugins ports:

  • 8000:8080 build: context: . dockerfile: Dockerfile-Plugins netbox-worker: image: netbox:latest-plugins build: context: . dockerfile: Dockerfile-Plugins netbox-housekeeping: image: netbox:latest-plugins build: context: . dockerfile: Dockerfile-Plugins

Expected Behavior

Visiting the topology views would show up something

Observed Behavior

docker build fails

% docker compose build --no-cache [+] Building 0.0s (2/2) FINISHED docker:desktop-linux => [netbox internal] load build definition from Dockerfile-Plugins 0.0s => => transferring dockerfile: 730B 0.0s => [netbox internal] load .dockerignore 0.0s => => transferring context: 162B 0.0s failed to solve: dockerfile parse error on line 11: unknown instruction: /opt/netbox/netbox/manage.py

mattieserver commented 11 months ago

Can you make sure that the following is in a single line, its not clear due to the formatting:

RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
leijonatm commented 11 months ago

Hello @mattieserver and thanks for the reply. It was a new line indeed as I copy pasted it but came across another problem ....

% docker compose build --no-cache [+] Building 2.3s (10/11) docker:desktop-linux => [netbox internal] load .dockerignore 0.0s => => transferring context: 162B 0.0s => [netbox internal] load build definition from Dockerfile-Plugins 0.0s => => transferring dockerfile: 729B 0.0s => [netbox internal] load metadata for docker.io/netboxcommunity/netbox:latest 2.2s => CACHED [netbox 1/7] FROM docker.io/netboxcommunity/netbox:latest@sha256:f5a3f169c4b8c68e147ae18a1c4c52c14151a94df445b35b9ae780c02598613d 0.0s => [netbox internal] load build context 0.0s => => transferring context: 278B 0.0s => CACHED [netbox 2/7] COPY ./plugin_requirements.txt /opt/netbox/ 0.0s => CACHED [netbox 3/7] RUN /opt/netbox/venv/bin/pip install --no-warn-script-location -r /opt/netbox/plugin_requirements.txt 0.0s => CACHED [netbox 4/7] COPY configuration/configuration.py /etc/netbox/config/configuration.py 0.0s => CACHED [netbox 5/7] COPY configuration/plugins.py /etc/netbox/config/plugins.py 0.0s => ERROR [netbox 6/7] COPY ./netbox_topology_views/static/netbox_topology_views /opt/netbox/netbox/static/netbox_topology_views 0.0s

[netbox 6/7] COPY ./netbox_topology_views/static/netbox_topology_views /opt/netbox/netbox/static/netbox_topology_views:

failed to solve: failed to compute cache key: failed to calculate checksum of ref b114dfc0-a7e5-42b2-aeb4-35ad2419293e::1es7yymerctke41agu5imu3oc: "/netbox_topology_views/static/netbox_topology_views": not found

leijonatm commented 11 months ago

So I downloaded the ZIP code and extracted it. Then took the netbox_topology_views folder from within the netbox_topology_views root folder and copied it inside the netbox-docker folder and docker compose build --no-cache works fine. I also altered the configuration/configuration.py to enable the plugin.

I now am able to see the topology views side menu although I only see a white screen @mattieserver

mattieserver commented 11 months ago

Have you tried just following the steps on https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins? The COPY ./netbox_topology_views/static/netbox_topology_views /opt/netbox/netbox/static/netbox_topology_views is not needed.

leijonatm commented 11 months ago

Don't remember where I got this version of Dockerfile-Plugins but even now that I changed to the link you suggested before I get the same behavior.

  1. I have created via touch the three files
  2. copied the contents of the files as is from the instructions and although I had my doubts I have tried netbox topology views with both hyphen (-) and underscore (_)
  3. Edit the configuration.py file to include the PLUGIN as PLUGINS = ["netbox_topology_views"]
  4. docker compose build --no-cache
  5. docker compose up -d

but nothing changes.

leijonatm commented 11 months ago

When visiting the topology views menu the URL changes to http://127.0.0.1:8000/plugins/netbox_topology_views/topology/?draw_init=false.

Is the last bit correct been false ?

leijonatm commented 11 months ago

At this point let me say that I have routers, switches and other devices added to netbox together with cabling between them. Is topology views looking for something else ?

mattieserver commented 11 months ago

When visiting the topology views menu the URL changes to http://127.0.0.1:8000/plugins/netbox_topology_views/topology/?draw_init=false.

Is the last bit correct been false ?

Yes, unless you configure it otherwise.

leijonatm commented 11 months ago

I didn’t make any configurations altogether. How can I troubleshoot it ? Any pointers as to why I see empty screen ?

Εστάλη από Outlook για iOShttps://aka.ms/o0ukef


Από: mattieserver @.> Στάλθηκε: Wednesday, October 4, 2023 6:10:18 PM Προς: mattieserver/netbox-topology-views @.> Κοιν.: leijonatm @.>; Author @.> Θέμα: Re: [mattieserver/netbox-topology-views] Docker compose build not working after following instructions to add plugin (Issue #399)

When visiting the topology views menu the URL changes to http://127.0.0.1:8000/plugins/netbox_topology_views/topology/?draw_init=false.

Is the last bit correct been false ?

Yes, unless you configure it otherwise.

— Reply to this email directly, view it on GitHubhttps://github.com/mattieserver/netbox-topology-views/issues/399#issuecomment-1747017711, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALHKHP76QYX4DMNMCPKNY4LX5V35VAVCNFSM6AAAAAA5PHS5HSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGAYTONZRGE. You are receiving this because you authored the thread.Message ID: @.***>

dreng commented 11 months ago

Enable the checkbox "Show unconnected", just in case...

We are not able to see what exactly you did in your environment. That makes it impossible to give good hints. It's all about guessing at the moment.

mattieserver commented 11 months ago

Did you specify any filters? On the topology page you should have the option to select a few options.

dreng commented 11 months ago

@mattieserver Good point. I've heard here and there that people expect the canvas to show anything when the topology view has been opened from the menu. Sometimes they don't realise on their own that the search button in the filters has to be clicked first. Maybe we should show a hint text or something when the option "draw_init=false" is set.

leijonatm commented 11 months ago

@mattieserver you are right, I hadn't specified any filters. As a new user of the plugin I also though that everything would show up and then I would apply the filters to a view of my needs. That's another option to what @dreng suggested.

Thank you both for your replies.