add systemd services

This commit is contained in:
2025-06-30 12:20:43 +02:00
parent beab6209e9
commit d8e60a5da7
4 changed files with 81 additions and 1 deletions
+49
View File
@@ -89,5 +89,54 @@ Once your device is configured, you can verify that its mDNS advertisement is vi
- bash start_mdns.sh
## Managing Auracast systemd Services
You can run the backend and frontend as systemd services for easier management and automatic startup on boot.
### 1. Install the service files
Copy the provided service files to your systemd directory (requires sudo):
```bash
sudo cp auracast-server.service /etc/systemd/system/
sudo cp auracast-frontend.service /etc/systemd/system/
```
### 2. Reload systemd
```bash
sudo systemctl daemon-reload
```
### 3. Enable services to start at boot
```bash
sudo systemctl enable auracast-server
sudo systemctl enable auracast-frontend
```
### 4. Start the services
```bash
sudo systemctl start auracast-server
sudo systemctl start auracast-frontend
```
### 5. Stop the services
```bash
sudo systemctl stop auracast-server
sudo systemctl stop auracast-frontend
```
### 6. Disable services to start at boot
```bash
sudo systemctl disable auracast-server
sudo systemctl disable auracast-frontend
```
### 7. Check service status
```bash
sudo systemctl status auracast-server
sudo systemctl status auracast-frontend
```
If you want to run the services as a specific user, edit the `User=` line in the service files accordingly.
# Known issues:
- When running on a laptop there might be issues switching between usb and browser audio input since they use the same audio device
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Auracast Frontend HTTPS Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/caster/repos/bumble-auracast/src/auracast/server
ExecStart=/home/caster/repos/bumble-auracast/src/auracast/server/start_frontend_https.sh
Restart=on-failure
Environment=LOG_LEVEL=INFO
[Install]
WantedBy=multi-user.target
+15
View File
@@ -0,0 +1,15 @@
[Unit]
Description=Auracast Backend Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/caster/repos/bumble-auracast
ExecStart=/home/caster/.local/bin/poetry run python src/auracast/server/multicast_server.py
Restart=on-failure
User=caster
Environment=PYTHONUNBUFFERED=1
Environment=LOG_LEVEL=INFO
[Install]
WantedBy=multi-user.target
+4 -1
View File
@@ -30,5 +30,8 @@ echo "Device key: $KEY"
echo "Using hostname: $DEVICE_HOSTNAME"
echo "Using Avahi domain: $AVAHI_DOMAIN"
# Path to poetry binary
POETRY_BIN="/home/caster/.local/bin/poetry"
# Start Streamlit HTTPS server (port 443)
poetry run streamlit run multicast_frontend.py --server.port 443 --server.enableCORS false --server.enableXsrfProtection false --server.headless true --server.sslCertFile "$CERT" --server.sslKeyFile "$KEY" --browser.gatherUsageStats false
$POETRY_BIN run streamlit run multicast_frontend.py --server.port 443 --server.enableCORS false --server.enableXsrfProtection false --server.headless true --server.sslCertFile "$CERT" --server.sslKeyFile "$KEY" --browser.gatherUsageStats false