diff --git a/disbot.service b/disbot.service new file mode 100644 index 0000000..b6b12dc --- /dev/null +++ b/disbot.service @@ -0,0 +1,27 @@ +[Unit] +Description=Discord bot +After=syslog.target + +[Service] +Type=simple + +User=disbot +Group=disbot + +ProtectControlGroups=true +ProtectHome=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectSystem=full + +PrivateDevices=true +PrivateUsers=true + +WorkingDirectory=/opt/disbot/ + +ExecStart=/opt/disbot/env/bin/python3 /opt/disbot/disbot.py + +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/req.txt b/req.txt index 97d434a..041f225 100644 --- a/req.txt +++ b/req.txt @@ -3,9 +3,11 @@ aiohttp==3.10.10 aiosignal==1.3.1 attrs==24.2.0 discord.py==2.4.0 -frozenlist==1.4.1 +frozenlist==1.5.0 idna==3.10 -logging==0.4.9.6 multidict==6.1.0 propcache==0.2.0 -yarl==1.15.5 +yarl==1.16.0 + + + diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..d8bbec2 --- /dev/null +++ b/script.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +printf "Better to run as root, because of permisions handeling.\n" + +sleep 2 + +apt update +apt upgrade + +apt install python3 python3.11-venv screen pip git vim + +groupadd disbot +useradd --system --shell /usr/sbin/nologin --home /opt/disbot -g disbot disbot + +mkdir /opt/disbot/ + +# python virtual enviroment +mkdir /opt/disbot/env/ +python3 -m venv /opt/disbot/env/ + +source /opt/disbot/env/bin/activate +pip install -r req.txt +deactivate + +mv mainbank.json disbot.py /opt/disbot/ + +chown -r disbot:disbot /opt/disbot/ + +#systemD +mv disbot.service /etc/systemd/system/ + +systemctl daemon-reload +systemctl start disbot.service +systemctl enable disbot.service +