Giter Site home page Giter Site logo

jonfairbanks / halbert Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 2.0 2.05 MB

A production ready Slackbot written with Hubot

Home Page: https://hub.docker.com/r/jonfairbanks/halbert/

License: MIT License

Shell 1.58% CoffeeScript 50.35% JavaScript 29.95% Dockerfile 8.60% Smarty 9.52%
hubot hubot-scripts hubot-slack hubot-docker

halbert's Introduction

Halbert

GitHub Workflow Status GitHub top language Docker Pulls GitHub last commit Lines of code License

A production ready Slackbot written with Hubot

Prerequisites

A Slackbot token pre-configured for your team is required. Checkout the Slack docs for more information.

Start the Container Headless

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.

Pre-installed hubot packages

Start and Connect to the Container for Debugging

  1. To download, launch and connect to the container: (sudo) docker run -it --name halbert jonfairbanks/halbert '/bin/bash'
  2. Finally, launch the bot within the container: HUBOT_SLACK_TOKEN=<token> ./bin/hubot

Viewing Log Output

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.

Helpful Docker Commands for Removing/Updating Halbert

  • 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

Environment Variables

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'

Exposing Directories

Directories within the Docker container can be exposed to the local machine with the -v flag with parameter syntax of :.

Expose Logs Directory

-v /app/logs:/hubot/logs

Expose Scripts Directory

-v /app/scripts:/hubot/scripts

Note: exposing the entire /app directory may cause a startup failure

Exposing Ports

Docker ports can be exposed to extend functionality, such as with webhooks, using the -p flag.

-p 8080:8080 (<External Port>:<Internal Docker Port>)

Adding new packages to Hubot

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.

Resources

halbert's People

Contributors

bsord avatar dependabot-preview[bot] avatar dependabot[bot] avatar jonfairbanks avatar

Watchers

 avatar  avatar

Forkers

bsord sedoug

halbert's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.