Skip to content

Running the bot

Czechbol edited this page Jun 24, 2020 · 3 revisions

Clone the repository.

cd ~
git clone https://github.com/Czechbol/Amadeus.git
# OR
git clone git@github.com:Czechbol/Amadeus.git

cd Amadeus/

You need to configure the bot in order for it to start. There are two files, that need adjusting: config.json and emotes.py. Copy their .default/.template versions and fill all the variables.

You may also want to do that with the text.default.json file -- this step is fully optional.


There are two ways of hosting the bot: as a docker container or as a standalone service. Both have their pros and cons; read below and decide what suits you better.

Docker

Docker containers (bot and database) allow running the bot without touching the hosting environment. On the other hand, it is another management layer (in means of increased CPU/RAM usage on server).

The first step is installing the docker:

sudo apt install docker docker-compose

It will probably be neccesary to add the user to the Docker group (this will take effect on the next session):

sudo usermod -aG docker <username>

Build the container:

docker build .

Then you can run the bot with

docker-compose down && docker-compose up --build

To run the bot in the background, add --detach parameter.

Standalone

I don't recommend running the bot this way, but the option exists if you need it.

Install the required programs and python modules:

sudo apt install git python3 python3-dev python3-pip postgresql postgresql-contrib libpq-dev
pip3 install -r requirements.txt

Set up the postgres

su - postgres
createuser --pwprompt amadeus # password: amadeus 
psql -c "CREATE DATABASE amadeus ;"
exit

Run the bot as any other python script:

python3 amadeus.py
Clone this wiki locally