Initial MCM project: FastAPI + Textual TUI unified messenger
MultiCustomerMessenger supporting Telegram (python-telegram-bot), WhatsApp (Green API) and SMS (python-gsmmodem-new). REST API with Bearer-token auth, SQLAlchemy models for MariaDB, APScheduler for background polling, and Textual TUI running in same asyncio event-loop.
This commit is contained in:
72
install/README_install.md
Normal file
72
install/README_install.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# MCM – Installation auf Raspberry Pi 4 (Debian)
|
||||
|
||||
## 1. Abhängigkeiten installieren
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y python3 python3-venv python3-pip mariadb-server usb-modeswitch
|
||||
```
|
||||
|
||||
## 2. MariaDB einrichten
|
||||
|
||||
```bash
|
||||
sudo mysql_secure_installation
|
||||
sudo mysql -u root -p <<EOF
|
||||
CREATE DATABASE mcm CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE USER 'mcm'@'localhost' IDENTIFIED BY 'SICHERES_PASSWORT';
|
||||
GRANT ALL PRIVILEGES ON mcm.* TO 'mcm'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
EOF
|
||||
```
|
||||
|
||||
## 3. Projekt deployen
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /opt/mcm
|
||||
sudo cp -r /home/pi/MCM/* /opt/mcm/
|
||||
sudo python3 -m venv /opt/mcm/.venv
|
||||
sudo /opt/mcm/.venv/bin/pip install -r /opt/mcm/requirements.txt
|
||||
```
|
||||
|
||||
## 4. Konfiguration
|
||||
|
||||
```bash
|
||||
sudo cp /opt/mcm/.env.example /opt/mcm/.env
|
||||
sudo nano /opt/mcm/.env
|
||||
# DATABASE_URL=mysql+pymysql://mcm:PASSWORT@localhost:3306/mcm
|
||||
# TELEGRAM_TOKEN=...
|
||||
# WHATSAPP_ID_INSTANCE=...
|
||||
# WHATSAPP_API_TOKEN=...
|
||||
# API_KEY=sicherer-key
|
||||
```
|
||||
|
||||
## 5. systemd-Dienst aktivieren
|
||||
|
||||
```bash
|
||||
sudo cp /opt/mcm/install/mcm.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable mcm
|
||||
sudo systemctl start mcm
|
||||
sudo systemctl status mcm
|
||||
```
|
||||
|
||||
## 6. TUI manuell starten
|
||||
|
||||
```bash
|
||||
cd /opt/mcm
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
## USB-Modem
|
||||
|
||||
Das Modem erscheint typischerweise als `/dev/ttyUSB0`. Prüfen mit:
|
||||
```bash
|
||||
lsusb
|
||||
dmesg | grep tty
|
||||
```
|
||||
|
||||
`usb-modeswitch` schaltet das Gerät von Speicher- in Modem-Modus.
|
||||
Der Dienst-User braucht Mitgliedschaft in der Gruppe `dialout`:
|
||||
```bash
|
||||
sudo usermod -aG dialout pi
|
||||
```
|
||||
24
install/mcm.service
Normal file
24
install/mcm.service
Normal file
@@ -0,0 +1,24 @@
|
||||
[Unit]
|
||||
Description=MCM – MultiCustomerMessenger API
|
||||
Documentation=https://gitea.it-drui.de/viewit/MCM
|
||||
After=network-online.target mariadb.service
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=pi
|
||||
Group=pi
|
||||
WorkingDirectory=/opt/mcm
|
||||
EnvironmentFile=/opt/mcm/.env
|
||||
ExecStart=/opt/mcm/.venv/bin/python main_api_only.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=mcm
|
||||
|
||||
# Modem-Gerät Zugriff
|
||||
SupplementaryGroups=dialout
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user