Update Debian / Ubuntu packaging.

This commit is contained in:
Orne Brocaar 2022-04-23 11:31:54 +01:00
parent 7309a35a3b
commit a2e4e0d8a2
11 changed files with 68 additions and 8 deletions

9
.gitignore vendored
View File

@ -4,11 +4,18 @@
# Log files # Log files
*.log *.log
# Binary packages
*.deb
# Rust target directory # Rust target directory
**/target **/target
# Certificates # Certificates
/chirpstack/configuration/certs /chirpstack/configuration/certs/*.crt
/chirpstack/configuration/certs/*.key
/chirpstack/configuration/certs/*.trust
/chirpstack/configuration/certs/*.pem
/chirpstack/configuration/certs/*.csr
/chirpstack/configuration/private_*.toml /chirpstack/configuration/private_*.toml
# UI # UI

View File

@ -20,6 +20,7 @@ RUN apt-get update && \
rpm \ rpm \
clang \ clang \
yarnpkg \ yarnpkg \
golang-cfssl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/yarnpkg /usr/bin/yarn RUN ln -s /usr/bin/yarnpkg /usr/bin/yarn

View File

@ -6,6 +6,10 @@ build-debug:
build-release: build-release:
docker-compose run --rm chirpstack make release docker-compose run --rm chirpstack make release
# Builds a .deb release package.
build-release-deb:
docker-compose run --rm chirpstack make release-deb
# Builds the UI. # Builds the UI.
build-ui: build-ui:
docker-compose run --rm chirpstack-ui make build docker-compose run --rm chirpstack-ui make build

View File

@ -112,7 +112,10 @@ httpmock = "0.6"
assets = [ assets = [
["target/release/chirpstack", "usr/bin/", "755"], ["target/release/chirpstack", "usr/bin/", "755"],
["configuration/*.toml", "etc/chirpstack/", "640"], ["configuration/*.toml", "etc/chirpstack/", "640"],
["configuration/certs/*.json", "etc/chirpstack/certs", "640"],
["debian/environment.conf", "etc/systemd/system/chirpstack.service.d/environment.conf", "640"],
] ]
depends = "$auto, golang-cfssl"
suggests = "postgresql, mosquitto, redis"
maintainer-scripts = "debian/" maintainer-scripts = "debian/"
systemd-units = { enable = true } systemd-units = { enable = true }

View File

@ -17,12 +17,14 @@ test:
test-lrwn: test-lrwn:
cd ../lrwn && make test cd ../lrwn && make test
test-server: debug configuration/certs test-server: debug configuration/certs/ca.pem
../target/debug/chirpstack -c ./configuration /target/debug/chirpstack -c ./configuration
dbshell: dbshell:
psql -h postgres -U chirpstack chirpstack psql -h postgres -U chirpstack chirpstack
configuration/certs: configuration/certs/ca.pem:
mkdir configuration/certs cfssl gencert -initca configuration/certs/ca-csr.json | cfssljson -bare configuration/certs/ca
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/CN=ChirpStack test CA" -keyout configuration/certs/ca.key -out configuration/certs/ca.crt
configuration/certs/mqtt-server.pem: configuration/certs/ca.pem
cfssl gencert -ca configuration/certs/ca.pem -ca-key configuration/certs/ca-key.pem -config configuration/certs/ca-config.json -profile server configuration/certs/mqtt-server.json | cfssljson -bare configuration/certs/mqtt-server

View File

@ -0,0 +1,17 @@
{
"signing": {
"default": {
"expiry": "8760h"
},
"profiles": {
"server": {
"expiry": "8760h",
"usages": [
"signing",
"key encipherment",
"server auth"
]
}
}
}
}

View File

@ -0,0 +1,7 @@
{
"CN": "ChirpStack CA",
"key": {
"algo": "rsa",
"size": 4096
}
}

View File

@ -0,0 +1,10 @@
{
"CN": "mqtt-broker",
"hosts": [
"*"
],
"key": {
"algo": "rsa",
"size": 4096
}
}

View File

@ -0,0 +1,4 @@
[Service]
Environment="MQTT_BROKER_HOST=localhost"
Environment="POSTGRESQL_HOST=localhost"
Environment="REDIS_HOST=localhost"

View File

@ -3,6 +3,12 @@
# Set config-file permissions # Set config-file permissions
chown -R chirpstack:chirpstack /etc/chirpstack chown -R chirpstack:chirpstack /etc/chirpstack
chmod 750 /etc/chirpstack chmod 750 /etc/chirpstack
chmod 750 /etc/chirpstack/certs
chmod 640 /etc/chirpstack/*.toml chmod 640 /etc/chirpstack/*.toml
# Generate certificates
CERTROOT=/etc/chirpstack/certs
cfssl gencert -initca $CERTROOT/ca-csr.json | cfssljson -bare $CERTROOT/ca
cfssl gencert -ca $CERTROOT/ca.pem -ca-key $CERTROOT/ca-key.pem -config $CERTROOT/ca-config.json -profile server $CERTROOT/mqtt-server.json | cfssljson -bare $CERTROOT/mqtt-server
#DEBHELPER# #DEBHELPER#

View File

@ -4,7 +4,6 @@ Documentation=https://www.chirpstack.io/
Wants=network-online.target Wants=network-online.target
After=network-online.target After=network-online.target
[Service] [Service]
User=chirpstack User=chirpstack
Group=chirpstack Group=chirpstack