/hive.discordbot

hive.discordbot is a learning effort to build a chatbot in go

Primary LanguageGoMIT LicenseMIT

Discord bot

Go Report Card

Discord Bot for The Quarantined.

Learning golang, learning discord bots and other random things.

Running as local binary

go run discordbot.go -t <discordbottoken> 

vscode debug

For those also learning, this is my launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${workspaceFolder}",
            "args": [
                "-t", "<discordbottoken>"
            ]
        }
    ]
}

Running in docker

To build and run locally.

docker build --pull --rm -f "Dockerfile" -t hive:latest "."
docker run -e TOKEN=<bot token> hive:latest

Slim the docker container with docker-slim should get good results e.g. cmd=build info=results status='MINIFIED BY 83.09X [928699637 (929 MB) => 11177245 (11 MB)]'

docker-slim build --http-probe=false hive:latest

Running in Kubernetes

The makefile will generate the deployment.yml in the build_k8s folder, and requires the DISCORDBOTTOKEN environment variable to be set.

e.g.

make build-k8s DISCORDBOTTOKEN=562ff88.caa3e47a7941f8.10a1ee1951-xx

or

export DISCORDBOTTOKEN=562ff88.caa3e47a7941f8.10a1ee1951-xx
make build-k8s

and apply the deployment spec

kubectl apply -f ./build_k8s/deployment.yml

Terraform

Rename ./terraform/secrets.auto.tfvars.example to ./terraform/secrets.auto.tfvars and update the bottoken secret.

terraform init
terraform apply