summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO60
-rw-r--r--PKGBUILD87
-rw-r--r--gunicorn_config.py5
-rw-r--r--netbox-rq.service21
-rw-r--r--netbox.install36
-rw-r--r--netbox.service22
-rw-r--r--netbox.sysuser1
-rw-r--r--netbox.tmpfile1
8 files changed, 233 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..27d694fed266
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,60 @@
+# Generated by mksrcinfo v8
+# Fri Feb 26 03:03:36 UTC 2021
+pkgbase = netbox-git
+ pkgdesc = IP address management (IPAM) and data center infrastructure management (DCIM) tool.
+ pkgver = v2.10.4.r28.b1cd634ab
+ pkgrel = 1
+ url = https://github.com/netbox-community/netbox.git
+ install = netbox.install
+ arch = any
+ license = Apache-2.0
+ depends = python
+ depends = gunicorn
+ depends = libffi
+ depends = libpgf
+ depends = openssl
+ depends = python-coreapi
+ depends = python-pycryptodomex
+ depends = python-django
+ depends = python-django-cors-headers
+ depends = python-django-debug-toolbar
+ depends = python-django-filter
+ depends = python-django-mptt
+ depends = python-django-rest-framework
+ depends = python-django-rest-swagger
+ depends = python-django-tables2
+ depends = python-graphviz
+ depends = python-lxml
+ depends = python-markdown
+ depends = python-natsort
+ depends = python-ncclient
+ depends = python-netaddr
+ depends = python-openapi-codec
+ depends = python-paramiko
+ depends = python-pillow
+ depends = python-py-gfm
+ depends = python-pytz
+ depends = python-psycopg2
+ depends = python-simplejson
+ depends = python-xmltodict
+ depends = python-yaml
+ provides = netbox
+ conflicts = netbox
+ replaces = netbox
+ backup = etc/netbox/gunicorn.py
+ backup = etc/netbox/configuration.py
+ source = netbox::git+https://github.com/netbox-community/netbox.git
+ source = netbox.service
+ source = netbox-rq.service
+ source = netbox.tmpfile
+ source = netbox.sysuser
+ source = gunicorn_config.py
+ md5sums = SKIP
+ md5sums = 1e44aed0029d2e3e2995bcec253586ca
+ md5sums = 90ea43c475c3d2b6f2e3990e8a3d9899
+ md5sums = 38488c7c89e416f70e5694b67d1c735c
+ md5sums = 16c9be659fa0449794edf98b37a54454
+ md5sums = 054ce4db516adc2147f5180ea56e4653
+
+pkgname = netbox-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..cd8518398fc4
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,87 @@
+# Maintainer: Aleksandr <contact via dot aur>
+# Contributor: Anthony Ruhier <anthony.ruhier@gmail.com>
+
+pkgname=netbox-git
+pkgver=v2.10.4.r28.b1cd634ab
+pkgrel=1
+pkgdesc="IP address management (IPAM) and data center infrastructure management (DCIM) tool."
+arch=('any')
+url="https://github.com/netbox-community/netbox.git"
+license=('Apache-2.0')
+depends=('python'
+ 'gunicorn'
+ 'libffi'
+ 'libpgf'
+ 'openssl'
+ 'python-coreapi'
+ 'python-pycryptodomex'
+ 'python-django'
+ 'python-django-cors-headers'
+ 'python-django-debug-toolbar'
+ 'python-django-filter'
+ 'python-django-mptt'
+ 'python-django-rest-framework'
+ 'python-django-rest-swagger'
+ 'python-django-tables2'
+ 'python-graphviz'
+ 'python-lxml'
+ 'python-markdown'
+ 'python-natsort'
+ 'python-ncclient'
+ 'python-netaddr'
+ 'python-openapi-codec'
+ 'python-paramiko'
+ 'python-pillow'
+ 'python-py-gfm'
+ 'python-pytz'
+ 'python-psycopg2'
+ 'python-simplejson'
+ 'python-xmltodict'
+ 'python-yaml')
+
+provides=("${pkgname%-git}")
+conflicts=("${pkgname%-git}")
+replaces=("${pkgname%-git}")
+install="${pkgname%-git}.install"
+
+source=("netbox::git+$url"
+ "${pkgname%-git}.service"
+ "${pkgname%-git}-rq.service"
+ "${pkgname%-git}.tmpfile"
+ "${pkgname%-git}.sysuser"
+ 'gunicorn_config.py')
+backup=('etc/netbox/gunicorn.py' 'etc/netbox/configuration.py')
+
+md5sums=('SKIP'
+ '1e44aed0029d2e3e2995bcec253586ca'
+ '90ea43c475c3d2b6f2e3990e8a3d9899'
+ '38488c7c89e416f70e5694b67d1c735c'
+ '16c9be659fa0449794edf98b37a54454'
+ '054ce4db516adc2147f5180ea56e4653')
+
+pkgver() {
+ cd "$srcdir/${pkgname%-git}"
+
+ printf "%s" "$(git describe --long --tags | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
+
+}
+
+package() {
+ cd "$srcdir/${pkgname%-git}"
+
+ install -d -m775 "$pkgdir/etc/${pkgname%-git}"
+ install -d "$pkgdir/opt/"${pkgname%-git}
+ cp -r . "$pkgdir/opt/${pkgname%-git}"
+
+ install -D -m644 ../${pkgname%-git}.service "$pkgdir/usr/lib/systemd/system/${pkgname%-git}.service"
+ install -D -m644 ../${pkgname%-git}-rq.service "$pkgdir/usr/lib/systemd/system/${pkgname%-git}-rq.service"
+ install -D -m644 ../${pkgname%-git}.tmpfile "$pkgdir/usr/lib/tmpfiles.d/${pkgname%-git}.conf"
+ install -D -m644 ../${pkgname%-git}.sysuser "$pkgdir/usr/lib/sysusers.d/${pkgname%-git}.conf"
+
+ install -d "$pkgdir/etc/${pkgname%-git}"
+ install -D -m644 ../gunicorn_config.py "$pkgdir/etc/${pkgname%-git}/gunicorn.py"
+ install -D -m644 ${pkgname%-git}/${pkgname%-git}/configuration.example.py "$pkgdir/etc/${pkgname%-git}/configuration.py"
+ ln -s /etc/netbox/configuration.py "$pkgdir/opt/${pkgname%-git}/${pkgname%-git}/configuration.py"
+}
+
+# vim: set ts=2 sw=2 ft=sh noet:
diff --git a/gunicorn_config.py b/gunicorn_config.py
new file mode 100644
index 000000000000..4cb7111fac44
--- /dev/null
+++ b/gunicorn_config.py
@@ -0,0 +1,5 @@
+command = '/usr/bin/gunicorn'
+pythonpath = '/opt/netbox/netbox'
+bind = '127.0.0.1:8001'
+workers = 3
+user = 'netbox'
diff --git a/netbox-rq.service b/netbox-rq.service
new file mode 100644
index 000000000000..77d70910c703
--- /dev/null
+++ b/netbox-rq.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=NetBox Request Queue Worker
+Documentation=https://netbox.readthedocs.io/en/stable/
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+
+User=netbox
+Group=netbox
+WorkingDirectory=/opt/netbox
+
+ExecStart=/opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py rqworker
+
+Restart=on-failure
+RestartSec=30
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/netbox.install b/netbox.install
new file mode 100644
index 000000000000..78cd535c86f8
--- /dev/null
+++ b/netbox.install
@@ -0,0 +1,36 @@
+# Colors
+note() {
+ printf "${BLUE}==>${ALL_OFF}${BOLD} NOTE:${ALL_OFF} ${1}\n"
+}
+
+ALL_OFF="$(tput sgr0)"
+BOLD="$(tput bold)"
+BLUE="${BOLD}$(tput setaf 4)"
+GREEN="${BOLD}$(tput setaf 2)"
+
+
+_NAME=netbox
+post_install() {
+ echo ""
+ note "Follow the instructions on http://netbox.readthedocs.io/en/latest/installation/netbox/"
+ note "to finish the configuration, and enable and start the systemd service: "
+ note " systemctl enable --now netbox.service"
+ note ""
+ note "Tweak the netbox and gunicorn configuration in "
+ note "/etc/netbox/configuration.py and /etc/netbox/gunicorn.py"
+ echo ""
+}
+
+post_upgrade() {
+ echo ""
+ note "To end the migration, use the following commands:"
+ note " /opt/netbox/manage.py migrate"
+ note " /opt/netbox/manage.py collectstatic --noinput"
+ echo ""
+}
+
+post_remove() {
+ rm -fr /run/${_NAME}
+ userdel -f ${_NAME}
+}
+
diff --git a/netbox.service b/netbox.service
new file mode 100644
index 000000000000..2314c468f8d0
--- /dev/null
+++ b/netbox.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=NetBox WSGI Service
+Documentation=https://netbox.readthedocs.io/en/stable/
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+
+User=netbox
+Group=netbox
+PIDFile=/run/netbox/netbox.pid
+WorkingDirectory=/opt/netbox
+
+ExecStart=/usr/bin/gunicorn --pid /run/netbox/netbox.pid --pythonpath /opt/netbox --config /etc/netbox/gunicorn.py netbox.wsgi
+
+Restart=on-failure
+RestartSec=30
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/netbox.sysuser b/netbox.sysuser
new file mode 100644
index 000000000000..4b5f7a8285d3
--- /dev/null
+++ b/netbox.sysuser
@@ -0,0 +1 @@
+u netbox - "netbox user" /opt/netbox /usr/bin/false
diff --git a/netbox.tmpfile b/netbox.tmpfile
new file mode 100644
index 000000000000..f1ac6975f79f
--- /dev/null
+++ b/netbox.tmpfile
@@ -0,0 +1 @@
+d /run/netbox 0775 netbox netbox