项目作者: leoluk

项目描述 :
OpenShift deployment for Netbox
高级语言: Python
项目地址: git://github.com/leoluk/openshift-netbox.git
创建时间: 2019-01-16T15:07:01Z
项目社区:https://github.com/leoluk/openshift-netbox

开源协议:GNU General Public License v3.0

下载


openshift-netbox

NOTE: Multiple companies are using this in production, but the interfaces are
not stable yet. Take a look at changes and reconcile them with your production
setup before updating the base image or reapplying the k8s config!

OpenShift/okd.io1 deployment for Netbox.

Requires a cluster with persistent storage. Make sure that the oc client is
set up for the right project before you deploy.

Create application:

  1. oc process -f openshift/netbox-base.yaml | oc create -f -
  2. oc process -f openshift/netbox.yaml FQDN=netbox.example.com | oc create -f -

Tear down:

  1. oc delete all,secret,pvc,configmap,serviceaccount -l app=netbox

Rebuild:

  1. oc start-build netbox-base -F
  2. oc start-build netbox -F

Rebuild base image from local repo:

  1. oc start-build -F netbox-base --from-dir=.

Create superuser:

  1. oc rsh dc/netbox netbox/manage.py createsuperuser

Import fixtures (if desired):

  1. oc rsh dc/netbox netbox/manage.py loaddata initial_data

Give superuser permissions to a user:

  1. oc rsh dc/netbox netbox/manage.py shell
  2. >>> from django.contrib.auth.models import User
  3. >>> u = User.objects.get(id=1)
  4. >>> u.is_staff = True
  5. >>> u.is_superuser = True
  6. >>> u.save()

Database backup/restore:

  1. oc rsh --no-tty dc/netbox-db bash -c 'pg_dump --username=$POSTGRESQL_USER --format=custom $POSTGRESQL_DATABASE' > dumpfile
  2. oc rsh --no-tty dc/netbox-db bash -c 'pg_restore --username=$POSTGRESQL_USER --clean --dbname=$POSTGRESQL_DATABASE' < dumpfile

(Expect the error messages must be owner of extension plpgsql and must be owner of schema public from pg_restore. These can be ignored.)

Media backup/restore:

  1. oc rsync $(oc get pods -l app=netbox -o name):/opt/app-root/media/ backup-directory/
  2. oc rsync backup-directory/ $(oc get pods -l app=netbox -o name):/opt/app-root/media/

Refer to the installation instructions for further steps:

  1. https://netbox.readthedocs.io/en/stable/installation/2-netbox/