1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

Debian folder necessary for installing BGPalerter loosely following Debian guidelines

There are some aspects of this package which may not be Debian compliment.
specifically we vendor in all node dependencies.

The packaged produced will:

    create a bgpalerter use
    install systemd file
    install the binary to /usr/bin/bgpalert
    install dependencies
    install the example config files to /etc/bgpalerter/
This commit is contained in:
Massimo Candela
2022-01-12 18:44:46 +01:00
committed by jbond
parent 8fa7755794
commit dfe8cc58d8
20 changed files with 177 additions and 0 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ export.json
tests/kafka_tests/kafka_2.13-2.6.0/
tests/kafka_tests/kafka_2.13-2.6.0.tgz
tests/kafka_tests/nohup.out
*.sw?

View File

@ -25,3 +25,4 @@ index.js
.hound.yml
.eslintrc.json
.babelrc
debian/

View File

@ -46,6 +46,7 @@ Read the documentation below for more options.
- [Installation](docs/installation.md)
- [Run from binary](docs/installation.md#running-bgpalerter-from-binaries)
- [Run from source code](docs/installation.md#running-bgpalerter-from-the-source-code)
- [Build Debian Package](docs/installation.md#debian-package)
- [Run in Docker](docs/installation.md#running-bgpalerter-in-docker)
- [Run as a Linux service](docs/linux-service.md)
- [Command line options](docs/installation.md#bgpalerter-parameters)

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
node-bgpalerter (1.29.0-1) unstable; urgency=medium
* Initial release
-- John Bond <jbond@wikimedia.org> Fri, 14 Jan 2022 13:43:04 +0100

2
debian/conffiles vendored Normal file
View File

@ -0,0 +1,2 @@
/etc/bgpalerter/config.yml
/etc/bgpalerter/prefixes.yml

33
debian/control vendored Normal file
View File

@ -0,0 +1,33 @@
Source: node-bgpalerter
Section: javascript
Priority: optional
Maintainer: John Bond <jbond@wikimedia.org>
Testsuite: autopkgtest-pkg-nodejs
Build-Depends:
debhelper-compat (= 13)
, pkg-js-tools
, dh-exec
, nodejs (>= 6)
, node-babel7
, npm
Standards-Version: 4.6.0
Homepage: https://github.com/nttgin/BGPalerter#readme
Package: node-bgpalerter
Architecture: all
Depends:
${misc:Depends}
, nodejs (>= 6)
Description: Self-configuring BGP monitoring tool, which allows you to monitor in real-time if:
any of your prefixes loses visibility;
any of your prefixes is hijacked;
your AS is announcing RPKI invalid prefixes (e.g., not matching prefix length);
your AS is announcing prefixes not covered by ROAs;
any of your ROAs is expiring;
ROAs covering your prefixes are no longer reachable;
RPKI Trust Anchors malfunctions;
a ROA involving any of your prefixes or ASes was deleted/added/edited;
your AS is announcing a new prefix that was never announced before;
an unexpected upstream (left-side) AS appears in an AS path;
an unexpected downstream (right-side) AS appears in an AS path;
one of the AS paths used to reach your prefix matches a specific condition defined by you.

38
debian/copyright vendored Normal file
View File

@ -0,0 +1,38 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: bgpalerter
Upstream-Contact: https://github.com/nttgin/BGPalerter/issues
Source: https://github.com/nttgin/BGPalerter#readme
Files: *
Copyright: 2022, Massimo Candela (https://massimocandela.com)
License: BSD-3-Clause
Files: debian/*
Copyright: 2022, John Bond <jbond@wikimedia.org>
License: BSD-3-Clause
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1
debian/docs vendored Normal file
View File

@ -0,0 +1 @@
README.md

2
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,2 @@
[DEFAULT]
filter = [ '.gitignore', '.travis.yml', '.git*' ]

1
debian/node-bgpalerter.dirs vendored Normal file
View File

@ -0,0 +1 @@
/etc/bgpalerter

5
debian/node-bgpalerter.install vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/dh-exec
config.yml.example => etc/bgpalerter/config.yml
prefixes.yml.example => etc/bgpalerter/prefixes.yml
# required until sysuser support is added to debhelper-compat (expected in 14)
debian/node-bgpalerter.sysusers => usr/lib/sysusers.d/node-bgpalerter.conf

22
debian/node-bgpalerter.postinst vendored Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# The postinst file is required until sysuser support is added to debhelper-compat (expected in 14)
set -e
case "$1" in
configure)
systemd-sysusers
;;
abort-upgrade|abort-remove|abort-deconfigure)
:
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

13
debian/node-bgpalerter.service vendored Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=BGPalerter
After=network.target
[Service]
Type=simple
Restart=on-failure
User=bgpalerter
WorkingDirectory=/run/bgpalerter
ExecStart=/usr/bin/bgpalerter --config /etc/bgpalerter/config.yml
[Install]
WantedBy=multi-user.target

1
debian/node-bgpalerter.sysusers vendored Normal file
View File

@ -0,0 +1 @@
u bgpalerter - "BGPalerter daemon user"

1
debian/node-bgpalerter.tmpfiles vendored Normal file
View File

@ -0,0 +1 @@
d /run/bgpalerter - bgpalerter - - -

33
debian/rules vendored Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/make -f
export DH_VERBOSE = 1
%:
dh $@ --with nodejs
override_dh_auto_build:
babeljs index.js -d "${CURDIR}/build"
babeljs src -d "${CURDIR}/build/src"
cp package.json "${CURDIR}/build/"
cd "${CURDIR}/build" && npm pack
override_dh_auto_test:
/bin/true
override_dh_auto_install:
npm install --prefix "${CURDIR}/debian/node-bgpalerter/usr" -g ${CURDIR}/build/bgpalerter-*.tgz
find "${CURDIR}/debian/node-bgpalerter/usr" \
\( -name .npmignore -o -name .eslintrc -o -name .eslintrc.js -o -name \*.md -o -name LICENSE \
-o -name LICENSE-jsbn -o -name package.json -o -name .gitmodules -o -name .gitattributes \) \
-type f -delete
find "${CURDIR}/debian/node-bgpalerter/usr/lib/node_modules/bgpalerter/node_modules" \
\( -name examples -name .bin -o -name bin \) -type d -exec rm -rf {} +
override_dh_link:
# We dont want to link the vendored packages
/bin/true
override_dh_fixperms:
dh_fixperms
chmod +x "${CURDIR}/debian/node-bgpalerter/usr/lib/node_modules/bgpalerter/index.js"
override_dh_auto_clean:
rm -rf "${CURDIR}/build"

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

2
debian/source/options vendored Normal file
View File

@ -0,0 +1,2 @@
single-debian-patch
auto-commit

5
debian/watch vendored Normal file
View File

@ -0,0 +1,5 @@
version=4
opts=\
dversionmangle=auto,\
filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/node-bgpalerter-$1.tar.gz/ \
https://github.com/nttgin/BGPalerter/releases .*/archive.*/v?([\d\.]+).tar.gz

View File

@ -57,6 +57,15 @@ Additionally, you can configure [BGPalerter to run as a Linux Serivce](linux-ser
4. Run `npm run serve` to run the application.
## Debian packages
The git repo contains the neccesary debian scripts to build a debian package for this you
1. Git clone this repo.
2. build the package with your preferred tool e.g. `dpkg-buildpackage -us -uc`
3. Install the package `dpkg -i ../node-bgpalerter_1.29.0-1_all.deb
## Running BGPalerter in Docker