An extensible system that allows one of various container orchestrators to be controlled from one of various chat platforms.
ContainrBot is made up of the ContainrBot chatbot and the ContainrBotApi.
The ContainrBot is designed to be easily extended and currently supports the following chat platforms:
ContainrBotApi is also designed to be easily extended and currently supports the following container orchestrators:
Common use cases:
- Enabling a group of friends to control a game server
- Restarting a finicky container
- Starting a high-load container only when needed
If you'd like ContainrBot to support additional chat services and orchestrators, please create an issue.
All contributions are welcome! Please feel free to ask questions, submit issues, and make code changes yourself!
- List
/containr list- Lists the configured containers and their status: running, not running, not deployed
- Start
/containr start {container}- Starts the
{container}
- Stop
/containr stop {container}- Stops the
{container}
- Restart
/containr restart {container}- Restarts the
{container}
The ContainrBotApi is responsible for interacting with the chosen orchestrator (Docker, Kubernetes, etc.).
The orchestrator the ContainrBotApi will interact with. Currently supported options are:
- Docker
- Kubernetes
A JSON array of container objects with these properties:
- FriendlyName: The name used when interacting with the ContainrBot
- ContainerName: The container name for the deployable
- Namespace: The namespace for the deployable (optional, orchestrator-dependent)
Examples:
ORCHESTRATOR: dockerCONTAINER_LIST: "[{\"FriendlyName\": \"valheim\", \"ContainerName\": \"valheim\"}, {\"FriendlyName\": \"cncnet\", \"ContainerName\": \"cncnet\"}, {\"FriendlyName\": \"satisfactory\", \"ContainerName\": \"satisfactory\"}]"The ContainrBot is responsible for interacting with the chat platform and is what you'll often use directly. The ContainrBot calls the ContainrBotApi asking it to interact with containers based on your chatbot commands.
The chat platform the ContainrBot will interact with. Currently supported options are:
- Discord
- Slack
The base URL of ContainrBotApi. This should be a local IP address as ContainrBotApi is not secured or intended to be reached externally. Instead, external access to your containers should be through the ContainrBot chatbot
This is the token used to interact with the chosen chat platform
- NET 10.0
- NetCord for setting up the bot interactions with Discord
- SlackNet for setting up the bot interactions with Slack
- Haven.DotNet for setting up the bot interactions with Haven
- Docker.DotNet for Docker management
- Kubernetes-client for Kubernetes management
services:
containrbot:
image: ghcr.io/josolanes/containrbot/containrbot:latest
environment:
CHATBOT: discord
CONTAINRBOTAPI_BASEURL: "http://containrbotapi:8080/"
secrets:
- bot-token
containrbotapi:
image: ghcr.io/josolanes/containrbot/containrbotapi:latest
ports:
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
ORCHESTRATOR: docker
CONTAINER_LIST: "[{\"FriendlyName\": \"hello\", \"ContainerName\": \"hello-world\", \"Namespace\": \"\"}]"
hello-world:
container_name: hello-world
image: nginx
secrets:
bot-token:
file: ./bot-token.txt
# ./bot-token.txt will contain your chat platform token
# In this example, it would be in the same path as your docker-compose.yaml