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

netbox: 3.7.8 -> 4.1.3 #331750

Merged
merged 11 commits into from
Oct 25, 2024
Merged

netbox: 3.7.8 -> 4.1.3 #331750

merged 11 commits into from
Oct 25, 2024

Conversation

minijackson
Copy link
Member

@minijackson minijackson commented Aug 2, 2024

Description of changes

Finally!

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

Things done

  • Built on platform(s)
    • 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
  • Tested, as applicable:
    • NixOS tests: netbox and netbox-upgrade
    • made sure NixOS tests are linked to the relevant packages
  • 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)
    • (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
  • Fits CONTRIBUTING.md.

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


Add a 👍 reaction to pull requests you find important.

@xanderio
Copy link
Contributor

xanderio commented Aug 2, 2024

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

@minijackson
Copy link
Member Author

@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 minijackson added the 11.by: package-maintainer This PR was created by the maintainer of the package it changes label Aug 2, 2024
@xanderio
Copy link
Contributor

xanderio commented Aug 2, 2024

That explains it nixpkgs-review only applied this PR.

@minijackson minijackson force-pushed the netbox_4 branch 2 times, most recently from 41d5642 to eab9adc Compare August 27, 2024 08:24
@minijackson minijackson marked this pull request as ready for review August 27, 2024 08:45
@minijackson minijackson requested a review from natsukium as a code owner August 27, 2024 08:45
@minijackson
Copy link
Member Author

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

@xanderio
Copy link
Contributor

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

This fixes an issue with Django 5

pytest checks were removed due to a dependency on model_mommy,
which is deprecated.
Migrate to pkgs/by-name,
and update the test so that it passes for all versions

This version is added as EOL, since NetBox 4.1 is out,
but it might be still useful in case of an upgrade issue.
also switch the netbox-upgrade test to check upgrade from 3.7 -> 4.1
since the script does database migrations and index,
it could timeout on slower system with a big enough database
needed by the NetBox 4.0+ upgrade
@minijackson
Copy link
Member Author

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

@minijackson minijackson merged commit 0433962 into NixOS:master Oct 25, 2024
28 of 29 checks passed
@minijackson minijackson deleted the netbox_4 branch October 25, 2024 09:09
@felbinger
Copy link
Member

felbinger commented Nov 4, 2024

@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.

@minijackson
Copy link
Member Author

@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
Copy link
Member Author

minijackson commented Nov 4, 2024

@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.

@SuperSandro2000
Copy link
Member

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?

@felbinger
Copy link
Member

@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!

@SuperSandro2000
Copy link
Member

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

${python.pythonOnBuildForHost.interpreter} src/manage.py collectstatic --clear --no-input
?

@minijackson
Copy link
Member Author

minijackson commented Nov 6, 2024

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:

if [[ -e "$versionFile" && "$(cat "$versionFile")" == "${cfg.package.version}" ]]; then
exit 0
fi

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python 8.has: changelog 8.has: clean-up 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants