diff --git a/.gitignore b/.gitignore index 14b269f..ed8c288 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .env +config.json .idea/ __pycache__/ diff --git a/README.md b/README.md index 295f121..ad682d7 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,24 @@ # Installation -* Open shell as user nxy will run -* Install virtualenvwrapper and source it +* Open shell as user nxy will run. These instructions will use ```nxy``` as user and ```/home/nxy``` as its home directory. +* Install virtualenvwrapper (ideally system wide). +* Open shell as user ```nxy```, source virtualenvwrappers script + - ```sudo -u nxy -i``` - ```source $(which virtualenvwrapper.sh)``` -* Clone repo +* Clone repo and change current dir - ```git clone https://gitfap.de/mrhanky/nxy.git``` + - ```cd nxy``` * Create virtualenv and install dependencies - - ```mkvirtualenv -a $PWD/nxy -r $PWD/nxy/requirements.txt nxy``` + - ```mkvirtualenv -a $PWD -r $PWD/requirements.txt nxy``` * Copy ```.env-example``` and insert values in ```.env``` (replace everything wrapped in < and >) - ```cp .env-example .env``` - ```vim .env``` -* Leave (auto) activated virtualenv and - - ```deactivate``` -* Copy systemd unit (would recommend the ```/usr/local``` prefix) +* Copy ```config.json``` and modify it (setup ZNC etc.) + - ```cp config.json-example config.json``` + - ```vim config.json``` +* Leave (auto) activated virtualenv and exit the bot's shell + - ```deactivate && exit``` +* Copy systemd unit and enable it (would recommend the ```/usr/local``` prefix). Don't forget to modify the systemd unit if your user and home directory are different! - ```sudo mkdir -p /usr/local/lib/systemd/system``` - - ```sudo cp $PWD/nxy/nxy-bot.service /usr/local/lib/systemd/system``` + - ```sudo cp /home/nxy/nxy/nxy-bot.service /usr/local/lib/systemd/system``` + - ```sudo systemctl daemon-reload``` + - ```sudo systemctl enable --now nxy-bot.service``` diff --git a/config.json b/config.json-example similarity index 90% rename from config.json rename to config.json-example index 5031da7..46ab918 100644 --- a/config.json +++ b/config.json-example @@ -1,10 +1,9 @@ { "username": "nxy", - "host": "unterschicht.tv", - "port": 56791, + "host": "znc.host", + "port": 1337, "ssl": true, - "raw": true, - "autojoins": ["#w0bm", "#f0ck"], + "autojoins": ["#nxy-dev"], "flood_burst": 1, "flood_rate": 4, "flood_rate_delay": 1, diff --git a/nxy-bot.service b/nxy-bot.service index ea85165..d16bc95 100644 --- a/nxy-bot.service +++ b/nxy-bot.service @@ -5,8 +5,9 @@ After=network.target znc.service [Service] Type=simple User=nxy -WorkingDirectory=$BOTDIR -ExecStart=$VIRTUALENV/bin/python $BOTDIR/nxy/bot.py +Environment=PYTHONPATH=/home/nxy/nxy +WorkingDirectory=/home/nxy/nxy +ExecStart=/home/nxy/.virtualenvs/nxy/bin/python nxy/bot.py config.json [Install] WantedBy=multi-user.target