nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

netbox: 3.7.8 -> 4.1.3

Open minijackson opened this issue 1 year ago • 14 comments

Description of changes

Finally!

Some upgrades and new Python packages were needed by the NetBox upgrade.

Things done

  • Built on platform(s)
    • [x] x86_64-linux
    • [ ] aarch64-linux
    • [ ] x86_64-darwin
    • [ ] aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • [ ] sandbox = relaxed
    • [ ] sandbox = true
  • [x] Tested, as applicable:
    • NixOS tests: netbox and netbox-upgrade
    • made sure NixOS tests are linked to the relevant packages
  • [x] Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • [ ] Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • [x] (Package updates) Added a release notes entry if the change is major or breaking
    • [ ] (Module updates) Added a release notes entry if the change is significant
    • [ ] (Module addition) Added a release notes entry if adding a new NixOS module
  • [x] Fits CONTRIBUTING.md.

cc NetBox maintainers: @RaitoBezarius & @n0emis django-mptt maintainer: @mweinelt and people interested in the upgrade: @KiruyaMomochi & @xanderio & @Xyz00777


Add a :+1: reaction to pull requests you find important.

minijackson avatar Aug 02 '24 11:08 minijackson

Result of nixpkgs-review pr 331750 run on x86_64-linux 1

1 package blacklisted:
  • nixos-install-tools
5 packages failed to build:
  • netbox
  • python311Packages.netbox-reorder-rack
  • python311Packages.netbox-reorder-rack.dist
  • python312Packages.netbox-reorder-rack
  • python312Packages.netbox-reorder-rack.dist
16 packages built:
  • python311Packages.django-choices-field
  • python311Packages.django-choices-field.dist
  • python311Packages.django-htmx
  • python311Packages.django-htmx.dist
  • python311Packages.django-mptt
  • python311Packages.django-mptt.dist
  • python311Packages.strawberry-django
  • python311Packages.strawberry-django.dist
  • python312Packages.django-choices-field
  • python312Packages.django-choices-field.dist
  • python312Packages.django-htmx
  • python312Packages.django-htmx.dist
  • python312Packages.django-mptt
  • python312Packages.django-mptt.dist
  • python312Packages.strawberry-django
  • python312Packages.strawberry-django.dist

xanderio avatar Aug 02 '24 12:08 xanderio

@xanderio your nixpkgs-review might have failed because this PR depends on the djangorestframework PR. While testing my changes, I had those djangorestframework changes in my local tree.

minijackson avatar Aug 02 '24 13:08 minijackson

That explains it nixpkgs-review only applied this PR.

xanderio avatar Aug 02 '24 15:08 xanderio

Dependent PR was merged, so this is now ready for review!

Both the netbox_4_0 and the netbox-upgrade passes.


Result of nixpkgs-review run on x86_64-linux 1

1 package blacklisted:
  • nixos-install-tools
22 packages built:
  • disko
  • netbox
  • python311Packages.django-choices-field
  • python311Packages.django-choices-field.dist
  • python311Packages.django-htmx
  • python311Packages.django-htmx.dist
  • python311Packages.django-mptt
  • python311Packages.django-mptt.dist
  • python311Packages.netbox-reorder-rack
  • python311Packages.netbox-reorder-rack.dist
  • python311Packages.strawberry-django
  • python311Packages.strawberry-django.dist
  • python312Packages.django-choices-field
  • python312Packages.django-choices-field.dist
  • python312Packages.django-htmx
  • python312Packages.django-htmx.dist
  • python312Packages.django-mptt
  • python312Packages.django-mptt.dist
  • python312Packages.netbox-reorder-rack
  • python312Packages.netbox-reorder-rack.dist
  • python312Packages.strawberry-django
  • python312Packages.strawberry-django.dist

minijackson avatar Aug 27 '24 08:08 minijackson

Happy to report the nixpkgs-review is happy again :D

Result of nixpkgs-review pr 331750 run on x86_64-linux 1

1 package blacklisted:
  • nixos-install-tools
22 packages built:
  • disko
  • netbox
  • python311Packages.django-choices-field
  • python311Packages.django-choices-field.dist
  • python311Packages.django-htmx
  • python311Packages.django-htmx.dist
  • python311Packages.django-mptt
  • python311Packages.django-mptt.dist
  • python311Packages.netbox-reorder-rack
  • python311Packages.netbox-reorder-rack.dist
  • python311Packages.strawberry-django
  • python311Packages.strawberry-django.dist
  • python312Packages.django-choices-field
  • python312Packages.django-choices-field.dist
  • python312Packages.django-htmx
  • python312Packages.django-htmx.dist
  • python312Packages.django-mptt
  • python312Packages.django-mptt.dist
  • python312Packages.netbox-reorder-rack
  • python312Packages.netbox-reorder-rack.dist
  • python312Packages.strawberry-django
  • python312Packages.strawberry-django.dist

