Hubot running on Alpine with the Hipchat Adapter.
- NodeJS: 4.12
- NPM: 2.24.9
- hubot-hipchat
- hubot-diagnostics
- hubot-help
- hubot-google-images
- hubot-pugme
- hubot-maps
- hubot-redis-brain
- hubot-rules
- hubot-shipit
- hubot-pager-me
- hubot-plusplus
- hubot-reload-scripts
- hubot-leankit
- bash
- supervisor
- nodejs
- redis
- build-base
- gc
- g++
- gcc-objc
- libtool
- libc6-compat
- make
- expat
- expat-dev
- python
- wget
- gnupg
- tar
- git
- zip
- curl
- wget
Mount the redis directory to avoid data reset on container replacement
- /var/lib/redis
Mount the config directory to manage credentials/settings outside of container
- /opt/hubot/config
Mount the scripts directory to manage any non-npm installs/simple scripts
- /opt/hubot/scripts
Mount the external-scripts for control
- /opt/hubot/external-scripts.json
You have a few options in how to utilize this container
docker run -v -e HUBOT_HIPCHAT_JID=jid \
-e HUBOT_HIPCHAT_PASSWORD=secret \
-e HUBOT_AUTH_ADMIN=admin \
-d hearstat/alpine-hubot
docker run -v /path/to/hubot.conf:/opt/hubot/config/hubot.conf -d hearstat/alpine-hubot
docker run -v /path/to/hubot.conf:/opt/hubot/config/hubot.conf \
-v /path/to/redis/save:/var/lib/redis \
-v /path/to/external-scripts.json:/opt/hubot/external-scripts.json \
-d hearstat/alpine-hubot
I've setup this bot to be able to switch back and forth from Hipchat to Shell via startup commands. This is how to get into "Dev Mode" or enable the shell adapter.
docker run -d hearstat/alpine-hubot /usr/bin/devmode
then just do the following to connect to the container at the shell level
docker exec -it $container_name bash
then once in run the following
./bin/hubot
Then you can interact with hubot at the shell level
Run:
docker run -d -p 8123:8123 -p 5858:5858 --name=devbot hearstat/alpine-hubot devmode
docker exec -it devbot bash
coffee --nodejs --debug $(which hubot)
In Chrome navigatate to http://:8123/?ws=:8123&port=5858 For Mac users "docker IP" can be found in Kitematic. Example: http://192.168.99.100:8123/?ws=192.168.99.100:8123&port=5858
NOTE: You should end up in a hubot REPL, if you end up in a coffee REPL you did something wrong. To exit:
coffee> process.exit()
NOTE: node-inspector currently only works in Chrome.
To set a breakpoint in coffeescript you will want to open the code in the /opt/hubot/node_modules/ directory and add at the appropriate line:
debugger
You may want to mount a directory locally so you can use your local editor. For Mac this will need to be in your /Users/ dir To do this consider:
mkdir -p ~/node_modules
docker run -d -p 8123:8123 -p 5858:5858 -v /Users/<username>/node_modules:/opt/hubot/node_modules --name=devbot hearstat/alpine-hubot devmode
To switch back to hipchat or "Prod Mode" do the following
docker exec $container_name /usr/bin/prodmode
or just run a new container
Since this container comes with a bot reload option, edit the external-scripts.json as needed and run the following
docker exec $container_name python script-install.py
Note: you can just restart the container, it will re-run the same script before loading the bot.
Then in chat tell hubot to reload (my default is thebot)
@hubot reload
To build the image, do the following
docker build github.com/hearstat/docker-alpinehubot
A prebuilt container is available in the docker index.
docker pull hearstat/alpine-hubot
Lives at /opt/hubot/config and is sourced at run time.
Add all environment variables needed to conf file. See script repos for specific settings available.
The baseline config file in container only has ADAPTER/HUBOT_NAME set.
## Bot Settings
export HUBOT_NAME='hubot' # what hubot listens to
## Comma separated list of users who administer Hubot Auth
export HUBOT_AUTH_ADMIN="YourName"
## Hipchat adapter settings
# Credentials
export HUBOT_HIPCHAT_JID="JID@chat.hipchat.com"
export HUBOT_HIPCHAT_PASSWORD="SuperSecretPassword"
# Actual Rooms to join (JIDs)
export HUBOT_HIPCHAT_ROOMS="JID_RoomName@conf.hipchat.com"
# Set true/false to auto join rooms when mentioned/invited (true/false)
export HUBOT_HIPCHAT_JOIN_ROOMS_ON_INVITE="true"
# Explicitly refuse to join specified rooms (JIDs)
export HUBOT_HIPCHAT_ROOMS_BLACKLIST=""
# Auto reconnect attempt (true/false)
export HUBOT_HIPCHAT_RECONNECT="true"
# Set true/false for bot to join public rooms.
export HUBOT_HIPCHAT_JOIN_PUBLIC_ROOMS="false"
The embedded script-install.py utilizes the external-scripts.json for it's install items, I did this to simplify the process. You already have to add everything to the file regardless, so use it to install from.
[
"hubot-diagnostics",
"hubot-help",
"hubot-google-images",
"hubot-pugme",
"hubot-maps",
"hubot-redis-brain",
"hubot-rules",
"hubot-shipit",
"hubot-pager-me",
"hubot-plusplus",
"hubot-reload-scripts",
"hubot-leankit"
]