A production ready Slackbot written with Hubot
A Slackbot token pre-configured for your team is required. Checkout the Slack docs for more information.
If you do not want to connect to the container and just want to run it, use daemon mode with -d:
(sudo) docker run -d \
-e HUBOT_SLACK_TOKEN=<token> \
-v /logs:/app/logs \
--name halbert jonfairbanks/halbert
The logs/
volume mount can be moved as you see fit, but is required if you want hubot-chatlog files to persist container updates, reboots, etc.
- hubot-diagnostics
- hubot-help
- hubot-maps
- hubot-redis-brain
- hubot-uptime
- hubot-chatlog
- hubot-xkcd
- hubot-base64
- hubot-sha1
- Other experimental scripts can be found in the scripts/ directory.
- To download, launch and connect to the container:
(sudo) docker run -it --name halbert jonfairbanks/halbert '/bin/bash'
- Finally, launch the bot within the container:
HUBOT_SLACK_TOKEN=<token> ./bin/hubot
The output of hubot startup and any console.log() within your scripts is directed to container logs and can be viewed within Docker.
(sudo) docker logs <container name>
Unless specifically disabled, halbert also maintains a chatlog for each channel it is invited to. These logs are stored in the path specified on container launch and can also be viewed within Slack using the chatlog
command.
- To stop the container:
(sudo) docker stop halbert
- To remove the container:
(sudo) docker rm halbert
- To list containers:
(sudo) docker ps -a
- To list images:
(sudo) docker images
- To remove the old image:
(sudo) docker rmi jonfairbanks/halbert
Additional ENV variables can be passed when starting Docker with the -e flag and then accessed within scripts as process.env.ENV_VARIABLE_NAME
-e ENV_VARIABLE_NAME='My Variable'
Directories within the Docker container can be exposed to the local machine with the -v flag with parameter syntax of :.
-v /app/logs:/hubot/logs
-v /app/scripts:/hubot/scripts
Note: exposing the entire /app directory may cause a startup failure
Docker ports can be exposed to extend functionality, such as with webhooks, using the -p flag.
-p 8080:8080 (<External Port>:<Internal Docker Port>)
docker exec -it halbert npm install hubot-packagename --save
docker restart halbert
Be sure to replace 'hubot-packagename' with the desired package you wish to install. When NPM packages are installed with the name that begins with hubot-*, they will be automatically added to the external-scripts.json file.