deployement to vps - catebi/FreeganBot GitHub Wiki

Copy files to vps

-- connect to vps
ssh user@IP_ADDRESS -i /SSH_PATH/

-- copy bot files to vps
scp -i /SSH_PATH/ .env main.py config.yaml config.dev.yaml user@IP_ADDRESS:/_catebi/bots/freegan_bot/

-- vps: go to the vps bot's directory
cd ../_catebi/bots/freegan_bot/

Create service

create service file:

sudo nano /etc/systemd/system/catebi_bot_freegan.service

Service code

[Unit]
Description=Catebi Freegan Bot
After=network.target

[Service]
User=root
WorkingDirectory=/_catebi/bots/freegan_bot
ExecStart=/usr/bin/python3  main.py
Restart=on-failure

[Install]
WantedBy=multi-user.target

Install necessary libs

pip install python-dotenv

Managing service

-- enable service
systemctl enable catebi_bot_freegan.service

-- run service
systemctl start catebi_bot_freegan.service

-- status
systemctl status catebi_bot_freegan.service

-- logs
journalctl -u catebi_bot_freegan.service

-- stop bot service
systemctl stop mybot.service

-- disable bot service
systemctl disable mybot.service

-- reload services
systemctl daemon-reload