Updated README and systemd unit

This commit is contained in:
mrhanky 2017-07-04 15:47:57 +02:00
parent 928ad44db4
commit b8330ae377
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8
4 changed files with 23 additions and 14 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.env .env
config.json
.idea/ .idea/
__pycache__/ __pycache__/

View File

@ -1,16 +1,24 @@
# Installation # Installation
* Open shell as user nxy will run * Open shell as user nxy will run. These instructions will use ```nxy``` as user and ```/home/nxy``` as its home directory.
* Install virtualenvwrapper and source it * Install virtualenvwrapper (ideally system wide).
* Open shell as user ```nxy```, source virtualenvwrappers script
- ```sudo -u nxy -i```
- ```source $(which virtualenvwrapper.sh)``` - ```source $(which virtualenvwrapper.sh)```
* Clone repo * Clone repo and change current dir
- ```git clone https://gitfap.de/mrhanky/nxy.git``` - ```git clone https://gitfap.de/mrhanky/nxy.git```
- ```cd nxy```
* Create virtualenv and install dependencies * 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 >) * Copy ```.env-example``` and insert values in ```.env``` (replace everything wrapped in < and >)
- ```cp .env-example .env``` - ```cp .env-example .env```
- ```vim .env``` - ```vim .env```
* Leave (auto) activated virtualenv and * Copy ```config.json``` and modify it (setup ZNC etc.)
- ```deactivate``` - ```cp config.json-example config.json```
* Copy systemd unit (would recommend the ```/usr/local``` prefix) - ```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 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```

View File

@ -1,10 +1,9 @@
{ {
"username": "nxy", "username": "nxy",
"host": "unterschicht.tv", "host": "znc.host",
"port": 56791, "port": 1337,
"ssl": true, "ssl": true,
"raw": true, "autojoins": ["#nxy-dev"],
"autojoins": ["#w0bm", "#f0ck"],
"flood_burst": 1, "flood_burst": 1,
"flood_rate": 4, "flood_rate": 4,
"flood_rate_delay": 1, "flood_rate_delay": 1,

View File

@ -5,8 +5,9 @@ After=network.target znc.service
[Service] [Service]
Type=simple Type=simple
User=nxy User=nxy
WorkingDirectory=$BOTDIR Environment=PYTHONPATH=/home/nxy/nxy
ExecStart=$VIRTUALENV/bin/python $BOTDIR/nxy/bot.py WorkingDirectory=/home/nxy/nxy
ExecStart=/home/nxy/.virtualenvs/nxy/bin/python nxy/bot.py config.json
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target