Netbox-Docker db migration to Production Netbox Server (standalone) #13852
-
Netbox-Docker v3.5.7 (lab) <-migrate db to-> Netbox v3.5.7 (production) Netbox Docker: v2.6.1 Have a question about migrating the db from a lab netbox docker instance to a prod server running the same version. Reading the how to guides, I was able to pull a backup from the docker instance using the below. However, further reading states a I would need to perform the below steps in order to achieve this. Will either option work in my case? Any help or links to articles explaining the migration process between a docker instance and non-docker netbox will be appreciated. Option 1: Copy to new server Set the secret_key in the configuration.py to the same value you used on the original server Stop the NetBox Service with sudo systemctl stop netbox netbox-rq Drop DB on new server, create a new blank, grant rights and import the dump: Go to the python virtual environment with source /opt/netbox/venv/bin/activate and run the migration script with python3 manage.py migrate Restart Netbox with sudo systemctl start netbox netbox-rq and sudo systemctl enable netbox netbox-rq However...further reading states I can do all this using the below instead which eliminates me changing the db SECRET_KEY. Option 2: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Only the postgres approach will reliably replicate your Netbox installation. This is documented officially at https://docs.netbox.dev/en/stable/administration/replicating-netbox/ (not specifically for docker) There is no "db secret key" as such. The SECRET_KEY setting in configuration.py is not related to anything in the database. It is only used for validating cookies. If you were replacing an old Netbox instance or container with a new one, and you wanted users who had already logged into the old one to remain logged in on the new, then you'd match the values. Otherwise, if each one has its own random SECRET_KEY, then the users would have to login again on the second instance. As I understand it, dumpdata/loaddata is a Django feature for fixtures, i.e. creating small amounts of sample data for tests. I would not expect it to work reliably for production data with large volums and complex relationships between objects. For me (on netbox 3.6.2) it doesn't work at all:
|
Beta Was this translation helpful? Give feedback.
Only the postgres approach will reliably replicate your Netbox installation. This is documented officially at https://docs.netbox.dev/en/stable/administration/replicating-netbox/ (not specifically for docker)
There is no "db secret key" as such. The SECRET_KEY setting in configuration.py is not related to anything in the database. It is only used for validating cookies. If you were replacing an old Netbox instance or container with a new one, and you wanted users who had already logged into the old one to remain logged in on the new, then you'd match the values. Otherwise, if each one has its own random SECRET_KEY, then the users would have to login again on the second instance.
As I unde…