Skip to content

Commit c0dec7c

Browse files
authored
Merge pull request #90 from cosmicpsyop/feature/ubuntu-pkg-job
create debian package framework and git action job
2 parents 5b7d3a2 + b02740d commit c0dec7c

File tree

10 files changed

+165
-0
lines changed

10 files changed

+165
-0
lines changed

.github/workflows/ubuntu.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ubuntu
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ubuntu:
7+
runs-on: ubuntu-latest
8+
name: A job to build and run strfry on Ubuntu
9+
steps:
10+
- name: Checkout strfry
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Build strfry
16+
run: |
17+
sudo apt update && sudo apt install -y --no-install-recommends \
18+
git g++ make pkg-config libtool ca-certificates \
19+
libyaml-perl libtemplate-perl libregexp-grammars-perl libssl-dev zlib1g-dev \
20+
liblmdb-dev libflatbuffers-dev libsecp256k1-dev libzstd-dev
21+
git submodule update --init
22+
make setup-golpe
23+
make -j4
24+
if ! [ -f ./strfry ]; then
25+
echo "Strfry build failed."
26+
exit 1
27+
fi
28+
29+
- name: Package strfry
30+
run: |
31+
sudo apt-get install debhelper devscripts -y
32+
dpkg-buildpackage --build=binary -us -uc
33+
mv ../*.deb .
34+
filename=`ls *.deb | grep -v -- -dbgsym`
35+
echo "filename=$filename" >> $GITHUB_ENV
36+
37+
- name: Upload strfry deb
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: ${{ env.filename }}
41+
path: ${{ env.filename }}
42+
43+
- name: Run strfry
44+
run: |
45+
cat /etc/os-release
46+
sudo ./strfry relay &
47+

debian/changelog

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
strfry (0.9.6-1) unstable; urgency=low
2+
3+
* Initial ubuntu test release
4+
5+
-- Doug Hoytech <[email protected]> Fri, 22 Sep 2023 17:32:21 +0800
6+

debian/compat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11

debian/control

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Source: strfry
2+
Section: admin
3+
Priority: optional
4+
Maintainer: Doug Hoytech <[email protected]>
5+
Build-Depends: debhelper (>= 8.0.0)
6+
7+
Package: strfry
8+
Architecture: amd64
9+
Depends: ${shlibs:Depends}
10+
Conflicts:
11+
Replaces:
12+
Provides: strfry
13+
Description: strfry is a relay for the nostr protocol

debian/copyright

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: strfry
3+
Upstream-Contact: Doug Hoytech <[email protected]>
4+
Source: https://github.com/hoytech/strfry
5+
6+
Files: *
7+
Copyright: 2023 Doug Hoytech
8+
License: GPL-3
9+
10+
License: GPL-3
11+
This program is free software: you can redistribute it and/or modify
12+
it under the terms of the GNU General Public License as published by
13+
the Free Software Foundation, either version 3 of the License, or
14+
(at your option) any later version.
15+
.
16+
This program is distributed in the hope that it will be useful,
17+
but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
GNU General Public License for more details.
20+
.
21+
You should have received a copy of the GNU General Public License
22+
along with this program. If not, see <https://www.gnu.org/licenses/>.

debian/postinst

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if ! getent group strfry >/dev/null 2>&1; then
6+
addgroup --system --quiet strfry
7+
fi
8+
if ! getent passwd strfry >/dev/null 2>&1; then
9+
adduser --system --quiet --ingroup strfry \
10+
--no-create-home --home /nonexistent \
11+
strfry
12+
fi
13+
14+
if [ "$1" = "configure" ] ; then
15+
chown strfry:strfry /etc/strfry.conf
16+
chown strfry:strfry /var/lib/strfry
17+
18+
systemctl daemon-reload
19+
systemctl enable strfry.service
20+
systemctl start strfry
21+
fi

debian/postrm

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
6+
systemctl --system daemon-reload >/dev/null || true
7+
fi
8+
if [ "$1" = "purge" ]; then
9+
if [ -x "/usr/bin/deb-systemd-helper" ]; then
10+
deb-systemd-helper purge 'strfry.service' >/dev/null || true
11+
fi
12+
fi

debian/prerm

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ "$1" = "remove" ]; then
6+
systemctl stop strfry
7+
systemctl disable strfry
8+
fi
9+
10+
if [ "$1" = "upgrade" ]; then
11+
systemctl stop strfry
12+
fi

debian/rules

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/make -f
2+
3+
#export DH_VERBOSE=1
4+
5+
%:
6+
dh $@ --parallel
7+
8+
override_dh_auto_clean:
9+
override_dh_auto_install:
10+
mkdir -p debian/strfry/usr/bin/
11+
mkdir -p debian/strfry/etc/
12+
mkdir -p debian/strfry/var/lib/strfry/
13+
cp -a strfry debian/strfry/usr/bin/.
14+
cp -a strfry.conf debian/strfry/etc/.
15+
sed -i 's|./strfry-db/|/var/lib/strfry/|g' debian/strfry/etc/strfry.conf

debian/strfry.service

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Unit]
2+
Description=strfry relay service
3+
After=syslog.target network.target
4+
5+
[Service]
6+
User=strfry
7+
ExecStart=/usr/bin/strfry relay
8+
Restart=on-failure
9+
RestartSec=5
10+
ProtectHome=yes
11+
NoNewPrivileges=yes
12+
ProtectSystem=full
13+
LimitCORE=1000000000
14+
15+
[Install]
16+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)