|
| 1 | +# BOSWatch – Dienstinstallation (Service Setup) |
| 2 | + |
| 3 | +## 🇩🇪 BOSWatch als Dienst verwenden |
| 4 | +Es wird vorausgesetzt, dass BOSWatch unter `/opt/boswatch3` installiert ist. |
| 5 | +Falls du einen anderen Installationspfad nutzt, müssen alle Pfadangaben in dieser Anleitung, im Skript sowie in den generierten Service-Dateien entsprechend angepasst werden. |
| 6 | + |
| 7 | +Für jeden Dienst muss eine eigene `*.yaml`-Datei im Ordner `config/` vorhanden sein. |
| 8 | +Beim Ausführen des Skripts wirst du interaktiv gefragt, welche dieser YAML-Dateien installiert oder übersprungen werden sollen. |
| 9 | + |
| 10 | +### Dienst installieren |
| 11 | +Als Erstes wechseln wir ins BOSWatch Verzeichnis: |
| 12 | + |
| 13 | +```bash |
| 14 | +cd /opt/boswatch3 |
| 15 | +``` |
| 16 | + |
| 17 | +Das Installationsskript `install_service.py` wird anschließend mit Root-Rechten ausgeführt: |
| 18 | +```bash |
| 19 | +sudo python3 install_service.py |
| 20 | +``` |
| 21 | +Es folgt ein interaktiver Ablauf, bei dem du gefragt wirst, welche YAML-Dateien installiert oder entfernt werden sollen. |
| 22 | + |
| 23 | +### Zusätzliche Optionen (fortgeschrittene Anwender) |
| 24 | +Das Skript bietet zusätzliche CLI-Optionen für mehr Kontrolle: |
| 25 | + |
| 26 | +```bash |
| 27 | +usage: install_service.py [-h] [--verbose] [--quiet] |
| 28 | + |
| 29 | +Installiert oder entfernt systemd-Services für BOSWatch basierend auf YAML-Konfigurationsdateien. |
| 30 | + |
| 31 | +optional arguments: |
| 32 | + -h, --help zeigt diese Hilfe an |
| 33 | + --dry-run für Entwickler: führt keine echten Änderungen aus (Simulation) |
| 34 | + --verbose zeigt ausführliche Debug-Ausgaben |
| 35 | + --quiet unterdrückt alle Ausgaben außer Warnungen und Fehlern |
| 36 | + -l, --lang [de|en] Sprache für alle Ausgaben (Standard: de) |
| 37 | +``` |
| 38 | + |
| 39 | +### Neustart nach Serviceinstallation |
| 40 | +Nach Durchlaufen des Skripts boote dein System erneut durch, um den korrekten Startvorgang zu überprüfen: |
| 41 | +```bash |
| 42 | +sudo reboot |
| 43 | +``` |
| 44 | + |
| 45 | +### Kontrolle, ob alles funktioniert hat |
| 46 | +Um zu kontrollieren, ob alles ordnungsgemäß hochgefahren ist, kannst du die zwei Services mit folgenden Befehlen abfragen und die letzten Log-Einträge ansehen: |
| 47 | + |
| 48 | +1. Client-Service |
| 49 | +```bash |
| 50 | +sudo systemctl status bw3_[clientname].service |
| 51 | +``` |
| 52 | + |
| 53 | +Ersetze [clientname] mit dem Namen, den deine client.yaml hat (Standardmäßig: client) |
| 54 | + |
| 55 | +Um das Log zu schließen, "q" drücken. |
| 56 | + |
| 57 | +2. Server-Service |
| 58 | +```bash |
| 59 | +sudo systemctl status bw3_[servername].service |
| 60 | +``` |
| 61 | + |
| 62 | +Ersetze [servername] mit dem Namen, den deine server.yaml hat (Standardmäßig: server) |
| 63 | + |
| 64 | +Um das Log zu schließen, "q" drücken. |
| 65 | + |
| 66 | +**Beide Outputs sollten so ähnlich beginnen:** |
| 67 | +```text |
| 68 | +bw3_client.service - BOSWatch Client |
| 69 | + Loaded: loaded (/etc/systemd/system/bw3_client.service; enabled; preset: enabled) |
| 70 | + Active: active (running) since Mon 1971-01-01 01:01:01 CEST; 15min 53s ago |
| 71 | +``` |
| 72 | + |
| 73 | +Falls du in deinen letzten Logzeilen keine Error vorfinden kannst, die auf einen Stopp des Clients bzw. Server hinweisen, läuft das Programm wie gewünscht, sobald du deinen Rechner startest. |
| 74 | + |
| 75 | +### Logdatei |
| 76 | +Alle Aktionen des Installationsskripts werden in der Datei log/install/service_install.log protokolliert. |
| 77 | + |
| 78 | +### Hinweis |
| 79 | +Nach der Installation oder Entfernung wird systemctl daemon-reexec automatisch aufgerufen, damit systemd die neuen oder entfernten Units korrekt verarbeitet. |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## 🇬🇧 Use BOSWatch as a Service |
| 84 | + |
| 85 | +We assume that BOSWatch is installed to `/opt/boswatch3`. |
| 86 | +If you are using a different path, please adjust all paths in this guide, in the script and in the generated service files accordingly. |
| 87 | + |
| 88 | +Each service requires its own `*.yaml` file inside the `config/` folder. |
| 89 | +The script will interactively ask which YAML files to install or skip. |
| 90 | + |
| 91 | +### Install the Service |
| 92 | + |
| 93 | +First, change directory to BOSWatch folder: |
| 94 | + |
| 95 | +```bash |
| 96 | +cd /opt/boswatch3 |
| 97 | +``` |
| 98 | + |
| 99 | +After that, run the install script `install_service.py` with root permissions: |
| 100 | + |
| 101 | +```bash |
| 102 | +sudo python3 install_service.py -l en |
| 103 | +``` |
| 104 | + |
| 105 | +You will be guided through an interactive selection to install or remove desired services. |
| 106 | + |
| 107 | +### Additional Options |
| 108 | + |
| 109 | +The script supports additional CLI arguments for advanced usage: |
| 110 | + |
| 111 | +```bash |
| 112 | +usage: install_service.py [-h] [--dry-run] [--verbose] [--quiet] |
| 113 | + |
| 114 | +Installs or removes BOSWatch systemd services based on YAML config files. |
| 115 | + |
| 116 | +optional arguments: |
| 117 | + -h, --help show this help message and exit |
| 118 | + --dry-run simulate actions without making real changes |
| 119 | + --verbose show detailed debug output |
| 120 | + --quiet suppress all output except warnings and errors |
| 121 | + -l, --lang [de|en] Language for all output (default: de) |
| 122 | +``` |
| 123 | + |
| 124 | +### Reboot After Setup |
| 125 | +After running the script, reboot your system to verify that the services start correctly: |
| 126 | +```bash |
| 127 | +sudo reboot |
| 128 | +``` |
| 129 | + |
| 130 | +### Verifying Successful Setup |
| 131 | +To check if everything started properly, you can query the two services and inspect the most recent log entries: |
| 132 | + |
| 133 | +1. Client Service |
| 134 | +```bash |
| 135 | +sudo systemctl status bw3_[clientname].service |
| 136 | +``` |
| 137 | + |
| 138 | +Replace [clientname] with the name of your client.yaml file (default: client). |
| 139 | + |
| 140 | +To close the log, press "q". |
| 141 | + |
| 142 | +2. Server Service |
| 143 | +```bash |
| 144 | +sudo systemctl status bw3_[servername].service |
| 145 | +``` |
| 146 | + |
| 147 | +Replace [servername] with the name of your server.yaml file (default: server). |
| 148 | + |
| 149 | +To close the log, press "q". |
| 150 | + |
| 151 | +**Both outputs should start similarly to this:** |
| 152 | +```text |
| 153 | +bw3_client.service - BOSWatch Client |
| 154 | + Loaded: loaded (/etc/systemd/system/bw3_client.service; enabled; preset: enabled) |
| 155 | + Active: active (running) since Mon 1971-01-01 01:01:01 CEST; 15min 53s ago |
| 156 | +``` |
| 157 | + |
| 158 | +If the latest log entries do not show any errors indicating a client or server crash, then the services are running correctly and will automatically start on boot. |
| 159 | + |
| 160 | +### Log File |
| 161 | + |
| 162 | +All actions of the installation script are logged to `log/install/service_install.log`. |
| 163 | + |
| 164 | +### Note |
| 165 | + |
| 166 | +After installation or removal, `systemctl daemon-reexec` is automatically triggered to reload unit files properly. |
0 commit comments