grocery-bot

Log | Files | Refs | README

anton-bot.service (1436B)


      1 # Setup steps on the target LXC/VM (per SPEC.md), before enabling this unit:
      2 #   1. Create a dedicated user to run the bot, e.g.: useradd -r -s /usr/sbin/nologin anton
      3 #   2. Copy this repo to the path used below (default assumes /opt/anton).
      4 #   3. Inside that path: python3 -m venv venv && venv/bin/pip install -r requirements.txt
      5 #   4. Copy .env there (TELEGRAM_BOT_TOKEN, ANTON_DB_PATH) -- chmod 600, owned by the
      6 #      user above. Never commit .env to git (it's in .gitignore).
      7 #   5. chown -R the deploy user over the whole directory (code, venv, .env, and the
      8 #      SQLite db file once it's created) so the service can read/write everything.
      9 #   6. Copy this file to /etc/systemd/system/anton-bot.service, then:
     10 #      systemctl daemon-reload && systemctl enable --now anton-bot
     11 #   7. Check it came up: systemctl status anton-bot && journalctl -u anton-bot -f
     12 #
     13 # NOTE: User/WorkingDirectory/EnvironmentFile/ExecStart below are placeholders --
     14 # this hasn't been matched against your existing homelab unit conventions.
     15 # Adjust paths/user to match.
     16 
     17 [Unit]
     18 Description=Anton Recipe & Grocery Telegram Bot
     19 After=network-online.target
     20 Wants=network-online.target
     21 
     22 [Service]
     23 Type=simple
     24 User=anton
     25 WorkingDirectory=/opt/anton
     26 EnvironmentFile=/opt/anton/.env
     27 ExecStart=/opt/anton/venv/bin/python /opt/anton/bot.py
     28 Restart=on-failure
     29 RestartSec=5
     30 StandardOutput=journal
     31 StandardError=journal
     32 
     33 [Install]
     34 WantedBy=multi-user.target