19/09/2016

Run NetBox on Rancher - Docker Compose

If you manage many of dedicated servers and networks, you will need a "Source of Truth" to do that efficiently. From time to time I try to find a better solution to do that.

So I decided to give "NetBox" a try! But what is NetBox?

NetBox is an open source web application designed to help manage and document computer networks. Initially conceived by the network engineering team at DigitalOcean, NetBox was developed specifically to address the needs of network and infrastructure engineers. It encompasses the following aspects of network management:
  • IP address management (IPAM) - IP networks and addresses, VRFs, and VLANs
  • Equipment racks - Organized by group and site
  • Devices - Types of devices and where they are installed
  • Connections - Network, console, and power connections among devices
  • Data circuits - Long-haul communications circuits and providers
  • Secrets - Encrypted storage of sensitive credentials

I really like it, and even I started to write a Python script to use Netbox as Ansible inventory! (Ansible dynamic inventory).

But when I started try it on Docker, I found the project uses Docker compose v2! And till time of writing this words, Rancher doesn't support v2 of Docker compose! (it's still beta) So I needed to do some modifications on the original NetBox Docker compose file.

So here is docker-compose.yml that works with Rancher. Simply I moved "netbox" container to be part of "nginx" as "sidekick", so both can share the same volume. And this is the same one the project provides.

nginx:
  labels:
  command: nginx -g 'daemon off;' -c /etc/netbox-nginx/nginx.conf
  image: nginx:1.11.1-alpine
  links:
  - 'postgres:postgres'
  - 'netbox:netbox'
  volumes_from:
  - netbox
netbox:
    io.rancher.sidekicks: nginx
  environment:
    ALLOWED_HOSTS: localhost
    DB_HOST: postgres
    DB_NAME: netbox
    DB_PASSWORD: J5brHrAXFLQSif0K
    DB_USER: netbox
    EMAIL_FROM: netbox@bar.com
    EMAIL_PASSWORD: bar
    EMAIL_PORT: '25'
    EMAIL_SERVER: localhost
    EMAIL_TIMEOUT: '10'
    EMAIL_USERNAME: foo
    NETBOX_PASSWORD: guest
    NETBOX_USERNAME: guest
    SECRET_KEY: r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj
    SUPERUSER_EMAIL: admin@example.com
    SUPERUSER_NAME: admin
    SUPERUSER_PASSWORD: admin
  entrypoint:
  - /docker-entrypoint.sh
  image: digitalocean/netbox
  links:
  - 'postgres:'
  working_dir: /opt/netbox
  volumes:
  - netbox-static-files:/opt/netbox/netbox/static
postgres:
  environment:
    POSTGRES_DB: netbox
    POSTGRES_PASSWORD: J5brHrAXFLQSif0K
    POSTGRES_USER: netbox
  image: postgres:9.6

After I tested it, I think Netbox is pretty nice and it's very promising. Maybe there are many things that are missing, but its dev team is still working on a lot of enhancements!

Powered by Blogger.

Hello, my name is Ahmed AbouZaid, I'm a passionate Tech Lead DevOps Engineer. 👋

I specialize in Cloud-Native and Kubernetes. I'm also a Free/Open source geek and book author. My favorite topics are DevOps transformation, DevSecOps, automation, data, and metrics.

More about me ➡️

Contact Me

Name

Email *

Message *

Start Your DevOps Engineer Journey!

Start Your DevOps Engineer Journey!
Start your DevOps career for free the Agile way in 2024 with the Dynamic DevOps Roadmap ⭐

Latest Post

Bootstrap Cloud-Native bootstrappers like Crossplane with K3d - Automation

I created a logo for the Crossplane Bootstrapper because all good projects deserve a logo. 😁 TL;DR ...

Popular Posts

Blog Archive