Skip to content

Commit add241a

Browse files
authored
Merge pull request #3 from starwit/feature/AB#1623-apt-package
Feature/ab#1623 apt package
2 parents eba9fb6 + 92f72f1 commit add241a

20 files changed

Lines changed: 301 additions & 21 deletions

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.PHONY: install build-deb clean
2+
3+
export PACKAGE_NAME=rediswriter
4+
5+
install:
6+
poetry install
7+
8+
check-settings:
9+
./check_settings.sh
10+
11+
build-deb: check-settings
12+
dpkg-buildpackage -us -uc
13+
mkdir -p target
14+
mv ../${PACKAGE_NAME}_* target/
15+
16+
clean:
17+
rm -rf dist
18+
rm -rf target
19+
rm -rf *.egg-info
20+
rm -rf debian/.debhelper
21+
rm -f debian/files
22+
rm -f debian/*.substvars
23+
rm -f debian/*.log
24+
rm -f debian/debhelper-build-stamp
25+
rm -f debian/${PACKAGE_NAME}.postinst.debhelper
26+
rm -f debian/${PACKAGE_NAME}.postrm.debhelper
27+
rm -f debian/${PACKAGE_NAME}.prerm.debhelper
28+
rm -rf debian/${PACKAGE_NAME}
29+
rm -f *.tar.gz

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
# SAE-redis-writer
2-
The intention of this stage is to write received SAE messages to a different redis instance.
1+
# SAE Redis Writer
2+
3+
This component is part of the Starwit Awareness Engine (SAE). See umbrella repo here: https://github.com/starwit/vision-pipeline-k8s
4+
5+
The intention of this stage is to write received SAE messages to a different redis/[valkey](https://valkey.io/) instance. This means data created by SAE can be transfered to a backend
6+
37
The following features are planned:
48
- Aggregate all messages into a single output stream, therefore leaving it to the receiver to filter (this should be feasible, because messages without frame data are magnitudes smaller, see below)
59
- Remove all frame data for privacy and volume reasons
610

11+
## How to Build
12+
13+
See [dev readme](doc/DEV_README.md) for build instructions.
14+
715
## TLS
816
If TLS is enabled in the settings the Redis client will perform mutual TLS with the Redis server. \
917
You can find a helper script to generate a working set of CA / client / server certs for testing here: \

check_settings.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Check if settings.yaml exists
4+
if [ ! -f "settings.yaml" ]; then
5+
echo "settings.yaml not found. Creating from template..."
6+
cp settings.template.yaml settings.yaml
7+
echo "settings.yaml created successfully."
8+
else
9+
echo "settings.yaml already exists."
10+
fi

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
rediswriter (1.3.0) unstable; urgency=medium
2+
3+
* Initial release.
4+
5+
-- Florian Stanek <foss@starwit.de> Sun, 08 Jun 2025 00:00:00 +0000

debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11

debian/control

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Source: rediswriter
2+
Section: python
3+
Priority: optional
4+
Maintainer: Florian Stanek <foss@starwit.de>
5+
Build-Depends: debhelper (>= 11), dh-python, python3-all (>= 3.10), python3-setuptools, python3-pip
6+
Standards-Version: 4.1.3
7+
Homepage: https://starwit.de
8+
9+
Package: rediswriter
10+
Architecture: all
11+
Depends: ${misc:Depends}, ${python3:Depends}, python3 (>= 3.10), python3 (<< 3.13),
12+
python3-pydantic, python3-opencv,
13+
python3-redis, python3-prometheus-client,
14+
libturbojpeg, python3-pip, git
15+
XB-Python-Version: ${python:Versions}
16+
Description: Message Forwarding Component
17+
Part of Starwit's Awareness Engine. This component takes care of
18+
forwarding detected objects to a backend valkey/redis server.

debian/install

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
settings.yaml /etc/starwit/rediswriter
2+
main.py /opt/starwit/rediswriter
3+
4+
debian/rediswriter.service /usr/lib/systemd/system/

debian/postinst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Install Python packages that aren't available via APT
5+
if [ "$1" = "configure" ]; then
6+
echo "Object Detector: Installing Python dependencies"
7+
pip3 install --upgrade pip
8+
pip3 install pyturbojpeg
9+
pip3 install git+https://github.com/starwit/vision-api.git@3.2.0#subdirectory=python/visionapi
10+
pip3 install git+https://github.com/starwit/vision-lib.git@0.11.2#subdirectory=python
11+
12+
echo "Create wrapper script"
13+
mkdir -p /usr/local/bin
14+
cat > /usr/local/bin/rediswriter <<EOF
15+
#!/bin/bash
16+
17+
current_dir=$PWD
18+
cd /opt/starwit/rediswriter
19+
20+
python3 main.py "\$@"
21+
cd $current_dir
22+
EOF
23+
chmod +x /usr/local/bin/rediswriter
24+
25+
# link settings file from etc
26+
cd /opt/starwit/rediswriter
27+
ln -s /etc/starwit/rediswriter/settings.yaml settings.yaml
28+
29+
systemctl daemon-reload
30+
systemctl start rediswriter.service
31+
systemctl enable rediswriter.service
32+
fi
33+
34+
#DEBHELPER#
35+
36+
exit 0

debian/preinst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
mkdir -p /etc/starwit/rediswriter
4+
mkdir -p /opt/starwit/rediswriter

debian/prerm

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
5+
6+
# Stop the service
7+
systemctl stop rediswriter.service
8+
9+
# Disable the service
10+
systemctl disable rediswriter.service
11+
12+
# Remove the service file
13+
rm -f /etc/systemd/system/rediswriter.service
14+
15+
systemctl daemon-reload
16+
17+
# Remove the wrapper script
18+
rm -f /usr/local/bin/rediswriter
19+
20+
# Remove application directory
21+
rm -rf /opt/starwit/rediswriter
22+
23+
# Remove config files directory
24+
rm -rf /etc/starwit/rediswriter
25+
fi
26+
27+
#DEBHELPER#
28+
29+
exit 0

0 commit comments

Comments
 (0)