Skip to content

Running Harambot

DMcP89 edited this page Jul 19, 2024 · 10 revisions

Running harambot locally

Set environment variables

To run harambot locally you will need to have the following environment variables set:

export DISCORD_TOKEN='[YOUR DISCORD TOKEN]'
export YAHOO_KEY='[YOUR YAHOO API CLIENT ID]'
export YAHOO_SECRET='[YOUR YAHOO API CLIENT SECRET]'
export DATABASE_URL='[YOUR DATABASE URL]'
export HARAMBOT_KEY='[YOUR ENCRYPTION KEY]' # A URL-safe base64-encoded 32-byte key

Running from PyPi

  1. Install the harambot package using pip

     pip install harambot
    
  2. Run the bot

     harambot
    

Run with docker

  1. Pull the image from docker hub

     docker pull dmcp89/harambot
    
  2. Run the container

     docker run --name harambot \
     -e DISCORD_TOKEN=$DISCORD_TOKEN \
     -e YAHOO_KEY=$YAHOO_KEY \
     -e YAHOO_SECRET=$YAHOO_SECRET \
     -e DATABASE_URL=$DATABASE_URL \
     -e HARAMBOT_KEY=$HARAMBOT_KEY \
     --rm dmcp89/harambot
    

Run with docker-compose

The harambot repository contains a docker-compose file that can be used to run the bot locally. It will create a postgres database and run the bot in a container.

  1. Clone this repository

     git clone [email protected]:DMcP89/harambot.git
     cd harambot
    
  2. Run docker-compose up

     docker-compose up
    

Run from source

  1. Clone this repository

     git clone [email protected]:DMcP89/harambot.git
     cd harambot
    
  2. Run the bot.

    On local machine

     make run
    

    With Docker

     make build-image
     make run-docker
    

Running in the cloud

Harambot supports the following cloud providers:

Render

Deploy to Render

Click the button and fill out the form with your discord token and yahoo api client key and and secret.

Next steps

Once you have harambot running you can follow the configuration guide to add the bot to your discord server and configure your league.