Skip to content
A flexible event/agent & automation system with lots of bees 🐝
Go Other
  1. Go 99.3%
  2. Other 0.7%
Branch: master
Clone or download

Latest commit

rubiojr and muesli openweathermap bee: set current weather context
This makes it easier to retrieve the current weather from other actions
as long as you have the weather bee running and a chain that periodically
gets the current weather (with the cron bee for example).

Example templates:

"Weather in {{.context.weather.current.Name}}: {{(index .context.weather.current.Weather 0).Description}}, {{.context.weather.current.Main.Temp}} ΒΊC"

Would print something like:

Weather in Barcelona: few clouds, 22.57 ΒΊC
Latest commit 86804e3 May 18, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add FUNDING.yml Oct 8, 2019
admin Systemd's Watchdog (#275) Nov 11, 2019
api Fixed typos (#260) Aug 1, 2019
app Added / corrected comments for api, app & bees packages Jan 29, 2017
assets Sunrise/Sunset events hive (#301) Apr 30, 2020
bees openweathermap bee: set current weather context May 18, 2020
cfg Encrypted configuration backend (#295) May 1, 2020
config @ 648f36d Updated config submodule May 13, 2017
docker missing --recursive option Aug 13, 2019
docs Add flag to decrypt the configuration (#307) May 1, 2020
filters Trim spaces on template result Aug 30, 2017
templatehelper Adds TimeNow template helper Apr 30, 2020
tools Encrypted configuration backend (#295) May 1, 2020
.appveyor.yml Get rid of ugly appveyor get/test syntax, we don't have a vendor dir … Apr 25, 2019
.gitignore Include fixtures May 27, 2019
.gitmodules Use Gopkg.toml for dependencies (#185) Mar 19, 2018
.goreleaser.yml Fix goreleaser signing Apr 12, 2020
.travis.yml Fixed typo in ENV var Apr 25, 2019
Dockerfile Add tzdata to Docker image Apr 27, 2019
LICENSE Initial commit Jun 23, 2014
Makefile Bump version to v0.4.0 Apr 12, 2020
README.md Move badges to top of README Apr 22, 2020
beehive.go Add flag to decrypt the configuration (#307) May 1, 2020
build-constants.go Use 'unknown' for unknown commit revisions. We need to find a nicer w… May 14, 2017
docker-compose.yml Reference localhost instead of example.com Apr 12, 2020
go.mod Bump gominatim to address 32 bit arch issues May 1, 2020
go.sum Bump gominatim to address 32 bit arch issues May 1, 2020
hives.go Sunrise/Sunset events hive (#301) Apr 30, 2020
hives_linux.go Disable notification & serial hives on non-Linux unices May 9, 2019
hives_osx.go Disable notification & serial hives on non-Linux unices May 9, 2019
hives_unix.go Disable notification & serial hives on non-Linux unices May 9, 2019
watchdog_linux.go Add flag to decrypt the configuration (#307) May 1, 2020

README.md

Beehive

Build Status Go ReportCard GoDoc

Beehive is an event and agent system, which allows you to create your own agents that perform automated tasks triggered by events and filters. It is modular, flexible and really easy to extend for anyone. It has modules (we call them Hives), so it can interface with, talk to, or retrieve information from Twitter, Tumblr, Email, IRC, Jabber, RSS, Jenkins, Hue - to name just a few. Check out the full list of available Hives in our Wiki.

Connecting those modules with each other lets you create immensly useful agents.

Here are just a few examples of things Beehive could do for you:

  • Re-post tweets on your Tumblr blog
  • Forward incoming chat messages to your email account
  • Turn on the heating system if the temperature drops below a certain value
  • Run your own IRC bot that lets you trigger builds on a Jenkins CI
  • Control your Hue lighting system
  • Notify you when a stock's price drops below a certain value

beehive's Logo

Installation

Packages & Binaries

You can find even more official releases here.

Deployment Tools

  • Docker: docker run --name beehive -d -p 8181:8181 fribbledom/beehive
  • Ansible

From source

Beehive requires Go 1.11 or higher. Make sure you have a working Go environment. See the install instructions.

The recommended way is to fetch the sources and run make.

git clone --recursive https://github.com/muesli/beehive.git
cd beehive
make

You can build and install the beehive binary like other Go binaries out there (go get) but you'll need to make sure Beehive can find the assets (images, javascript, css, etc). See the Troubleshooting/Notes section for additional details.

Run beehive --help to see a full list of options.

Configuration

Think of Hives as little plugins, extending Beehive's abilities with events you can react on and actions you can execute.

Just as examples, there's a Twitter plugin that can

  • react to someone you follow posting a tweet (an event)
  • post a new tweet for you (an action)
  • ...

or an RSS plugin that lets you

  • monitor RSS feeds and react on new feed items (another event)

or an email plugin that gives you the ability to

  • send emails (another action)

Each Hive lets you spawn one or multiple Bees in it, all working independently from another. That allows you to create separate plugin instances, e.g. one email-Bee for your private mail account, and another one for your work email.

Creating Bees

Sounds complicated? It's not! Just for fun, let's setup Beehive to send us an email whenever an RSS feed gets updated. Start beehive and open http://localhost:8181/ in your browser. Note that Beehive will create a config file beehive.conf in its current working directory, unless you specify a different file with the -config option.

Note: If you built Beehive with go build instead of make you will have to start beehive from within its source directory in order for it to find all the resources for the admin interface. Also see the Troubleshooting & Notes section of this README.

The admin interface will present you with a list of available Hives. We will need to create two Bees here, one for the RSS feed and one for your email account.

New Bees

Setting up a Chain

Now we will have to create a new Chain, which will wire up the two Bees we just created. First we pick the Bee & Event we want to react on, then we pick the Bee we want to execute an Action with. The RSS-Bee's event gives us a whole set of parameters we can work with: the feed item's title, its links and description among others. You can manipulate and combine these parameters with a full templating language at your disposal. For example we can set the email's content to something like:

Title: {{.title}} - Link: {{index .links 0}}

Whenever this action gets executed, Beehive will replace {{.title}} with the RSS event's title parameter, which is the title of the feed item it retrieved. In the same manner {{index .links 0}} becomes the first URL of this event's links array.

New Chain

That's it. Whenever the RSS-feed gets updated, Beehive will now send you an email! It's really easy to make various Bees work together seamlessly and do clever things for you. Try it yourself!

You can find more information on how to configure Beehive and examples in our Wiki.

Troubleshooting & Notes

The web interface and other resources are embedded in the binary by default. When using make noembed, Beehive tries to find those files in its current working directory, so it's currently recommended to start Beehive from within its git repository, if you plan to use the web interface.

Should you still not be able to reach the web interface, check if the config directory in the git repository is empty. If that's the case, make sure the git submodules get initialized by running git submodule update --init.

The web interface does not require authentication yet. Beehive by default accepts all connections from the loopback device only.

If you want to bind Beehive to a different interface/address, run Beehive with the -bind and -canonicalurl parameters. For example:

beehive -bind "192.168.0.1:8181" -canonicalurl "http://192.168.0.1:8181"

or

docker run --name beehive -d -e CANONICAL_URL="http://192.168.0.1:8181" -p 8181:8181 fribbledom/beehive

Development

Need help? Want to hack on your own Hives? Join us on IRC (irc://freenode.net/#beehive) or Gitter. Follow the bees on Twitter!

You can’t perform that action at this time.