A fairly straightforward docker setup for netbox. Contains Postgres, Redis, and nginx as webserver front-end.
Simply invoke the build.sh
script. It will clone the netbox repository
and start downloading/building the containers.
git clone https://github.com/poorting/netbox-docker
cd netbox-docker
./build.sh
After the script finishes, follow the logs with:
docker-compose logs -f
The first setup can take some time. The logs will show all the Django migrations being carried out (which means tables needed for netbox are created). After some time the scrolling will stop with these messages:
netbox_netbox | Superuser created successfully.
netbox_netbox | [2021-08-07 19:39:21 +0000] [17] [INFO] Starting gunicorn 20.1.0
netbox_netbox | [2021-08-07 19:39:21 +0000] [17] [INFO] Listening at: http://0.0.0.0:8000 (17)
netbox_netbox | [2021-08-07 19:39:21 +0000] [17] [INFO] Using worker: sync
netbox_netbox | [2021-08-07 19:39:21 +0000] [18] [INFO] Booting worker with pid: 18
Which means everything is ready. Go to http://localhost/ and login with the credentials you supplied to the build script. You will see a message about an invalid certificate, since the certificate generated by default by the build script is a self-signed certificate for localhost.
If your machine has a domain name you can request a letsencrypt certificate with the letsencrypt.sh
script.
Supply a valid e-mail in order to request a production certificate; if you don't specify an e-mail address then
a test certificate will be requested.
The certificate's validity is checked automatically once a day and will be renewed when it will expire within 30 days.
If needed for some reason you can backup the certificates with the backup.sh
script (and restore them with restore.sh
)