xanderio avatar Aug 27 '24 08:08 xanderio

I updated it to NetBox 4.0.11, which should be the latest 4.0 release. I'll do 4.1 in another PR, since I got issues with database migrations.

I think this PR is pretty much good to go, then.

minijackson avatar Sep 09 '24 12:09 minijackson

Could you rebase to fix the conflicts?

dasJ avatar Sep 12 '24 13:09 dasJ

Don't merge yet, rebasing now shows a problem with django-polymorphic

minijackson avatar Sep 16 '24 23:09 minijackson

@ofborg eval

dasJ avatar Sep 26 '24 21:09 dasJ

Finally found what was the problem! Django was updated from 5.0 to 5.1, due to some vulnerabilities, but Django has breaking changes from 5.0 to 5.1. So I've reintroduced Django 5.0.9 which also has the security fixes (cc @mweinelt).

I think this PR is ready for review (again). I hope to get it before 24.11 releases, as it's already to major versions apart.

minijackson avatar Oct 08 '24 07:10 minijackson

Maybe we can pick https://github.com/netbox-community/netbox/pull/17620 instead of reintroducing django_5_0, which goes EOL a month before NixOS 24.11.

mweinelt avatar Oct 10 '24 01:10 mweinelt

@mweinelt good point, thanks! Done.

minijackson avatar Oct 15 '24 14:10 minijackson

I was not able to run nixpkgs-review most likely due to merge conflicts :

...failed to build: Failed to merge aedaa6680aea36a36c3a45d04d0a20704ad11d2c into .../.cache/nixpkgs-review/pr-331750/nixpkgs. git merge failed with exit code 1

AkechiShiro avatar Oct 22 '24 07:10 AkechiShiro

@AkechiShiro thanks! It should be fixed now. I wish GitHub would notify me when my PRs gets conflicted

minijackson avatar Oct 22 '24 09:10 minijackson

Result of nixpkgs-review pr 331750 run on x86_64-linux 1

1 package blacklisted:
  • nixos-install-tools
1 package failed to build:
  • authentik
38 packages built:
  • netbox
  • peering-manager
  • python311Packages.django-choices-field
  • python311Packages.django-choices-field.dist
  • python311Packages.django-htmx
  • python311Packages.django-htmx.dist
  • python311Packages.django-mptt
  • python311Packages.django-mptt.dist
  • python311Packages.django-polymorphic
  • python311Packages.django-polymorphic.dist
  • python311Packages.django-rest-polymorphic
  • python311Packages.django-rest-polymorphic.dist
  • python311Packages.drf-spectacular
  • python311Packages.drf-spectacular.dist
  • python311Packages.netbox-documents
  • python311Packages.netbox-documents.dist
  • python311Packages.netbox-reorder-rack
  • python311Packages.netbox-reorder-rack.dist
  • python311Packages.strawberry-django
  • python311Packages.strawberry-django.dist
  • python312Packages.django-choices-field
  • python312Packages.django-choices-field.dist
  • python312Packages.django-htmx
  • python312Packages.django-htmx.dist
  • python312Packages.django-mptt
  • python312Packages.django-mptt.dist
  • python312Packages.django-polymorphic
  • python312Packages.django-polymorphic.dist
  • python312Packages.django-rest-polymorphic
  • python312Packages.django-rest-polymorphic.dist
  • python312Packages.drf-spectacular
  • python312Packages.drf-spectacular.dist
  • python312Packages.netbox-documents
  • python312Packages.netbox-documents.dist
  • python312Packages.netbox-reorder-rack
  • python312Packages.netbox-reorder-rack.dist
  • python312Packages.strawberry-django
  • python312Packages.strawberry-django.dist

AkechiShiro avatar Oct 22 '24 11:10 AkechiShiro

Result of nixpkgs-review pr 331750 run on aarch64-darwin 1

4 packages marked as broken and skipped:
  • baserow
  • baserow.dist
  • netbox_3_7
  • netbox_4_0
