-
Notifications
You must be signed in to change notification settings - Fork 2
Instalation Self Hosting
- Git
- Node.js >= v. 3.6
- NPM
- MySql Database Server
- screen (recommendet)
- Download the
start.bashscript and put it in the direction you want to install the bot in:
$ wget https://raw.githubusercontent.com/zekroTJA/zekroBot2/dev/start.bash
- Execute the script with
$ bash start.bash
Then, the script will automatically download the repository into the scripts folder, checkout into dev branch, install node modules and generate config, which will be opened after setup to enter your preferences and credentials.
After that, you can start the bot with
$ bash start.bash
The script will look for updates in the dev repository and will automatically download them at each start of the bot. The bot will be run in an automatically generated loop script running in a screen session, which can be also resumed and stopped with the script.
Get more information using --help argument:
$ bash start.bash --help
- Clone the repository with
$ git clone https://github.com/zekroTJA/zekroBot2
- Checkout to dev branch
$ git checkout dev
- Install required node modules
$ npm install
- Start the bot for generating config. This will throw an error, that the config file could not be loaded. Just ignore that and edit the config with your editor.
$ npm start && nano config.json
If you are using an other editor, use this instead of
nanoof course.
- Start the bot with
$ npm start
If you want to start the bot in a screen process, you need t oinstall screen first, if not installed:
$ apt install screen
Then, you should also create a loop script, which restarts the bot if it loses connection or crashes unexpectedly:
File:
run.sh
#!/bin/bash
while true; do
npm start
doneThen, start the script in screen with
$ screen -L -S zekroBot bash run.bash
-Lcreates a file namedscreenlog.0which logs the output of the screen and-Ssets the name of the screen to use for resuming and stopping the screen.
Just login to a web interface like PhpMyAdmin and import the zekroBot2.sql file you can find in the root directory of the repository, or execute the code in that file.
Also it is recommendet to create a specific user for the bot to use this database only having permissions accessing this database. Use the following to create such a user:
GRANT USAGE ON *.* TO 'zekroBot2'@'%' IDENTIFIED BY PASSWORD PASSWORD('USER PASSWORD HERE');
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `zekroBot2`.* TO 'zekroBot2'@'%';After that, you can start the bot with
$ npm start