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

cloud-init

cloud-init is a set of Python scripts that allows an easy way to automate 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/000e7f98ea54d64bcca4ad9fdada568c68de9c69/netboxInstall.sh | bash'

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

Post Installation Login Information

Login and other information is stored in 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 set 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