added installation instructions and changed config file location to user/.config

This commit is contained in:
murmeldin 2025-01-15 14:16:24 +01:00
parent c2d9dcdd74
commit 35ab8923a4
6 changed files with 77 additions and 4 deletions

View file

@ -3,7 +3,11 @@
Das ist der Plenums-Bot des Chaos Computer Clubs Berlin. Seine Aufgabe ist es, die Plena im Club anzukündigen, die an jedem 2. und 4. Dienstag im Monat stattfinden. Außerdem soll er das Pad mit den Plenumsnotizen ins Wiki des CCCB übertragen und neue Pads anlegen.
Die Nachrichten und Ankündigungen werden über den internen Mailverteiler und über interne Matrix-Gruppen an die Mitglieder versendet.
Plenumsbot
## Funktionsweise
Die genaue Funktionsweise des Bots wird in diesem Blogeintrag näher beschrieben:
https://marekkrug.de/posts/plenum-bot/
### Ankündigungsskript
- Schauen, wann ein Plenum stattfindet
- Wenn eins in 3 Tagen stattfindet, nächstes Pad kopieren und per Mail schicken
@ -21,6 +25,42 @@ Plenumsbot
- Pad in MediaWiki-Format umwandeln
- Neue Wiki-Seite erstellen und dort das umgewandelte Pad hochladen
## Installation
Um den Bot z.B. auf einer neu erstellten VM zu installieren, kannst du dieser Anleitung für ubuntu-server folgen und diese Anweisungen ggf. für deine Distro anpassen:
1) Rust installieren ([rust-lang.org](https://www.rust-lang.org/tools/install))
2) Dieses Repo klonen:
```bash
git pull https://git.berlin.ccc.de/murmeldin/plenum-bot.git
```
3) Die Dependencies installieren und den Bot kompilieren:
```bash
cd plenum-bot
./util/install_script_ubuntu.sh
```
4) Config überprüfen und schauen, ob alles passt:
```bash
./util/change-config.sh
```
5) Den Bot aktivieren:
```bash
systemctl enable plenumsbot.timer
```
6) In den logs überprüfen, ob alles passt:
```bash
journalctl -u plenumsbot.service
```
---
## TO-DO LIST
### main.rs
- [ ] Add logic for top_anzahl in main.rs:172

View file

@ -3,7 +3,7 @@ Description=CCCB Plenum-Bot
After=network-online.target
[Service]
ExecStart=/home/plenum-bot/plenum-bot/target/debug/Plenum-Bot
WorkingDirectory=/home/$User/plenum-bot
ExecStart=./util/run_release.sh
Type=simple
User=root

7
util/change-config.sh Normal file
View file

@ -0,0 +1,7 @@
#!/bin/sh
# This script is being ran every time the systemd job is triggered
u=$USER
../target/release/Plenum-Bot -f /home/$u/.config/plenum-bot/config.sqlite -c

View file

@ -1,11 +1,19 @@
#!/bin/sh
# The plenum bot works when being run on a ubuntu-server
# instance with these commands ran previously.
# For other distros, please adapt these instructions
# so you have the same packages installed as well.
#
# This script can also be run in order to update
# the bot and its dependencies to the newest version.
# Optionally, if you don't have rust installed, you should do it here:
# https://www.rust-lang.org/tools/install
git pull
sudo apt update
sudo apt upgrade -y
sudo apt install gcc libssl-dev pandoc pkg-config libsqlite3-dev
cargo build --release
./update_or_create_systemd_service.sh

7
util/run_release.sh Normal file
View file

@ -0,0 +1,7 @@
#!/bin/sh
# This script is being ran every time the systemd job is triggered
u=$USER
../target/release/Plenum-Bot -f /home/$u/.config/plenum-bot/config.sqlite

View file

@ -0,0 +1,11 @@
#!/bin/sh
# This script can be run to update or newly install
# the systemd services needed for
cat systemd/plenumbot.service > /etc/systemd/system/plenumsbot.service
cat systemd/plenumbot.timer > /etc/systemd/system/plenumsbot.timer
chmod 755 /etc/systemd/system/plenumsbot.timer
chmod 755 /etc/systemd/system/plenumsbot.service
sudo systemctl daemon-reload