biboumi: Move to Quadlet, Debian-packaged version

This commit is contained in:
Alex Palaistras 2023-08-13 13:36:25 +01:00
parent fb6d134cdb
commit 7db3958362
5 changed files with 25 additions and 41 deletions

View File

@ -1,25 +1,13 @@
FROM docker.io/debian:bullseye-slim FROM docker.io/debian:bookworm-slim
ARG VERSION=9.0 ARG VERSION=9.0
ENV BUILD_DEPS="build-essential git cmake python"
RUN apt-get update -y && apt-get install -y --no-install-recommends \ RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates gettext libexpat1-dev libidn11-dev uuid-dev libsqlite3-dev libudns-dev \ ca-certificates gettext gosu biboumi=${VERSION}*
libbotan-2-dev ${BUILD_DEPS}
RUN git clone --branch ${VERSION} --depth 1 https://lab.louiz.org/louiz/biboumi /biboumi && \
mkdir /biboumi/build && cd /biboumi/build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DWITH_BOTAN=1 -DWITH_SQLITE3=1 \
-DWITH_LIBIDN=1 -DWITHOUT_SYSTEMD=1 && \
make && make install && rm -Rf /biboumi
RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${BUILD_DEPS}
RUN addgroup --system --gid 10000 biboumi RUN addgroup --system --gid 10000 biboumi
RUN adduser --system --uid 10000 --ingroup biboumi --home /var/lib/biboumi biboumi RUN adduser --system --uid 10000 --ingroup biboumi --home /var/lib/biboumi biboumi
COPY container/config /etc/biboumi COPY container/config /etc/biboumi
COPY container/run-biboumi /run-biboumi COPY container/run-biboumi /run-biboumi
RUN chown -R biboumi:biboumi /etc/biboumi
USER biboumi
ENTRYPOINT ["/run-biboumi"] ENTRYPOINT ["/run-biboumi"]

View File

@ -1,9 +1,12 @@
#!/bin/sh #!/bin/sh
# Correct permissions where needed.
chown -R biboumi:biboumi /var/lib/biboumi
# Prepare configuration files for environment variable substitution. # Prepare configuration files for environment variable substitution.
ENV_NAMES="`env | awk -F '=' '{printf "$%s ", $1}'`" ENV_NAMES="`env | awk -F '=' '{printf "$%s ", $1}'`"
for file in /etc/biboumi/*.template; do for file in /etc/biboumi/*.template; do
envsubst "${ENV_NAMES}" < "$file" > "`echo $file | awk -F '.template$' '{print $1}'`" envsubst "${ENV_NAMES}" < "$file" > "`echo $file | awk -F '.template$' '{print $1}'`"
done done
/usr/bin/biboumi /etc/biboumi/biboumi.cfg "$@" gosu biboumi /usr/bin/biboumi /etc/biboumi/biboumi.cfg "$@"

View File

@ -0,0 +1,17 @@
[Unit]
Description=Biboumi IRC Gateway for XMPP
Wants=container-build@%N.service container-volume@%N.service prosody.service prosody-component-register@%N.service
After=container-build@%N.service container-volume@%N.service prosody.service prosody-component-register@%N.service
[Container]
ContainerName=%N
EnvironmentFile=%E/coreos-home-server/%N/%N.env
Image=localhost/%N:latest
Network=internal
Volume=%N:/var/lib/%N:z
[Service]
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -4,9 +4,5 @@ storage:
trees: trees:
- path: /etc/coreos-home-server/biboumi - path: /etc/coreos-home-server/biboumi
local: service/biboumi/ local: service/biboumi/
- path: /etc/systemd/system - path: /etc/containers/systemd
local: service/biboumi/systemd/ local: service/biboumi/quadlet/
systemd:
units:
- name: biboumi.service
enabled: true

View File

@ -1,20 +0,0 @@
[Unit]
Description=Biboumi IRC Gateway for XMPP
Wants=container-build@%N.service container-volume@%N.service prosody.service prosody-component-register@%N.service
After=container-build@%N.service container-volume@%N.service prosody.service prosody-component-register@%N.service
[Service]
Type=notify
NotifyAccess=all
SyslogIdentifier=%N
Restart=on-failure
Environment=PODMAN_SYSTEMD_UNIT=%n
ExecStart=/bin/podman run --replace --name %N --net internal --sdnotify=conmon \
--env-file %E/coreos-home-server/%N/%N.env \
--volume %N:/var/lib/%N:z \
localhost/%N:latest
ExecStop=/bin/podman stop --ignore --time 10 %N
ExecStopPost=/bin/podman rm --ignore --force %N
[Install]
WantedBy=multi-user.target