Skip to content

Commit

Permalink
add deploy directory
Browse files Browse the repository at this point in the history
Contains a quick and dirty solution to build with fpm.
  • Loading branch information
cite committed Feb 13, 2019
1 parent 0a7d0ae commit c830511
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
11 changes: 11 additions & 0 deletions deploy/before-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

name=pydtm
getent group $name >/dev/null 2>&1 \
|| groupadd -r $name >/dev/null 2>&1 \
|| true
getent passwd $name >/dev/null 2>&1 \
|| useradd -g $name -c "$name service" \
-d /var/lib/$name -M -s /sbin/nologin -r \
-G video $name >/dev/null 2>&1 \
|| true
22 changes: 22 additions & 0 deletions deploy/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#/bin/bash

release=${RELEASE:-0}
# TODO: read from git tags?
if [ -z "$VERSION" ]; then
echo '$VERSION not set, exiting' 1>&2
exit 1
fi

# build root filesystem
root=$(mktemp -d)
install -m 0755 -d $root/{lib/systemd/system,etc,usr/bin,var/lib/pydtm}
install -m 0644 pydtm.service $root/lib/systemd/system/
install -m 0644 pydtm.env $root/etc/
install -m 0755 -T ../pydtm.py $root/usr/bin/pydtm

# build package
fpm -s dir -t deb -n pydtm -v $VERSION-$release -C $root \
--description "carbon API server" \
--before-install before-install.sh \
-d python \
etc lib usr var
9 changes: 9 additions & 0 deletions deploy/pydtm.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Environment File for pydtm

# PYDTM_ADAPTER=0
# PYDTM_CARBON=localhost:2003
# PYDTM_DEBUG is not set by default
# PYDTM_FREQUENCIES=546:256,554:256,562:64,650:64
# PYDTM_PREFIX=docsis
# PDTM_STEP=60
# PYDTM_TUNER=0
12 changes: 12 additions & 0 deletions deploy/pydtm.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=pydtm - Python (Euro)DOCSIS Traffic Meter
After=syslog.target network.target

[Service]
User=pydtm
EnvironmentFile=/etc/pydtm.env
ExecStart=/usr/bin/pydtm
Restart=on-failure

[Install]
WantedBy=multi-user.target

0 comments on commit c830511

Please sign in to comment.