Skip to content

Latest commit

 

History

History
180 lines (110 loc) · 3.88 KB

INSTALL.rst

File metadata and controls

180 lines (110 loc) · 3.88 KB

Installation

Prerequisites (docker installation)

  • Docker

  • Datadog Agent (optional)

  • Sentry App (optional)

  • Discord App with following enabled intents:

    • PRESENCE
    • SERVER MEMBERS
    • MESSAGE CONTENT

Docker interpreter

Refer to https://docs.docker.com/get-docker/

Downloading dependencies

$ git clone https://github.com/Rom1-J/tuxbot-bot /opt/tuxbot-bot
$ cd /opt/tuxbot-bot

Configuration

Copy the .envs.example directory and adjust for your settings in .envs/.

$ cp -R .envs.example .envs

Note

  • If you don't want to use Sentry, do not fill in the corresponding key in the config file:
  • If you don't want to use Datadog, do not fill in the corresponding key in the config file:

Run

Run the container using production.yml

$ sudo docker compose -f production.yml up -d

Prerequisites (bare metal installation)

  • Python 3.10 interpreter (with poetry as package manager)

  • PostgreSQL server

  • Redis server

  • Datadog Agent (optional)

  • Sentry App (optional)

  • Discord App with following enabled intents:

    • PRESENCE
    • SERVER MEMBERS
    • MESSAGE CONTENT

Python interpreter

Install Python for your host system.

Assuming Ubuntu Server host and using PPA:

$ sudo apt update && sudo apt upgrade -y
$ sudo apt install software-properties-common -y
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt install python3.10

Downloading dependencies

Assuming PostgreSQL already configured, and Poetry installed:

$ git clone https://github.com/Rom1-J/tuxbot-bot /opt/tuxbot-bot
$ cd /opt/tuxbot-bot
$ poetry env use 3.10
$ poetry shell
$ poetry install

Note

wolf and quote commands both need DejaVu Sans font, make sure you have them:

$ sudo apt install fonts-dejavu-core fonts-dejavu-extra

Configuration

Copy the .envs.example directory and adjust for your settings in .envs/.

$ cp -R .envs.example .envs

Note

  • If you don't want to use Sentry, do not fill in the corresponding key in the config file:
  • If you don't want to use Datadog, do not fill in the corresponding key in the config file:

Systemd

Create a systemd services.

/etc/systemd/system/tuxbot.service

[Unit]
Description=Tuxbot, a discord bot
After=network.target

[Service]
Type=simple
User=tuxbot

Restart=on-failure
Restart=always
RestartSec=5

WorkingDirectory=/opt/tuxbot-bot
ExecStart=<poetry_venv>/bin/ddtrace-run <poetry_venv>/bin/python tuxbot/start.py

Environment=DD_ACTIVE=true
Environment=DD_SERVICE="Tuxbot-bot"
Environment=DD_ENV="Tuxbot-prod"
Environment=DD_LOGS_INJECTION=true
Environment=DD_PROFILING_ENABLED=true

Environment=PYTHON_ENV=production

Environment=CLUSTER_ID=1
Environment=CLUSTER_COUNT=1

Environment=SHARD_ID=0
Environment=SHARD_COUNT=1

Environment=FIRST_SHARD_ID=0
Environment=LAST_SHARD_ID=0

StandardOutput=file:/opt/tuxbot-bot/data/logs/systemd.log

[Install]
WantedBy=multi-user.target

Note

if you have not configured Datadog, replace the following lines:

ExecStart=<poetry_venv>/bin/python tuxbot/start.py

Environment=DD_ACTIVE=false