Hi there! I'm Kaori! I'm a slack bot with functionality that ranges from “useless” to “pretty neat”.
My features are implemented as plugins. They can be enabled, disabled, featured flagged independently.
My "hello world" plugin. If you say "ping", I'll say "pong".
Create, collect, battle gacha cards.
A virtual slack currency.
This 👏 is 👏 probably 👏 the 👏 most 👏 obnoxious 👏 plugin.
kaori clap --help
for more options.
I'm kinda easy to get running. Development and production deployment is all done with Docker. Make sure you have Docker installed and running on your system.
The most difficult part of this whole thing is literally just filling in the
environment variables. Please PR this document or the .env.example
file to
make this easier for people who come after you.
- You should probably create your own bot testbed slack if you don't already have one. https://slack.com/create
- Create a slack app and deploy it to your testbed slack
- You need create a
.env
file with all the necessary values. Easiest way to do this is tocp .env.example .env
and then replace the bogus values with real values. - Run
make
to build all the containers docker-compose run --rm worker alembic upgrade head
will create the database for youdocker-compose up
will start me up! My web interface runs at http://localhost:8000 and my API runs at http://localhost:8001
We aren't out of the woods yet. Now we have to let slack make requests to our API.
- Install ngrok or do something that will allow you to expose your local API endpoint to the internet.
- Go to Your Apps and under your bot under
"Event Subscriptions" enter your api url. The path should be:
/slack/events
- If you are using ngrok you can inspect the requests from slack at http://127.0.0.1:4040
NOW you should be up and running.
If you want:
- Your code to automatically reload when changed
- Debugger friendly settings (long timeouts, no concurrency)
docker-compose -f docker-compose.yml -f dev.docker-compose.yml up
Note that this deviates from production quite a bit. You should still test PRs using the non-debug docker-compose.
You can easily set a debugger breakpoint now.
docker ps
# look for your desired container ID
docker attach $YOUR_CONTAINER_ID
Set breakpoints in your file.
breakpoint()
You should get a pdb shell in your attached TTY. Exit your attached shell with
CTRL-p CTRL-q
.
More info on docker attach
.
Note that if you are running docker-compose from IntelliJ it has a nice GUI for attaching a shell to a running container without having to copy IDs around and such.
Test coverage is reported to Codecov.
To run the tests:
make test
or
docker-compose run test
If you want an interactive shell to run tests in:
docker-compose run test bash -l
In general, I am not too picky about where or how I am deployed. All my services are twelve-factor apps. So they should be easy to run anywhere!
I currently run inside a Kubernetes cluster as a set of deployments.
I manage continuous delivery and the state of the Kubernetes cluster GitOps-style through fluxcd.
My production GitOps setup is available over on the gitops
branch.