OpenTechShed

Blog of Things

Deploying NetBox on Digital Ocean

In an earlier post, I went through the details on how to install and configure NetBox on CentOS 7. This post captures an automated way of deploying NetBox on a Digital Ocean droplet.

The automated process has been tested only on CentOS 7 droplet and will install and configure the following:

  1. PostgreSQL 10
  2. Apache
  3. Gunicorn
  4. Supervisord
  5. NetBox

Once installed, you should be able to login to NetBox by browsing to http://ip.address.of.droplet:8000. Login information is stored in /root/netbox-info.log.

As part of this installation, selinux is disabled on the server.

cloud-init

cloud-init is a set of Python scripts that allows an easy way to automate the initial configuration of a cloud compute instance. You can read more about cloud-init at https://cloudinit.readthedocs.io/en/latest/

cloud-init config below can be used at Digital Ocean to configure a droplet with NetBox. This needs to be copied in the “User data” section when a droplet is being created.

#cloud-config
package_upgrade: true
runcmd:
- 'curl -sSL https://gist.githubusercontent.com/gauravsabharwal/c05684d99b7ae28f2e48a096c6589082/raw/753ba18082262f1cca8354f50c11ec46a8dcbc79/netboxInstall.sh | bash'

Below is a demo on how to deploy a droplet in Digital Ocean.

Post Installation Login Information

Login and other information are stored in a file called netbox-info.log under the root directory of your server.

NetBox Install Complete
DROPLETNAME: $DROPLETNAME
DROPLETIP: $DROPLETIP
Database Password: $DBPASS
Netbox Admin: $NBADMIN
Netbox Email: $NBADMINEMAIL
Netbox Password: $NBPASS

where,

$DROPLETNAME – Name of your droplet
$DROPLETIP – The IP address of your droplet
$DBPASS – The password used for the database. The username is netbox
$NBADMIN – The admin username, which is set to admin by default
$NBADMINEMAIL – The email address of the admin user, set to admin@example.com
$NBPASS – Randomly generated password for NetBox admin user.

Install takes approximately two to three minutes on the $5/mo droplet.

Troubleshooting

If for some reason the software installation is not complete, there are two sets of logs that you can refer to:

  1. /tmp/netbox-install.log – created by the script.
  2. /var/log/cloud-init.log – captures the same content as the script and if there were any issues with cloud-init.
print

Previous

NetBox Installation and Configuration on CentOS 7

Next

PowerCLI Core on CentOS 7

4 Comments

  1. Charlie

    Hi,

    Does this still work? I’ve tried setting it up today but don’t get any login page at my dropletip:8000.

    Thank

    • gaurav

      Hi Charlie,

      Thanks for reporting this issue.

      Netbox was unable to start due to PyYAML being installed as part of the distribution and pip 10 being unable to install PyYAML 3.11, which is required by flex 6.11. You can see details of pip issue at https://github.com/pypa/pip/issues/4805

      In order to resolve the issue, I have updated the gist and commented out line

      pip install –upgrade pip

      There was another issue if selinux was set to enforcing. That has been resolved as well. Tested it on latest CentOS 7.5 Droplet.

      Please use the latest cloud-init config block in the blog post.

      Gaurav

  2. Kemp Watson

    This is great, thank you so much! But for me, anyway, I can’t get the GraphVis system working – no Topology Maps… is this an oversight, or my error somehow?

    Other side comments: would be great on Ubuntu LTS (18.04?), and would be even greater if DO would make this a One-click App – after all, it’s their creation! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *