services: Fix discord-bot

This commit is contained in:
polyfloyd 2023-09-10 14:34:00 +02:00
parent 1f503ca287
commit 7664fe480b
2 changed files with 12 additions and 2 deletions

View file

@ -4,7 +4,17 @@
name:
- python3-paho-mqtt
- python3-tz
# Not in apt, install manually: discord.py, discord_webhook
- virtualenv
- name: Create virtualenv
command: virtualenv /opt/miflora_exporter/.venv
args:
creates: /var/lib/discord-bot/.venv
- name: Install Python dependencies
shell: . .venv/bin/activate && pip install -r requirements.txt
args:
chdir: /var/lib/discord-bot
- name: Clone source
git:

View file

@ -8,7 +8,7 @@ After=network.target
Type=simple
Restart=on-failure
RestartSec=10s
ExecStart=/var/lib/discord-bot/main.py
ExecStart=/var/lib/discord-bot/.venv/bin/python /var/lib/discord-bot/main.py
DynamicUser=true
Environment="DISCORD_TOKEN={{ discord_token }}"