~nicoco/public-inbox

slidge: Convert systemd unit as template unit v2 APPLIED

Camille Lafitte: 5
 Convert systemd unit as template unit
 Build debian package with systemd template unit
 Config file are stored in conf.d directory
 Update test procedure
 Typo conf.d is in slidge directory

 6 files changed, 8 insertions(+), 10 deletions(-)
#847014 running ci.yml
#847015 running debian.yml
build pending: muc_bot.py
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~nicoco/public-inbox/patches/35400/mbox | git am -3
Learn more about email & git

[PATCH slidge v2 1/5] Convert systemd unit as template unit Export this patch

---
 debian/{tpl.service => slidge@.service} | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename debian/{tpl.service => slidge@.service} (67%)

diff --git a/debian/tpl.service b/debian/slidge@.service
similarity index 67%
rename from debian/tpl.service
rename to debian/slidge@.service
index d24b89c..346560e 100644
--- a/debian/tpl.service
+++ b/debian/slidge@.service
@@ -1,10 +1,10 @@
[Unit]
Description=Slidge XMPP --PLUGIN-- bridge
Description=Slidge XMPP %i bridge
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/usr/bin/slidge -c /etc/slidge/--PLUGIN--.conf
ExecStart=/usr/bin/slidge -c /etc/slidge/conf.d/%i.conf
KillSignal=SIGINT
User=slidge
Group=slidge
-- 
2.30.2

[PATCH slidge v2 2/5] Build debian package with systemd template unit Export this patch

---
 .builds/debian.yml                   | 2 --
 debian/{ => systemd}/slidge@.service | 0
 2 files changed, 2 deletions(-)
 rename debian/{ => systemd}/slidge@.service (100%)

diff --git a/.builds/debian.yml b/.builds/debian.yml
index 793f5b7..35b7bf1 100644
--- a/.builds/debian.yml
+++ b/.builds/debian.yml
@@ -39,11 +39,9 @@ tasks:
      sudo apt-get install python3-virtualenv dh-virtualenv -y
  - generate-plugin-files: |
      cd slidge/debian
      mkdir systemd
      mkdir -p etc/conf.d
      for PLUGIN in $PLUGINS; do
        sed "s/--PLUGIN--/$PLUGIN/" tpl.conf > etc/$PLUGIN.conf.example
        sed "s/--PLUGIN--/$PLUGIN/" tpl.service > systemd/slidge-$PLUGIN.service
      done
      echo "socket=/var/run/signald/signald.sock" >> etc/signal.conf
  - build: |
diff --git a/debian/slidge@.service b/debian/systemd/slidge@.service
similarity index 100%
rename from debian/slidge@.service
rename to debian/systemd/slidge@.service
-- 
2.30.2

[PATCH slidge v2 3/5] Config file are stored in conf.d directory Export this patch

* Follow https://todo.sr.ht/~nicoco/slidge/51
---
 .builds/debian.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.builds/debian.yml b/.builds/debian.yml
index 35b7bf1..c71e2ae 100644
--- a/.builds/debian.yml
+++ b/.builds/debian.yml
@@ -41,7 +41,7 @@ tasks:
      cd slidge/debian
      mkdir -p etc/conf.d
      for PLUGIN in $PLUGINS; do
        sed "s/--PLUGIN--/$PLUGIN/" tpl.conf > etc/$PLUGIN.conf.example
        sed "s/--PLUGIN--/$PLUGIN/" tpl.conf > etc/slidge/conf.d/$PLUGIN.conf.example
      done
      echo "socket=/var/run/signald/signald.sock" >> etc/signal.conf
  - build: |
-- 
2.30.2

[PATCH slidge v2 4/5] Update test procedure Export this patch

* Test a template unit and no more a specific plugin
---
 .builds/debian.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.builds/debian.yml b/.builds/debian.yml
index c71e2ae..a7846f2 100644
--- a/.builds/debian.yml
+++ b/.builds/debian.yml
@@ -55,12 +55,12 @@ tasks:
      sudo apt-get install ./slidge_${VER}_amd64.deb -y
      ls -la /usr/lib/slidge*
      sudo ls -la /etc/slidge*
      ls -l /etc/systemd/system/slidge*
      cat /etc/systemd/system/slidge-signal.service
      mv /etc/slidge/conf.d/mattermost.conf.example /etc/slidge/conf.d/mattermost.conf
      sudo systemctl cat slidge@mattermost.service
      slidge --help
      sudo systemctl enable --now slidge-mattermost
      sudo systemctl enable --now slidge@mattermost
      sleep 5
      sudo journalctl -u slidge-mattermost --since yesterday
      sudo journalctl -u slidge@mattermost --since yesterday
  - tar: |
      tar cf slidge-debian-amd64.tar slidge-* slidge_*
      mv slidge_${VER}_amd64.deb slidge-latest-amd64.deb
-- 
2.30.2

[PATCH slidge v2 5/5] Typo conf.d is in slidge directory Export this patch

---
 .builds/debian.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.builds/debian.yml b/.builds/debian.yml
index a7846f2..4a66be6 100644
--- a/.builds/debian.yml
+++ b/.builds/debian.yml
@@ -39,7 +39,7 @@ tasks:
      sudo apt-get install python3-virtualenv dh-virtualenv -y
  - generate-plugin-files: |
      cd slidge/debian
      mkdir -p etc/conf.d
      mkdir -p etc/slidge/conf.d
      for PLUGIN in $PLUGINS; do
        sed "s/--PLUGIN--/$PLUGIN/" tpl.conf > etc/slidge/conf.d/$PLUGIN.conf.example
      done
-- 
2.30.2