Giter VIP home page Giter VIP logo

netbox-docker's People

Contributors

alarriol avatar begblev avatar calmyournerves avatar cimnine avatar comphilip avatar danmark avatar devon-mar avatar eemil avatar grokzen avatar jeremystretch avatar kr3ator avatar lbegnaud avatar majesticfalcon avatar marchagen avatar misazr avatar mryauch avatar neodymiumferbore avatar nepeat avatar ninech-bot avatar renovate-bot avatar renovate[bot] avatar robellegate avatar robinbeismann avatar rsp2k avatar ryanmerolle avatar sdktr avatar thde avatar thomas-mc-work avatar timrabl avatar tobiasge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netbox-docker's Issues

Cannot visualize topography maps

access netbox, go to admin, topology maps, create new map with device pattern: *

I then try accessing the map and get:

There was an error generating the requested graph. Ensure that the GraphViz executables have been installed correctly.

The url looks like: http://internal-docker:8777/api/extras/topology-maps/1/render/

Expected Behavior

See a topology map
...

Debug Information

The output of docker-compose version:

docker-compose version 1.22.0, build f46880fe
docker-py version: 3.4.1
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.1.0f 25 May 2017

The output of docker version:

Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:10:54 2017
OS/Arch: linux/amd64

Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:10:54 2017
OS/Arch: linux/amd64
Experimental: false

The output of git rev-parse HEAD: 81f8c7386d430358aa0f140f3d3e6a188cf9a47e
The command you used to start the project: As detailed here: https://github.com/ninech/netbox-docker#quickstart

The output of docker-compose logs netbox:
https://gist.github.com/ovizii/575c37b4a815bf5997592682bbfeee52

v2.3.1 - Multiple Issues

Im trying to run v2.3.1. However, Im facing multiple issues.
In short when i docker-compose up 3 containers fail/stop - netbox_1, netbox-worker_1 and nginx.

Going through your troubleshooting guide, and from the logs I can see:

