EllieBot-docs/content/Ellie/Guides/docker-guide.md

4.5 KiB

+++ title = "Docker Guide" description = "How to set up EllieBot with Docker" weight = 6 +++

Prerequisites

Installing EllieBot with Docker

When deploying EllieBot with Docker, you have two options: using Docker or Docker Compose. The following sections provide step-by-step instructions for both methods. {{}} {{% tab title="Docker" %}}

Deploying EllieBot with Docker

  1. Move to a directory where you want your Elliebot's data folder to be (data folder will keep the database and config files) and create a data folder there.
    cd ~ && mkdir ellie && cd ellie && mkdir data
    
  2. Mount the newly created empty data folder as a volume while starting your docker container. Replace YOUR_TOKEN_HERE with the bot token obtained from the creds guide above.
    docker run -d --name ellie toastielab.dev/elliebotdevs/elliebot:v6 -e bot_token=YOUR_TOKEN_HERE -v "./data:/app/data" && docker logs -f --tail 500 ellie
    
  3. Enjoy! 🎉

Updating your bot

If you want to update elliebot to the latest version, all you have to do is pull the latest image and re-run.

  1. Pull the latest image

    docker pull toastielab.dev/elliebotdevs/elliebot:v6
    
  2. Re-run your bot the same way you did before

    docker run -d --name ellie toastielab.dev/elliebotdevs/elliebot:v6 -e bot_token=YOUR_TOKEN_HERE -v "./data:/app/data" && docker logs -f --tail 500 ellie
    
  3. Done! 🎉 {{% /tab %}} {{% tab title="Docker Compose" %}}

  4. Choose Your Workspace: Select a directory where you'll set up your EllieBot stack. Use your terminal to navigate to this directory. For the purpose of this guide, we'll use /opt/stacks/ellie/ as an example, but you can choose any directory that suits your needs.

  5. Create a Docker Compose File: In this directory, create a Docker Compose file named docker-compose.yml. You can use any text editor for this task. For instance, to use the nano editor, type nano docker-compose.yml.

  6. Configure Your Docker Compose File: Populate your Docker Compose file with the following configuration:

    services:
      ellie:
        image: toastielab.dev/elliebotdevs/elliebot:v6
        container_name: ellie
        restart: unless-stopped
        environment:
          TZ: Europe/Rome # Modify this to your timezone
          bot_token: YOUR_TOKEN_HERE
        volumes:
          - /opt/stacks/ellie/data:/app/data
    networks: {}
    
  7. Launch Your Bot: Now, you're ready to run Docker Compose. Use the following command: docker compose up -d.

  8. Navigate to Your Directory: Use cd /opt/stacks/ellie/ to go to the directory containing your Docker Compose file.

  9. Pull the Latest Images: Use docker compose pull to fetch the latest images.

  10. Restart Your Containers: Use docker compose up -d to restart the containers. {{% /tab %}} {{}}

Creating your own Discord bot

This guide will show you how to create your own discord bot, invite it to your server, and obtain the credentials needed to run it.

  1. Go to the Discord developer application page.
  2. Log in with your Discord account.
  3. Click New Application.
  4. Fill out the Name field however you like, accept the terms, and confirm.
  5. Go to the Bot tab on the left sidebar.
  6. Click on the Add a Bot button and confirm that you do want to add a bot to this app.
  7. Optional: Add bot's avatar and description.
  8. Copy your Token to creds.yml as shown above.
  9. Scroll down to the Privileged Gateway Intents section
    • You MUST enable the following:
      • PRESENCE INTENT
      • SERVER MEMBERS INTENT
      • MESSAGE CONTENT INTENT

Inviting your bot to your server

Invite the bot to your server

  • On the General Information tab, copy your Application ID from your applications page.
  • Replace the YOUR_CLIENT_ID_HERE in this link: https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=66186303 with your Client ID
  • The link should now look something like this: https://discord.com/oauth2/authorize?client_id=123123123123&scope=bot&permissions=66186303
  • Access that newly created link, pick your Discord server, click Authorize and confirm with the captcha at the end
  • The bot should now be in your server