37 packages built:
  • netbox (netbox_4_1)
  • python311Packages.django-choices-field
  • python311Packages.django-choices-field.dist
  • python311Packages.django-htmx
  • python311Packages.django-htmx.dist
  • python311Packages.django-mptt
  • python311Packages.django-mptt.dist
  • python311Packages.django-polymorphic
  • python311Packages.django-polymorphic.dist
  • python311Packages.django-rest-polymorphic
  • python311Packages.django-rest-polymorphic.dist
  • python311Packages.drf-spectacular
  • python311Packages.drf-spectacular.dist
  • python311Packages.netbox-documents
  • python311Packages.netbox-documents.dist
  • python311Packages.netbox-reorder-rack
  • python311Packages.netbox-reorder-rack.dist
  • python311Packages.strawberry-django
  • python311Packages.strawberry-django.dist
  • python312Packages.django-choices-field
  • python312Packages.django-choices-field.dist
  • python312Packages.django-htmx
  • python312Packages.django-htmx.dist
  • python312Packages.django-mptt
  • python312Packages.django-mptt.dist
  • python312Packages.django-polymorphic
  • python312Packages.django-polymorphic.dist
  • python312Packages.django-rest-polymorphic
  • python312Packages.django-rest-polymorphic.dist
  • python312Packages.drf-spectacular
  • python312Packages.drf-spectacular.dist
  • python312Packages.netbox-documents
  • python312Packages.netbox-documents.dist
  • python312Packages.netbox-reorder-rack
  • python312Packages.netbox-reorder-rack.dist
  • python312Packages.strawberry-django
  • python312Packages.strawberry-django.dist

Mastermindaxe avatar Oct 22 '24 12:10 Mastermindaxe

Merging, as this is the last day breaking changes are allowed. If this causes issues (hopefully not), I'll open follow-up PRs.

minijackson avatar Oct 25 '24 09:10 minijackson

@minijackson My netbox instance is partly broken now ;( It might be related to something in my setup... Did you test if you can set a something (e.g. role, platform, site) on an object like a device or vm? image image It does still work in the demo instance.

felbinger avatar Nov 04 '24 16:11 felbinger

@felbinger I can reproduce the issue on an instance upgraded from 3.7, but not on a fresh 4.1 instance. Not sure where this comes from yet.

I think the demo instance is recreated from scratch on each upgrade, so this doesn't tell us if the issue is from the packaging or on the NetBox side, unfortunately.

minijackson avatar Nov 04 '24 19:11 minijackson

@felbinger Okay, I think I found the issue, and I'll open a fix tomorrow. In the meantime you can run:

rm -rf /var/lib/netbox/static
netbox-manage collectstatic

and hard refresh / clear the cache of the page in your browser.

minijackson avatar Nov 04 '24 20:11 minijackson

We probably want to save the version of netbox somewhere in /var/lib/netbox a d when that changes invalidate the static cache.

Or can we use a cheap symlink?

SuperSandro2000 avatar Nov 05 '24 09:11 SuperSandro2000

@felbinger Okay, I think I found the issue, and I'll open a fix tomorrow. In the meantime you can run:

rm -rf /var/lib/netbox/static
netbox-manage collectstatic

and hard refresh / clear the cache of the page in your browser.

thanks a lot, it's working!

felbinger avatar Nov 05 '24 17:11 felbinger

or maybe we can build it at runtime like paperless-ngx does https://github.com/NixOS/nixpkgs/blob/7e44cf12936b978af6f37e6ffcfc469bbf40215f/pkgs/applications/office/paperless-ngx/default.nix#L217 ?

SuperSandro2000 avatar Nov 05 '24 19:11 SuperSandro2000

We probably want to save the version of netbox somewhere in /var/lib/netbox a d when that changes invalidate the static cache.

We're actually already doing that here: https://github.com/NixOS/nixpkgs/blob/71408df70fd5bfbc0e5fc3776a942e2b0b93dad6/nixos/modules/services/web-apps/netbox.nix#L301-L303

The issue was that old files were not cleared, and it seems upstream's upgrade.sh script doesn't do it either: https://github.com/netbox-community/netbox/blob/58bc3884578a98595b02d7d7412c83d41fc7bbfa/upgrade.sh#L100-L101

Or can we use a cheap symlink?

That's a great suggestion, I was thinking of putting the hash in order for the upgrade script to be run when plugins are added, but the symlink is probably even simpler. Thanks!

or maybe we can build it at runtime like paperless-ngx does

I'm not completely sure of the advantages / drawbacks of doing that, but I actually didn't know of the --clear option, which is exactly what I was looking for for a quick fix!

minijackson avatar Nov 06 '24 15:11 minijackson