netbox-docker_nginx_1 exited with code 0
...
netbox-worker_1  | Unknown command: 'rqworker'
netbox-worker_1  | Type 'manage.py help' for usage.
netbox-docker_netbox-worker_1 exited with code 1
...
netbox_1         | Running migrations:
netbox_1         |   No migrations to apply.
netbox_1         | 💡 Username: admin, E-Mail: [email protected], Password: admin, Token: 0123456789abcdef0123456789abcdef01234567
netbox_1         | /opt/netbox/docker-entrypoint.sh: line 44: /opt/netbox/startup_scripts/*.py: No such file or directory
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/*.py'
netbox-docker_netbox_1 exited with code 1

Can you provide any advice on how to fix these issues. As Im not sure what/how to to rebuild etc.
Furthermore, Ive not found anything to explain why the nginx is crashing(?).

Many Thanks.....

502 Bad Gateway

I am getting an issue that looks like issue #13 Bad Gateway. When I do 'docker-compose up -d'
The netbox-worker container exits with Exit 1. The error in logs says that the configuration file is not present. The netbox-worker log explicitly states that the Configuration file is not present.

docker-compose logs -f netbox-worker
Output of docker-compose logs -f netbox-worker

netbox-worker_1 | File "/opt/netbox/netbox/netbox/settings.py", line 14, in <module> netbox-worker_1 | "Configuration file is not present. Please define netbox/netbox/configuration.py per the documentation." netbox-worker_1 | django.core.exceptions.ImproperlyConfigured: Configuration file is not present. Please define netbox/netbox/configuration.py per the documentation. netboxdocker_netbox-worker_1 exited with code 1

I tried changing versions to 2.4.4 using an environmental variable but I ran into the same issue.

Debug Information

docker-compose version

[root@docker netbox-docker]# docker-compose version

docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 3.4.9
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017

docker version

[root@docker netbox-docker]# docker version

Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-74.git6e3bb8e.el7.centos.x86_64
Go version: go1.9.4
Git commit: 6e3bb8e/1.13.1
Built: Tue Aug 21 15:23:37 2018
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-74.git6e3bb8e.el7.centos.x86_64
Go version: go1.9.4
Git commit: 6e3bb8e/1.13.1
Built: Tue Aug 21 15:23:37 2018
OS/Arch: linux/amd64
Experimental: false

git rev-parse HEAD

[root@docker netbox-docker]# git rev-parse HEAD

HEAD 968bb9f10fb6440cd319642037e71e0a678594a1

docker-compose up -d

[root@docker netbox-docker]# docker-compose up -d

netboxdocker_postgres_1 is up-to-date 
netboxdocker_redis_1 is up-to-date 
Starting netboxdocker_netbox-worker_1 ... done 
netboxdocker_netbox_1 is up-to-date 
netboxdocker_nginx_1 is up-to-date

docker-compose ps

[root@docker netbox-docker]# docker-compose ps

Name Command State Ports
netboxdocker_netbox- python3 /opt/netbox/netbox Exit 1
worker_1 ...
netboxdocker_netbox_1 /opt/netbox/docker-entrypo Up
...
netboxdocker_nginx_1 nginx -c /etc/netbox-nginx Up 80/tcp,
... 0.0.0.0:32773->8080/tcp
netboxdocker_postgres_1 docker-entrypoint.sh Up 5432/tcp
postgres
netboxdocker_redis_1 docker-entrypoint.sh sh -c Up 6379/tcp

docker-compose logs -f nginx

[root@docker netbox-docker]# docker-compose logs -f nginx

Attaching to netboxdocker_nginx_1
nginx_1 | 2018/09/13 02:24:18 [notice] 1#1: using the "epoll" event method
nginx_1 | 2018/09/13 02:24:18 [notice] 1#1: nginx/1.15.3
nginx_1 | 2018/09/13 02:24:18 [notice] 1#1: built by gcc 6.4.0 (Alpine 6.4.0)
nginx_1 | 2018/09/13 02:24:18 [notice] 1#1: OS: Linux 3.10.0-862.11.6.el7.x86_64
nginx_1 | 2018/09/13 02:24:18 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
nginx_1 | 2018/09/13 02:24:18 [notice] 1#1: start worker processes
nginx_1 | 2018/09/13 02:24:18 [notice] 1#1: start worker process 5
nginx_1 | 2018/09/13 02:48:10 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.181, server: , request: "GET / HTTP/1.1", upstream: "http://172.18.0.5:8001/", host: "192.168.1.34:32773"
nginx_1 | 2018/09/13 02:48:10 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.181, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://172.18.0.5:8001/favicon.ico", host: "192.168.1.34:32773", referrer: "http://192.168.1.34:32773/"

No assets loading

Current Behavior

Netbox is set up via the docker instance and I am loading the home/index page for the first time but all of the assets (css/js) give a 404

Expected Behavior

The assets to give a 200 and actually be served

Debug Information

The output of docker-compose version: docker-compose version 1.8.0, build unknown docker-py version: 1.9.0 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
The output of docker version: `Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:11:19 2017
OS/Arch: linux/amd64

Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:09:53 2017
OS/Arch: linux/amd64
Experimental: false`

stdout: https://gist.github.com/kyleratti/4c4add3ee72b4ef8bbbd05cd907996d3
stderr: https://gist.github.com/kyleratti/85389a5ca5861c52c107859b97f5d263

netbox-error

custom field filterable is broken

Current Behavior

The field filterable is not working as expected. Currently it accepts a true/false bool but inside netbox it has changed to a PositiveSmallInteger field. No matter what value is set in the custom fields .yml file, it will default to FILTER_LOOSE

CustomField model https://github.com/digitalocean/netbox/blob/develop/netbox/extras/models.py#L86

choices constants defentiion https://github.com/digitalocean/netbox/blob/develop/netbox/extras/constants.py#L33

I am running on Netbox tag 2.3.2

...

Expected Behavior

This field must be possible to set or to disable. It matters less the choice between loose/exact, but more that i can disable the field for filtering, but that is not possible right now.

Possible solution

I am not sure how to really change this. I see 2 possible solutions

# 1. in the yaml file use one variable to define the filter logic state. It is nice to have one variable, but not clean to mix string/boolean values in the same variable.
...
filter_logic: loose / exact / false
...
# OR
...
filter_logic: loose / exact / disabled
...
2. In the yaml file use 2 variables, one to controll if the field should be filterable, and one the controlls the logic part.
...
filterable: true / false
filter_logic: loose / exact

Allowed_hosts format

I played around with this a bit

We have a single reverse proxy for our internal sites so I brought up a separate VM, built out this three-container setup and got it working. I then ran into some issues trying to have it accessible from behind the second layer of nginx. What I found was that I had no idea how to set the environment variable for ALLOWED_HOSTS to include a space to set multiple values

If you know of a way to do that, including it in the example would be nice. If it's not possible, might I suggest using a comma to separate multiple allowed hosts? The netbox configuration.py file defines

ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(' ')

Perhaps we can adjust that to be

ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')

And change the example env file to show off this capability

ALLOWED_HOSTS=localhost,127.0.0.1

And finally, a note somewhere in the project about setting the Host header to be $http_host?

Release of NetBox v2.3.5 not available to pull

Current Behavior

Latest release of NetBox v2.3.5 isn't being automatically built.
This version was released over 3 days ago, but you still can not do the following:

$docker pull ninech/netbox:v2.3.5
Error response from daemon: manifest for ninech/netbox:v2.3.5 not found

I know that it can be built locally, but I'd prefer to use "official" releases from ninech/netbox instead.

Expected Behavior

To be able to "pull" a release for ninech/netbox:v2.3.5

Debug Information

N/A

Issue with 'startup_scripts' in 'v2.4-beta1'

Current Behavior

Previously working development box when changed to use image v2.4-beta1, the following error occurs:

netbox_1    |   Applying virtualization.0004_virtualmachine_add_role... OK
netbox_1    |   Applying virtualization.0005_django2... OK
netbox_1    |   Applying virtualization.0006_tags... OK
netbox_1    |   Applying virtualization.0007_change_logging... OK
netbox_1    | � Username: admin, E-Mail: [email protected]
netbox_1    | usage: manage.py shell [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS]
netbox_1    |                        [--pythonpath PYTHONPATH] [--traceback] [--no-color]
netbox_1    |                        [--no-startup] [-i {ipython,bpython,python}]
netbox_1    |                        [-c COMMAND]
netbox_1    | manage.py shell: error: unrecognized arguments: --plain

Expected Behavior

To create users, groups, and custom_fields the same way that was done in previous versions.

Debug Information

The output of docker-compose version: 1.16.1, build 6d1ac21
The output of docker version: 18.01.0-ce
The output of git rev-parse HEAD: 824141f587b8e49088264a07bda9bbc32040ef86
The command you used to start the project: docker-compose up -d

The output of docker-compose logs netbox:
N/A - Relevant portion is above
If needed, I can include all logs upon request.

API GET ok, CREATE/PUT etc not wokring

Hey Ninech

Have you been using the API of Netbox with this Setup? All GET Methods seems fine, but I can't make all the "Write"-Methods working. The NGINX Proxy always logs GET and all my PUT Requests also just acts as if theye were GETs.
Not sure if this is Netbox related or just some NGINX misconfiguration.. Can't find any useful informations at the moment.

Any suggestions? Have you seen this behaviour? I tried the the docker-compose way locally, but also on our OpenShift Installation I see the same behaviour.

Regads, sebastian from Puzze ITC, Bern

edit:

and yes, the API Token is write enabled =)

How can I start up netbox containers after a host power outage?

Hello!

I'm trying to bring the netbox to working stage after a physical host the containers worked on was shut down due to power outage.

I tried
docker-compose build netbox
docker-compose rm -f netbox
docker-compose up -d

or

docker-compose up -d alone and every time get only 2 working containers out of 5 that are required for the solution to work.

Could you please advise if I might miss something?

I see this
user@netbox:/netbox-docker$ sudo docker-compose up -d
Creating network "netboxdocker_default" with the default driver
Creating volume "netboxdocker_netbox-report-files" with local driver
Creating volume "netboxdocker_netbox-static-files" with local driver
Creating volume "netboxdocker_netbox-media-files" with local driver
Creating volume "netboxdocker_netbox-nginx-config" with local driver
Creating volume "netboxdocker_netbox-postgres-data" with local driver
Creating volume "netboxdocker_netbox-redis-data" with local driver
Pulling redis (redis:4-alpine)...
4-alpine: Pulling from library/redis
cd784148e348: Already exists
48d4c7155ddc: Pull complete
6d908603dbe8: Pull complete
fd4371c1c78e: Pull complete
e6818dc808c2: Pull complete
f1884d594f6f: Pull complete
Digest: sha256:775bbf766a5b711acce88e4142faf56cd587d63ddc4d57b49f7872f71d56fab6
Status: Downloaded newer image for redis:4-alpine
Pulling postgres (postgres:10.4-alpine)...
10.4-alpine: Pulling from library/postgres
8e3ba11ec2a2: Pull complete
fbb9adb8cff8: Pull complete
aa8817b9e00d: Pull complete
e162a11eb12c: Pull complete
788b2698f298: Pull complete
109af6d3e982: Pull complete
798f27e0089d: Pull complete
b5a994ed229e: Pull complete
4b6dfba335bd: Pull complete
Digest: sha256:b00851e5a07b910a18f9211cec807a1256cec38bbf7aa06859aba79acf79b3a8
Status: Downloaded newer image for postgres:10.4-alpine
Pulling nginx (nginx:1.15-alpine)...
1.15-alpine: Pulling from library/nginx
cd784148e348: Already exists
7cd9347ff112: Pull complete
7e58137a5d8a: Pull complete
98c93a8e17c8: Pull complete
Digest: sha256:2e497c294e3ba84aaeab7a0fbb1027819cd1f5f5892ed3c4a82b8b05010090da
Status: Downloaded newer image for nginx:1.15-alpine
Creating netboxdocker_redis_1 ...
Creating netboxdocker_postgres_1 ...
Creating netboxdocker_redis_1
Creating netboxdocker_redis_1 ... done
Creating netboxdocker_netbox-worker_1 ...
Creating netboxdocker_netbox-worker_1 ... error

Creating netboxdocker_postgres_1 ... done

ERROR: for netbox-worker Cannot start service netbox-worker: error while creating mount source path '/netbox-docker/startup_scripts': mkdir /netbox-docker: read-only file system
ERROR: Encountered errors while bringing up the project.
user@netbox:/netbox-docker$
user@netbox:/netbox-docker$
user@netbox:/netbox-docker$ sudo docker-compose ps
Name Command State Ports

netboxdocker_netbox-worker_1 python3 /opt/netbox/netbox ... Exit 128
netboxdocker_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp
netboxdocker_redis_1 docker-entrypoint.sh sh -c ... Up 6379/tcp

Upload of automatic builds fails

Hello,

At the moment new builds are not uploaded to Docker Hub because the login in the travis job fails:

$ docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

Kind regards
Tobias

Static port

Hello,
after restart docker, netbox change port.. how to get static port with docker compose ?

Thanks

Error when using "initializers/custom_fields.yml"

Current Behavior

With the recent change in custom_fields.yml from filterable: true to now be of the format filter_logic: loose, the container for netbox_1 fails to start and errors out on the line for processing the file 20_custom_fields.py

This can be quickly reproduced by cloning the current master branch and un-commenting out the lines for integer_field in the included example of initializers/custom_fields.yml

Expected Behavior

The initializer script to correctly create the custom_fields

Debug Information

The output of docker-compose version: 1.16.1
The output of docker version: 18.01.0-ce
The output of git rev-parse HEAD: 8333fafcf1c53ead35368d5b8fe73f9b7fa5b5ab
The command you used to start the project: docker-compose up

The output of docker-compose logs netbox:

netbox_1    |   Applying virtualization.0002_virtualmachine_add_status... OK
netbox_1    |   Applying virtualization.0003_cluster_add_site... OK
netbox_1    |   Applying virtualization.0004_virtualmachine_add_role... OK
netbox_1    | 💡 Username: admin, E-Mail: [email protected]
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/00_users.py'
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/10_groups.py'
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/20_custom_fields.py'
netbox_1    | Traceback (most recent call last):
netbox_1    |   File "./manage.py", line 10, in <module>
netbox_1    |     execute_from_command_line(sys.argv)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
netbox_1    |     utility.execute()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
netbox_1    |     self.fetch_command(subcommand).run_from_argv(self.argv)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
netbox_1    |     self.execute(*args, **cmd_options)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
netbox_1    |     output = self.handle(*args, **options)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/shell.py", line 101, in handle
netbox_1    |     exec(sys.stdin.read())
netbox_1    |   File "<string>", line 41, in <module>
netbox_1    | NameError: name 'CF_FILTER_CHOICES' is not defined
netboxdocker_netbox_1 exited with code 1

I think the some step was overlooked while merging in PR #66.

BTW, the example for selection_field_auto_weight still appears to use the filterable: true format which has been deprecated. I didn't test that specifically, but just an FYI.

API: data passed does not seem to arrive to the server

Hello,

I've been trying the netbox software for just a few days so my question might not be relevant, my excuses if so. I have not installed netbox without docker.

What I try to do :
post a HTTP request to the API with some data (POST request = reserve an IP in an existing prefix, DATA = a short description)

Expected behaviour
The IP is reserved, associated with my description, and a coffe awaits me on the side of my desk (the last one is optionnal)

What happens instead
The IP is reserved, but no data is associated with it.

In short,

request:

curl -X POST \
-H "Authorization: Token XXXXX" \
-H "Accept: application/json; indent=4" \
-d '{ \ 
   "description": "my new host" \ 
 }' 'http://netbox.example.com/api/ipam/prefixes/1/available-ips/'
response:
{
    "id": 109,
    "address": "10.36.202.102/24",
    "vrf": null,
    "tenant": null,
    "status": 1,
    "role": null,
    "interface": null,
    "description": "",
    "nat_inside": null
}

Another example:
request:

curl -X POST \
-H "Authorization: Token XXXXX" \
-H "Accept: application/json; indent=4" \
 'http://netbox.example.com/api/dcim/sites/ 
--data '{"name": "My New Site", "slug": "my-new-site"}'
response:
{
    "name": [
        "This field is required."
    ],
    "slug": [
        "This field is required."
    ]
}

... anything included in the -d (HTTP DATA) seems ignored.
And no coffee has been made at all (I had to do it myself!).

Define custom fields in YAML

Current Behavior

When #39 is merged, we have a very rudimentary way to perform certain actions when launching the container.

Expected Behavior

It would be cool though if, instead of writing python code to import custom fields, a more general script existed which would would parse a yaml; a file I imagine to look like this:

custom_field_name:
  on_objects:
  - dcim.models.Device
  - dcim.models.DeviceType
  type: CF_TYPE_TEXT
  label: The Label
  description: The Description
  required: true
  filterable: true
  default: nil
  weight: 100
  choices:
  - value: Choice 1
    weight: 100

Is there a way to NOT use ephemeral ports on startup?

Current Behavior

This may be a very basic docker question, but I can't seem to find the documentation to answer this question...

Currently, my default, the netbox application proxied by ngnix is available on port 32768:

$ docker-compose up -d
Creating network "netbox_default" with the default driver
Creating volume "netbox_netbox-nginx-config" with local driver
Creating volume "netbox_netbox-static-files" with local driver
Creating volume "netbox_netbox-report-files" with local driver
Creating volume "netbox_netbox-media-files" with local driver
Creating netbox_postgres_1 ...
Creating netbox_postgres_1 ... done
Creating netbox_netbox_1 ...
Creating netbox_netbox_1 ... done
Creating netbox_nginx_1 ...
Creating netbox_nginx_1 ... done

$ echo "http://$(docker-compose port nginx 8080)/"
http://0.0.0.0:32768/

Each time you do a docker-compose down followed up docker-compose up -d the application is exposed on a different port (initial +1):

$ docker-compose down
Stopping netbox_nginx_1    ... done
Stopping netbox_netbox_1   ... done
Stopping netbox_postgres_1 ... done
Removing netbox_nginx_1    ... done
Removing netbox_netbox_1   ... done
Removing netbox_postgres_1 ... done
Removing network netbox_default

$ docker-compose up -d
Creating network "netbox_default" with the default driver
Creating netbox_postgres_1 ...
Creating netbox_postgres_1 ... done
Creating netbox_netbox_1 ...
Creating netbox_netbox_1 ... done
Creating netbox_nginx_1 ...
Creating netbox_nginx_1 ... done

$ echo "http://$(docker-compose port nginx 8080)/"
http://0.0.0.0:32769/

Expected Behavior

The question at hand is whether you can bind the application to a specific port number each time you the application is built / run (ephemeral port range or not)?

Debug Information

N/A

Problem with automated images on DockerHub

Current Behavior

Previously, following the "Quickstart" would automatically run the latest release of NetBox that had been released and tagged appropriately.

I'm assuming this process was automated, but as of just now, when following the the exact commands mentioned, it still launches v2.3.7 instead of v2.4.0 which was released yesterday.

A similar issue occurred with v2.3.5 in issue #81, and I'm assuming it took the same took place with v2.3.6 and v2.3.7 as well (several days in delayed builds).

The automated builds occurred during the night (in eastern time) so that explains why v2.4.1 which was released this morning hasn't been built and stored on DockerHub yet.

I understand the ninech is not related with the official releases of NetBox and is "hosting" it to help the greater community out, but I'm hoping it can be fixed to how it was before.

Expected Behavior

To start the latest release of NetBox like was occurring previously somewhere around March 2018.

Debug Information

The output of docker-compose version: 1.22.0
The output of docker version: 18.01.0-ce
The output of git rev-parse HEAD: 61dd958af4668c997716b54246f3ce260fbe8f5f
The command you used to start the project: docker-compose up -d

The output of docker-compose logs netbox:
N/A - It starts fine, just not the current release.

Postgresql database restoration errors

When I execute Postgresql database restoration

$ gunzip -c db_dump.sql.gz | docker exec -i $(docker-compose ps -q postgres) sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'

I have this error:

ERROR:  relation "auth_group" already exists
ALTER TABLE
ERROR:  relation "auth_group_id_seq" already exists
ALTER TABLE
ALTER SEQUENCE
ERROR:  relation "auth_group_permissions" already exists
ALTER TABLE
ERROR:  relation "auth_group_permissions_id_seq" already exists
ALTER TABLE
ALTER SEQUENCE
ERROR:  relation "auth_permission" already exists
...

To fix it, I need to delete and recreate netbox database before execute restoration.

$ docker-compose exec postgres sh -c "su postgres -c 'dropdb $POSTGRES_DB --if-exists; createdb $POSTGRES_DB'"
$ gunzip -c db_dump.sql.gz | docker exec -i $(docker-compose ps -q postgres) sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'

Virtual Machines

Can't seem to see how to add a virtual machine as a device. I can see it in the official documentation but can't see how to enable the feature.

compose is version 3, but seems to be version 2 compatible

I have some older boxes with docker 1.10, which only supports compose version 2.

Current docker-compose.yml file lists the version at '3', but seems to be fully backward compatible with '2'.
https://github.com/ninech/netbox-docker/blob/master/docker-compose.yml#L1

Features between 2 and 3 are listed here.
https://docs.docker.com/compose/compose-file/compose-versioning/#version-21
I didn't see any features > 2 in use.

I'd done compose up with no issues on a 1.10 docker box and this single line change.
✅ Finished building the Docker images 'ninech/netbox:v2.2.1'

I'd like to propose that you only limit compose file version to the minimal needed to meet the parameters in use -- to ensure wider compatibility.

Single digit change.

Sample data

Would be very useful to show the product to executives if we can load sample data to the dcim component. ¿How we can enable dcim.jsonand initial_data.json?

Thanks!

Repo missing license?

It looks/feels like this repo is missing a License. I could not find any file or docs regrading what licence this repo is using.

If this is true then please consider to add a license to this repo.

postgresql-dev unsatisfiable constraints

docker-compose up fails during build of netbox image.

ERROR: unsatisfiable constraints:
  libressl-dev-2.6.4-r1:
    conflicts:
               openssl-dev-1.0.2o-r0[pc:libcrypto=2.6.4]
               openssl-dev-1.0.2o-r0[pc:libssl=2.6.4]
               openssl-dev-1.0.2o-r0[pc:openssl=2.6.4]
    satisfies:
               postgresql-dev-10.4-r0[libressl-dev]
               openldap-dev-2.4.45-r3[libressl-dev]
  openssl-dev-1.0.2o-r0:
    conflicts:
               libressl-dev-2.6.4-r1[pc:libcrypto=1.0.2o]
               libressl-dev-2.6.4-r1[pc:libssl=1.0.2o]
               libressl-dev-2.6.4-r1[pc:openssl=1.0.2o]
    satisfies: world[openssl-dev]

Issue is inherited from alpine base image which is used by python:3.6-alpine

Enable Adding Specific Permissions to Users / Groups

Current Behavior

Currently, in the initializers directory there are YAML files which specify which groups and users need to be created if they don't already exist. These are processed by the corresponding code in the startup_scripts directory.

However, there is no method to define which permissions a group or user needs to have.
After communicating with @cimnine via NetworkToCode Slack, this was mentioned:

So if you figure out how to assign permissions using the ./manage.py shell of Netbox, then this could be added to the startup_scripts and the corresponding yaml structures can be extended.

In short, I've figured out how to do this as requested, but I'm not sure the appropriate way to code this up and "extend" the "yaml structures".

I'm posting working code against the v2.4.3 release of NetBox here for reference.

from django.contrib.auth.models import Permission, Group, User
from django.contrib.contenttypes.models import ContentType

from ipam.models import Aggregate
from dcim.models import Device

g = Group.objects.get(name='applications')
u = User.objects.get(username='technical_user')

group_ct = ContentType.objects.get_for_model(Aggregate)
user_ct = ContentType.objects.get_for_model(Device)

group_perm = Permission.objects.get(content_type=group_ct, codename='add_aggregate')
user_perm = Permission.objects.get(content_type=user_ct, codename='add_device')

g.permissions.add(group_perm)
u.user_permissions.add(user_perm)

g.save()
u.save()

Obviously, more work need to be done here, so I'm hoping someone else besides myself sees the need for this and can work on this more than I have the time to. Otherwise, I'll slowly figure out how to do so and make sure that it is implemented in a way that is beneficial for the whole community.

Expected Behavior

N/A

Debug Information

N/A

Potential Problem with `device_type` initializer

Current Behavior

When I try to add new device_types to the initializers and restart the container for netbox, I get the following error:

netbox_1         | django.db.utils.IntegrityError: duplicate key value violates unique constraint "dcim_devicetype_manufacturer_id_model_17948c0c_uniq"
netbox_1         | DETAIL:  Key (manufacturer_id, model)=(1, DCS-7150-S52-CL) already exists.
netbox_1         |
netboxdocker_netbox_1 exited with code 1

That manufacturer / model does exist already as it was creating during a previous run of the container.

I'm assuming that is what an initializer is supposed to do?
Ensure that certain objects exist and, if not, create them.

This issue is limited to the 060_device_types.py in /startup_scripts/, none of the others exhibit this same behavior.
...

Expected Behavior

To not error out and crash when a device_type already exists.
...

Debug Information

The output of docker-compose version: 1.18.0
The output of docker version: 18.06.0-ce
The command you used to start the project: docker-compose up

The output of docker-compose logs netbox:

https://gist.github.com/bdlamprecht/e5d9ede813d80797181829342bb996cb

Build fails on Fedora 29 with SELinux enabled

Current Behavior

docker-compose up fails with SELinux enabled.

I am using latest Fedora (29) with SELinux enabled and running docker-compose up fails with a permission denied error. Full logs can be seen here

Expected Behavior

I expected a successful build.

Debug Information

The output of docker-compose version: 1.22.0, build f46880f
The output of docker version: 1.13.1, build accfe55-unsupported
The output of git rev-parse HEAD: eb09bf53644f057664437b5a473341a8e4491698
The command you used to start the project: docker-compose up

Temporary solution

Disabling SELinux fixes the issue but this is not a desirable solution

Changing ENV DB password breaks the setup

Current Behavior

Neither downloaded images, nor built one would work if you change the DB_PASSWORD in 'netbox.env postgres.env` ENV variable files.

Expected Behavior

postgres_1  | 2018-03-04 03:34:55.622 UTC [1] LOG:  database system is ready to accept connections
netbox_1    |   No migrations to apply.
netbox_1    | 💡 Username: admin, E-Mail: [email protected], Password: admin, Token: ___token___
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/00_users.py'
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/10_groups.py'
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/20_custom_fields.py'
netbox_1    | 
netbox_1    | 0 static files copied to '/opt/netbox/netbox/static', 263 unmodified.
netbox_1    | ✅ Initialisation is done.
netbox_1    | [2018-03-04 03:35:03 +0000] [1] [DEBUG] Current configuration:

Since working with the default provided password is not a good practice, do you have any suggestion on how to resolve it?

Debug Information

postgres_1  |   Connection matched pg_hba.conf line 95: "host all all all md5"
postgres_1  | 2018-03-04 19:11:31.972 UTC [27] FATAL:  password authentication failed for user "netbox"

docker-compose logs

System version

docker-compose version 1.19.0, build 9e633ef
docker-py version: 2.7.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

Client:
 Version:       17.12.1-ce
 API version:   1.35
 Go version:    go1.9.4
 Git commit:    7390fc6
 Built: Tue Feb 27 22:17:40 2018
 OS/Arch:       linux/amd64

Server:
 Engine:
  Version:      17.12.1-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   7390fc6
  Built:        Tue Feb 27 22:16:13 2018
  OS/Arch:      linux/amd64
  Experimental: false

git rev-parse HEAD : 3af803f481ca648c61b0a473e1e31d40bf32a7e4

docker-compose build
docker-compose up -d

allowed_hosts

  • Have you looked through the issues already resolved?

yes, a similar one was closed

Ok, very simply put, the current mechanism of just returning a 400 error if the call is not sent to a target in the allowed hosts list should be re-considered.
As a new user I'll not pretend to know if there is any benefit as it is.
It feels useless in multiple aspects from a security point of view (since header based) and not authorizing the client but the destination), but much more than that it is an insane waste of time.
It can't be OK to just code to the point where the application throws a 400, call it "safe now" and walk off. Please make it do a 403 instead of just falling apart.

And since this has hit multiple people already it would be really good to at least think about it.
There's really no reason to assume one would be launching this on their desktop/laptop, either.
As is, I tried to the point of doing a socks-tunnel via ssh via firefox into the VM where the docker daemon is running, and even then it'll not work - but it works really fine using netcat, thank you for asking. I don't think this has the benefits you think :)

Boolean variables in netbox.env turn into strings

Current Behavior

Boolean settings that are entered into netbox.env seem to turn into strings by configuration.py.

Expected Behavior

configuration.py should ensure booleans are properly created. From what I can see, a reasonable way to do this would be to replace:

DEBUG = os.environ.get('DEBUG', False)

with:

DEBUG = True if os.environ.get('DEBUG', False) == 'True' else False

Debug Information

For a netbox.env with DEBUG=False, here's how I saw the string issue:

root@container:/opt/docker/netbox# docker exec -i -t netbox_netbox_1 /bin/bash
bash-4.3# ./manage.py nbshell
### NetBox interactive shell (24c18369cd7f)
### Python 3.6.4 | Django 1.11.11 | NetBox 2.3.2
### lsmodels() will show available models. Use help(<model>) for more info.
>>> import netbox.settings
>>> help(netbox.settings)
Help on module netbox.settings in netbox:

NAME
    netbox.settings

DATA
    ADMINS = []
    ALLOWED_HOSTS = ['*']
    BANNER_BOTTOM = ''
    BANNER_LOGIN = ''
    BANNER_TOP = ''
    BASE_DIR = '/opt/netbox/netbox'
    BASE_PATH = ''
    CORS_ORIGIN_ALLOW_ALL = False
    CORS_ORIGIN_REGEX_WHITELIST = []
    CORS_ORIGIN_WHITELIST = ['']
    CSRF_TRUSTED_ORIGINS = ['*']
    DATABASE = {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AG...
    DATABASES = {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True,...
    DATA_UPLOAD_MAX_NUMBER_FIELDS = None
    DATETIME_FORMAT = 'N j, Y g:i a'
    DATE_FORMAT = 'N j, Y'
    DEBUG = 'False'

Notice that DEBUG = 'False' rather than DEBUG = False.

Getting a "Bad Request (400)"

I've been building a NetBox setup for ~6 months on a standard Ubuntu VM in a test environment. Now, I'm beginning to get ready to move that to a pilot release and I'd like to use deploy my setup using docker.

Looking to build off of the excellent work that you've done, I encountered the following issue...

I followed the instructions in the README.md, and everything worked well, but when I tried to connect to the server, I get the following back:

Bad Request (400)

I'm wondering if it has something to do with NetBox v2.2.5 that was released yesterday. I'm going to try and run this setup against previous versions, but in the meantime I thought I would let you know that there is a potential error.

I also got the following back when running the docker-compose up without the -d flag:

netbox_1    | Traceback (most recent call last):
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
netbox_1    |     self.connect()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 189, in connect
netbox_1    |     self.connection = self.get_new_connection(conn_params)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
netbox_1    |     connection = Database.connect(**conn_params)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
netbox_1    |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
netbox_1    | psycopg2.OperationalError: could not connect to server: Connection refused
netbox_1    |   Is the server running on host "postgres" (172.19.0.2) and accepting
netbox_1    |   TCP/IP connections on port 5432?

and

netbox_1    | The above exception was the direct cause of the following exception:
netbox_1    |
netbox_1    | Traceback (most recent call last):
netbox_1    |   File "./manage.py", line 10, in <module>
netbox_1    |     execute_from_command_line(sys.argv)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
netbox_1    |     utility.execute()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
netbox_1    |     self.fetch_command(subcommand).run_from_argv(self.argv)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
netbox_1    |     self.execute(*args, **cmd_options)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
netbox_1    |     output = self.handle(*args, **options)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 83, in handle
netbox_1    |     executor = MigrationExecutor(connection, self.migration_progress_callback)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 20, in __init__
netbox_1    |     self.loader = MigrationLoader(self.connection)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py", line 52, in __init__
netbox_1    |     self.build_graph()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py", line 209, in build_graph
netbox_1    |     self.applied_migrations = recorder.applied_migrations()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
netbox_1    |     self.ensure_schema()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
netbox_1    |     if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 254, in cursor
netbox_1    |     return self._cursor()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 229, in _cursor
netbox_1    |     self.ensure_connection()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
netbox_1    |     self.connect()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 94, in __exit__
netbox_1    |     six.reraise(dj_exc_type, dj_exc_value, traceback)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
netbox_1    |     raise value.with_traceback(tb)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
netbox_1    |     self.connect()
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 189, in connect
netbox_1    |     self.connection = self.get_new_connection(conn_params)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
netbox_1    |     connection = Database.connect(**conn_params)
netbox_1    |   File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
netbox_1    |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
netbox_1    | django.db.utils.OperationalError: could not connect to server: Connection refused
netbox_1    |   Is the server running on host "postgres" (172.19.0.2) and accepting
netbox_1    |   TCP/IP connections on port 5432?
netbox_1    |

And here are the logs from when it is "running" (i.e. after startup):

netbox_1    | [2017-11-17 00:58:53 +0000] [1] [INFO] Starting gunicorn 19.7.1
netbox_1    | [2017-11-17 00:58:53 +0000] [1] [DEBUG] Arbiter booted
netbox_1    | [2017-11-17 00:58:53 +0000] [1] [INFO] Listening at: http://0.0.0.0:8001 (1)
netbox_1    | [2017-11-17 00:58:53 +0000] [1] [INFO] Using worker: sync
netbox_1    | [2017-11-17 00:58:53 +0000] [126] [INFO] Booting worker with pid: 126
netbox_1    | [2017-11-17 00:58:53 +0000] [127] [INFO] Booting worker with pid: 127
netbox_1    | [2017-11-17 00:58:53 +0000] [128] [INFO] Booting worker with pid: 128
netbox_1    | [2017-11-17 00:58:54 +0000] [1] [DEBUG] 3 workers
netbox_1    | [2017-11-17 01:00:20 +0000] [128] [DEBUG] GET /
netbox_1    | 172.19.0.4 - - [17/Nov/2017:01:00:21 +0000] "GET / HTTP/1.0" 400 26 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.102 Safari/537.36 Vivaldi/1.93.955.48"
netbox_1    | [2017-11-17 01:00:21 +0000] [128] [DEBUG] GET /favicon.ico
netbox_1    | 172.19.0.4 - - [17/Nov/2017:01:00:21 +0000] "GET /favicon.ico HTTP/1.0" 400 26 "http://[HOSTNAME REMOVED]:32770/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.102 Safari/537.36 Vivaldi/1.93.955.48"
netbox_1    | [2017-11-17 01:23:22 +0000] [128] [DEBUG] GET /
netbox_1    | 172.19.0.4 - - [17/Nov/2017:01:23:22 +0000] "GET / HTTP/1.0" 400 26 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.102 Safari/537.36 Vivaldi/1.93.955.48"
netbox_1    | [2017-11-17 01:23:22 +0000] [126] [DEBUG] GET /favicon.ico
netbox_1    | 172.19.0.4 - - [17/Nov/2017:01:23:22 +0000] "GET /favicon.ico HTTP/1.0" 400 26 "http://[HOSTNAME REMOVED]:32770/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.102 Safari/537.36 Vivaldi/1.93.955.48"

The last two lines in the above section get repeated every time I refresh the page.
Also, you can tell my the port being 32770 that this is the 3rd time I've run docker-compose up.

http://localhost/ is unreachable

HI,

Everything was installed without issues and I can also see that all 3 containers are running. But accessing http://localhost doesn't seem to work. I get This site can’t be reached is there something that I missed?

command: docker-compose up -d

Thanks,
Ryann

Getting a "Connect reset" error in browser

Current Behavior

quick start exec success, “docker-compose ps“ can see all three container, exec "xdg-open "http://$(docker-compose port nginx 8080)/" &>/dev/null &" on terminal console can not get anything output. "$(docker-compose port nginx 8080)" has been replaced of the correct env value.

Expected Behavior

I can see the web page from the browser. But error shows: "connection reset"

Debug Information

The output of docker-compose logs netbox:

Starting netboxdocker_postgres_1 ... 
Starting netboxdocker_postgres_1 ... done
Starting netboxdocker_netbox_1 ... 
Starting netboxdocker_netbox_1 ... done
Starting netboxdocker_nginx_1 ... 
Starting netboxdocker_nginx_1 ... done
Attaching to netboxdocker_postgres_1, netboxdocker_netbox_1, netboxdocker_nginx_1
postgres_1  | LOG:  database system was shut down at 2018-05-09 10:33:48 UTC
postgres_1  | LOG:  MultiXact member wraparound protections are now enabled
postgres_1  | LOG:  database system is ready to accept connections
postgres_1  | LOG:  autovacuum launcher started
netbox_1    | Operations to perform:
netbox_1    |   Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy, users, virtualization
netbox_1    | Running migrations:
netbox_1    |   No migrations to apply.
netbox_1    | 💡 Username: admin, E-Mail: [email protected]
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/00_users.py'
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/10_groups.py'
netbox_1    | ⚙️ Executing '/opt/netbox/startup_scripts/20_custom_fields.py'
netbox_1    | 
netbox_1    | 0 static files copied to '/opt/netbox/netbox/static', 222 unmodified.
netbox_1    | ✅ Initialisation is done.
netbox_1    | [2018-05-09 10:36:02 +0000] [1] [DEBUG] Current configuration:
netbox_1    |   config: /etc/netbox/config/gunicorn_config.py
netbox_1    |   bind: ['0.0.0.0:8001']
netbox_1    |   backlog: 2048
netbox_1    |   workers: 3
netbox_1    |   worker_class: sync
netbox_1    |   threads: 1
netbox_1    |   worker_connections: 1000
netbox_1    |   max_requests: 0
netbox_1    |   max_requests_jitter: 0
netbox_1    |   timeout: 30
netbox_1    |   graceful_timeout: 30
netbox_1    |   keepalive: 2
netbox_1    |   limit_request_line: 4094
netbox_1    |   limit_request_fields: 100
netbox_1    |   limit_request_field_size: 8190
netbox_1    |   reload: False
netbox_1    |   reload_engine: auto
netbox_1    |   reload_extra_files: []
netbox_1    |   spew: False
netbox_1    |   check_config: False
netbox_1    |   preload_app: False
netbox_1    |   sendfile: None
netbox_1    |   reuse_port: False
netbox_1    |   chdir: /opt/netbox/netbox
netbox_1    |   daemon: False
netbox_1    |   raw_env: []
netbox_1    |   pidfile: None
netbox_1    |   worker_tmp_dir: None
netbox_1    |   user: 0
netbox_1    |   group: 0
netbox_1    |   umask: 0
netbox_1    |   initgroups: False
netbox_1    |   tmp_upload_dir: None
netbox_1    |   secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
netbox_1    |   forwarded_allow_ips: ['127.0.0.1']
netbox_1    |   accesslog: -
netbox_1    |   disable_redirect_access_to_syslog: False
netbox_1    |   access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
netbox_1    |   errorlog: -
netbox_1    |   loglevel: debug
netbox_1    |   capture_output: False
netbox_1    |   logger_class: gunicorn.glogging.Logger
netbox_1    |   logconfig: None
netbox_1    |   logconfig_dict: {}
netbox_1    |   syslog_addr: udp://localhost:514
netbox_1    |   syslog: False
netbox_1    |   syslog_prefix: None
netbox_1    |   syslog_facility: user
netbox_1    |   enable_stdio_inheritance: False
netbox_1    |   statsd_host: None
netbox_1    |   statsd_prefix: 
netbox_1    |   proc_name: None
netbox_1    |   default_proc_name: netbox.wsgi
netbox_1    |   pythonpath: /opt/netbox/netbox
netbox_1    |   paste: None
netbox_1    |   on_starting: <function OnStarting.on_starting at 0x7f53902efea0>
netbox_1    |   on_reload: <function OnReload.on_reload at 0x7f5390306048>
netbox_1    |   when_ready: <function WhenReady.when_ready at 0x7f5390306158>
netbox_1    |   pre_fork: <function Prefork.pre_fork at 0x7f5390306268>
netbox_1    |   post_fork: <function Postfork.post_fork at 0x7f5390306378>
netbox_1    |   post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f5390306488>
netbox_1    |   worker_int: <function WorkerInt.worker_int at 0x7f5390306598>
netbox_1    |   worker_abort: <function WorkerAbort.worker_abort at 0x7f53903066a8>
netbox_1    |   pre_exec: <function PreExec.pre_exec at 0x7f53903067b8>
netbox_1    |   pre_request: <function PreRequest.pre_request at 0x7f53903068c8>
netbox_1    |   post_request: <function PostRequest.post_request at 0x7f5390306950>
netbox_1    |   child_exit: <function ChildExit.child_exit at 0x7f5390306a60>
netbox_1    |   worker_exit: <function WorkerExit.worker_exit at 0x7f5390306b70>
netbox_1    |   nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f5390306c80>
netbox_1    |   on_exit: <function OnExit.on_exit at 0x7f5390306d90>
netbox_1    |   proxy_protocol: False
netbox_1    |   proxy_allow_ips: ['127.0.0.1']
netbox_1    |   keyfile: None
netbox_1    |   certfile: None
netbox_1    |   ssl_version: 2
netbox_1    |   cert_reqs: 0
netbox_1    |   ca_certs: None
netbox_1    |   suppress_ragged_eofs: True
netbox_1    |   do_handshake_on_connect: False
netbox_1    |   ciphers: TLSv1
netbox_1    |   raw_paste_global_conf: []
netbox_1    | [2018-05-09 10:36:02 +0000] [1] [INFO] Starting gunicorn 19.8.1
netbox_1    | [2018-05-09 10:36:02 +0000] [1] [DEBUG] Arbiter booted
netbox_1    | [2018-05-09 10:36:02 +0000] [1] [INFO] Listening at: http://0.0.0.0:8001 (1)
netbox_1    | [2018-05-09 10:36:02 +0000] [1] [INFO] Using worker: sync
netbox_1    | [2018-05-09 10:36:02 +0000] [117] [INFO] Booting worker with pid: 117
netbox_1    | [2018-05-09 10:36:02 +0000] [123] [INFO] Booting worker with pid: 123
netbox_1    | [2018-05-09 10:36:02 +0000] [129] [INFO] Booting worker with pid: 129
netbox_1    | [2018-05-09 10:36:02 +0000] [1] [DEBUG] 3 workers

Change default page size to 1000

Current Behavior

env/netbox.env defines MAX_PAGE_SIZE=0, effectively disabling API pagination.

Expected Behavior

The documented default pagesize of Netbox is 1000. I'd recommend setting the same number out of the box, or just not set the variable at all. This is a common pattern for performance reasons and may (like it did for me initially) lead to some confusion on why the pagination didn't seem be limiting results by default.

I realize that those environment settings are really just there for quick testing and any 'real' deployment should override pretty much every setting in that file. It's a minor change, but thought it could be helpful as it was confusing some of my peers who are testing Netbox now.

Render custom_fields.yml with jinja

Hi.

This is more of a question/poll if this feature would be accepted if i would put down the time to develop a rendering functionality of this file.

Basically the use-case that i found is where i need to make a bunch of items that needs a increased number in the value in a selection field for example. For example a field where i need something like this

....
- value: foo1
- value: foo2
- value: foo3
....
- value: foo100

And if i need something like 100-200 of this it will take time to print it and it will take up much space in the file. It would be a lot simpler to have a jinja for loop that renders the file before it is read by the YAML module.

Another example could be to simplify fields that is used over and over again that uses a online to render a complete field. Many times i have the same config for a string field for example.

If this feature would be acceptible i could put in the time to make it happen.

FR: Add LDAP Support for "Dockerized" NetBox

Current Behavior

Querying against an available LDAP server doesn't work as the python library django-auth-ldap isn't installed.

I was able to add it myself and get it working and am happy to work on a PR, however, I didn't want to spend time if you weren't going to plan on adding support for that feature in this repository.
...

Expected Behavior

I added the following lines in the Dockerfile:

RUN pip install \
# gunicorn is used for launching netbox
      gunicorn \
# ruamel is used in startup_scripts
      ruamel.yaml \
# adding django-auth-ldap for ldap support
      django-auth-ldap

and

COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
COPY docker/gunicorn_config.py /opt/netbox/
COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf
COPY docker/docker-entrypoint.sh docker-entrypoint.sh
COPY startup_scripts/ /opt/netbox/startup_scripts/
COPY initializers/ /opt/netbox/initializers/
COPY configuration/configuration.py /etc/netbox/configuration.py
COPY configuration/ldap_config.py /etc/netbox/ldap_config.py

...

Debug Information

N/A

Running into an exit 1 code on nginx and netbox

On compose up i get the following output running docker in windows:

nginx_1     | nginx: [emerg] host not found in upstream "netbox" in /etc/netbox-nginx/nginx.conf:28
nginx_1     | 2017/11/22 04:29:58 [emerg] 1#1: host not found in upstream "netbox" in /etc/netbox-nginx/nginx.conf:28
nginx_1     | nginx: [emerg] host not found in upstream "netbox" in /etc/netbox-nginx/nginx.conf:28
postgres_1  | The files belonging to this database system will be owned by user "postgres".
netbox_1    | standard_init_linux.go:185: exec user process caused "no such file or directory"
postgres_1  | This user must also own the server process.
netbox_1    | standard_init_linux.go:185: exec user process caused "no such file or directory"

It looks like nginx exits due the netbox host not being found, while netbox fails due to a missing directory. Thoughts?

How to support NAPALM_ARGS in netbox.env?

Current Behavior

I cannot connect to my Cisco devices via NAPALM as they require you to enter "privileged EXEC mode" AFTER initially logging into them. This is solved in the NetworkDriver of NAPALM by using the optional_args parameter.

NetBox has called this the NAPALM_ARGS and the documented way is to pass a dict with the needed values.

However, due to the way Docker interprets the values, it seems to escape the characters in a very strange manner.

I've tried several different ways and all have been unsuccessful.

Expected Behavior

N/A

Debug Information

In each of these attempts, they were all defined in the netbox.env file and the results were seen when connecting to the netbox container and looking at the environment variables.


Attempt 1:

NAPALM_ARGS={'secret':'password'}

Result 1:

NAPALM_ARGS='{'"'"'secret'"'"':'"'"'password'"'"'}'

Attempt 2:

NAPALM_ARGS=\{\'secret\'\:\'password\'\}

Result 2:

NAPALM_ARGS='\{\'"'"'secret\'"'"'\:\'"'"'password\'"'"'\}'

Attempt 3:

NAPALM_ARGS="{'secret':'password'}"

Result 3:

NAPALM_ARGS='"{'"'"'secret'"'"':'"'"'password'"'"'}"'

The closest result I was able to get was in...
Attempt 4:

NAPALM_ARGS={\"secret\":\"password\"}

Result 4:

NAPALM_ARGS='{\"secret\":\"password\"}'

I've done my best searching for ways to pass a python dict as an ENV, but no dice there either.
As someone who appears to have significant experience with Docker, I'm looking for suggestions on how to get this to function properly.

Bad default location for REPORTS_ROOT

Current Behavior

Due to the way your current implementation references configuration files located in /etc/netbox/ instead of /opt/netbox/netbox/netbox/, when you browse to http://localhost/extras/reports/, the following is seen:

image

Yes, I know this can be changed in the netbox.env by setting a value for REPORTS_ROOT, however, in my opinion, this "default" is not a good idea. I don't believe anyone is going to use the /etc/reports location to store custom python scripts specific to NetBox.

I'd like to propose using /etc/netbox/reports/ as an alternative, but I didn't want to go through the hassle of creating a PR if it wasn't going to be merged.

What are your thoughts one way or the other?

Expected Behavior

N/A

Debug Information

N/A

502 Bad Gateway

I just did the default installation and only get a 502 Bad Gateway error when trying to connect.

echo "http://$(docker-compose port nginx 80)/"
http://0.0.0.0:32768/
open "http://$(docker-compose port nginx 80)/"

os.getenv gets NAPALM_TIMEOUT as str, should be int to work with the network driver

Current Behavior

After a pip install napalm with the proper environment variables set to make a napalm network driver for EOS, the buttons in the netbox GUI for LLDP/status/running config came alive, as expected. Clicking on those buttons executes napalm code, but the function used to make the network driver pulls in NAPALM_TIMEOUT from the environment. I had this variable set to '10' in the shell. os.getenv() returns a string though, and when it feeds a string of '10' into the napalm device/driver and you call device.open() on it, it will detonate with:

"{"detail":"Error connecting to the device at 192.168.1.34: an integer is required (got type str)”}”

This error is bubbled all the way up to the GUI and presented to the end user as a modal.

The netbox code in views.py is catching Exception and just slapping the type error in the raised error message. This isn't incredibly helpful, but I can see he has a #TODO to make the error-handing a little better here.

Expected Behavior

When we pull the environment variable out of the shell and into python, it should be cast into an int so napalm doesn't, so to speak, light on fire.

Debug Information

I didn't catch the logs before I fixed the issue locally, but I do have information about my environment.

$ docker-compose version
docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

$ docker version
Client:
 Version:      17.03.2-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   f5ec1e2
 Built:        Tue Jun 27 02:21:36 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.2-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   f5ec1e2
 Built:        Tue Jun 27 02:21:36 2017
 OS/Arch:      linux/amd64
 Experimental: false

$ git rev-parse HEAD
52e653dd303a98b3fd9693863581095407ec3a19

Latest Version Doesn't Have Icons (from Bootstrap)

Current Behavior

After cloning this latest revision in an attempt to test out the loading of "custom fields when creating the container" feature, I noticed something really strange.

With this latest version, the small icons for adding / exporting objects (Sites, Regions, Devices, etc) don't appear anymore. I think it may have something to do with the volume netbox-static-files but am not positive.

Current commit:
image

...

Expected Behavior

Previous commits:
image

...

Debug Information

The output of docker-compose version: 1.17.1, build 6d101fb
The output of docker version: 17.05.0-ce, build 89658be
The output of git rev-parse HEAD: d2ec32fefe46fe61307df832491b31fac7b5ae7c
The command you used to start the project: docker-compose up -d

The output of docker-compose logs netbox:

I don't see anything odd, but I can provide if needed.

The output of docker-compose logs nginx:

Attaching to netboxdocker_nginx_1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.