Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup Scripts Crash with Netbox 2.7 #224

Closed
lukasjuhrich opened this issue Jan 19, 2020 · 3 comments · Fixed by #226
Closed

Startup Scripts Crash with Netbox 2.7 #224

lukasjuhrich opened this issue Jan 19, 2020 · 3 comments · Fixed by #226
Labels
bug This issue describes a confirmed bug. pr There is a PR targeting this issue.
Milestone

Comments

@lukasjuhrich
Copy link

lukasjuhrich commented Jan 19, 2020

Current Behavior

Startup of the netboxcommunity/netbox:v2.7.1 docker image fails at the 020_custom_fields.py startup script:

core@infra-coreos-quimby ~/netbox $ drc up netbox
netbox_redis-webhooks_1 is up-to-date
netbox_redis-cache_1 is up-to-date
Starting netbox_netbox_1
Attaching to netbox_netbox_1
netbox_1          | Operations to perform:
netbox_1          |   Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization
netbox_1          | Running migrations:
netbox_1          |   No migrations to apply.
netbox_1          | 💡 Superuser Username: admin, E-Mail: admin@example.com
netbox_1          | ⚙️ Executing '/opt/netbox/startup_scripts/000_users.py'
netbox_1          | ⚙️ Executing '/opt/netbox/startup_scripts/010_groups.py'
netbox_1          | ⚙️ Executing '/opt/netbox/startup_scripts/020_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.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
netbox_1          |     utility.execute()
netbox_1          |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
netbox_1          |     self.fetch_command(subcommand).run_from_argv(self.argv)
netbox_1          |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
netbox_1          |     self.execute(*args, **cmd_options)
netbox_1          |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
netbox_1          |     output = self.handle(*args, **options)
netbox_1          |   File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/shell.py", line 92, in handle
netbox_1          |     exec(sys.stdin.read())
netbox_1          |   File "<string>", line 1, in <module>
netbox_1          | ImportError: cannot import name 'CF_TYPE_TEXT' from 'extras.constants' (/opt/netbox/netbox/extras/constants.py)
netbox_netbox_1 exited with code 1

Expected Behavior

It shouldn't crash .

Debug Information

The output of docker-compose version:

docker-compose version 1.9.0, build 2585387
docker-py version: 1.10.6
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

The output of docker version:

Client:
 Version:           18.06.3-ce
 API version:       1.38
 Go version:        go1.10.8
 Git commit:        d7080c1
 Built:             Tue Feb 19 23:07:53 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.3-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       d7080c1
  Built:            Tue Feb 19 23:07:53 2019
  OS/Arch:          linux/amd64
  Experimental:     false

I didn't use this docker-compose project, but the netboxcommunity/netbox:v2.7.1 base image.

My dockerfile is:

The output of docker inspect netboxcommunity/netbox:latest --format "{{json .ContainerConfig.Labels}}":

{
"NETBOX_GIT_BRANCH":"",
"NETBOX_GIT_REF":"",
"NETBOX_GIT_URL":"",
"ORIGINAL_TAG":"",
"org.label-schema.build-date":"",
"org.label-schema.description":"A container based distribution of Netbox, the free and open IPAM and DCIM solution.",
"org.label-schema.name":"Netbox Docker",
"org.label-schema.schema-version":"1.0",
"org.label-schema.url":"https://github.com/netbox-community/netbox-docker",
"org.label-schema.usage":"https://github.com/netbox-community/netbox-docker/wiki",
"org.label-schema.vcs-ref":"",
"org.label-schema.vcs-url":"https://github.com/netbox-community/netbox-docker.git",
"org.label-schema.vendor":"The netbox-docker contributors.",
"org.label-schema.version":"snapshot",
"org.opencontainers.image.authors":"The netbox-docker contributors.",
"org.opencontainers.image.created":"",
"org.opencontainers.image.description":"A container based distribution of Netbox, the free and open IPAM and DCIM solution.",
"org.opencontainers.image.documentation":"https://github.com/netbox-community/netbox-docker/wiki",
"org.opencontainers.image.licenses":"Apache-2.0",
"org.opencontainers.image.revision":"",
"org.opencontainers.image.source":"https://github.com/netbox-community/netbox-docker.git",
"org.opencontainers.image.title":"Netbox Docker",
"org.opencontainers.image.url":"https://github.com/netbox-community/netbox-docker",
"org.opencontainers.image.vendor":"The netbox-docker contributors.",
"org.opencontainers.image.version":"snapshot"
}

The output of docker-compose config:

networks: {}
services:
  netbox:
    build:
      context: /home/core/netbox
      dockerfile: Dockerfile
    links:
    - redis-webhooks
    - redis-cache
    restart: always
    volumes:
    - static-files:/opt/netbox/netbox/static:rw
    - netbox-media-files:/opt/netbox/netbox/media:rw
    - /home/core/netbox/config:/opt/netbox/netbox/netbox/configuration:rw
    - /home/core/netbox/ldap_config:/opt/netbox/netbox/netbox/ldap_config:rw
  nginx:
    image: nginx:stable-alpine
    links:
    - netbox
    ports:
    - 8081:80
    restart: always
    volumes:
    - /home/core/netbox/nginx.conf:/etc/nginx/nginx.conf:ro
    - static-files:/opt/netbox/netbox/static:rw
  redis-cache:
    image: redis:5-alpine
    restart: always
    volumes:
    - /home/core/netbox/redis_cache.conf:/usr/local/etc/redis/redis.conf:rw
    - netbox-redis-cache-data:/data:rw
  redis-webhooks:
    image: redis:5-alpine
    restart: always
    volumes:
    - /home/core/netbox/redis_webhooks.conf:/usr/local/etc/redis/redis.conf:rw
    - netbox-redis-webhooks-data:/data:rw
version: '2.0'
volumes:
  netbox-media-files:
    driver: local
  netbox-redis-cache-data:
    driver: local
  netbox-redis-webhooks-data:
    driver: local
  static-files:
    driver: local

My custom dockerfile:

FROM netboxcommunity/netbox:v2.7.1

RUN pip install django-auth-ldap napalm-aos
@cimnine
Copy link
Collaborator

cimnine commented Jan 20, 2020

Thank you for your detailed bug report. The Netbox Docker project does not yet support Netbox 2.7, despite that there are images available. (This happens automatically.) We're working on it though.

For now you may use the branch in PR #209 to build your own image. The startup scripts are fixed in there as well.

@cimnine cimnine added bug This issue describes a confirmed bug. pr There is a PR targeting this issue. labels Jan 20, 2020
@cimnine cimnine added this to the 0.21.0 milestone Jan 20, 2020
@cimnine cimnine pinned this issue Jan 20, 2020
@cimnine cimnine changed the title Startup script crashes Startup Scripts Crash with Netbox 2.7 Jan 20, 2020
@cimnine cimnine mentioned this issue Jan 20, 2020
@lukasjuhrich
Copy link
Author

Hi @cimnine, I didn't expect that the images weren't production-ready yet. However, the workaround of disabling the startup scripts is fine in our circumstances, so we'll have no problems with being patient and waiting for an update.
Thanks for your fast reaction!

@cimnine
Copy link
Collaborator

cimnine commented Jan 23, 2020

All Docker Images of the v2.7 series have been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a confirmed bug. pr There is a PR targeting this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants