Andrew Cantino: a6aa81900e Merge pull request #27 from robertjwhitney/config_to_env 11 年之前
app 893ced3c25 adds email from address 11 年之前
bin 3692041bb3 typo 11 年之前
config 265fe65a83 moves ActionMailer config into .env 11 年之前
db ac67a5de15 Only increase text field size for mysql. 11 年之前
doc 37f5d67552 more README 11 年之前
lib 52a1c1208a Don't allow JSONPath eval 11 年之前
public 620acffa5a initial commit 11 年之前
script 620acffa5a initial commit 11 年之前
spec eead335705 switch to class methods and ids to shorten the payload size of serialized delayed_jobs 11 年之前
vendor 620acffa5a initial commit 11 年之前
.env.example 893ced3c25 adds email from address 11 年之前
.gitignore 38624da2ab adds foreman and .env.example file 11 年之前
.ruby-gemset d8529374b5 switch to .ruby-version and .ruby-gemset 11 年之前
.ruby-version d8529374b5 switch to .ruby-version and .ruby-gemset 11 年之前
.travis.yml 0b2bb3487d forgot to migrate on Travis 11 年之前
CHANGES.md 24d7af69ec version 11 年之前
Capfile 620acffa5a initial commit 11 年之前
Gemfile 38624da2ab adds foreman and .env.example file 11 年之前
Gemfile.lock 38624da2ab adds foreman and .env.example file 11 年之前
LICENSE f371431922 Clarify license 11 年之前
Procfile f778a8de92 Added a Procfile 11 年之前
README.md 297f6763a2 updates readme 11 年之前
Rakefile 620acffa5a initial commit 11 年之前
VERSION 24d7af69ec version 11 年之前
config.ru 620acffa5a initial commit 11 年之前

README.md

Huginn. Your agents are standing by.

What is Huginn?

Huginn is a system for building agents that perform automated tasks for you online. They can read the web, watch for events, and take actions on your behalf. Huginn's Agents create and consume events, propagating events along a directed event flow graph. Think of it as Yahoo! Pipes plus IFTTT on your own server. You always know who has your data. You do.

the origin of the name

This is just getting started, but here are some of the things that you can do right now with Huginn:

  • Watch for air travel deals
  • List terms you care about and receive emails when their occurrence on Twitter changes drastically. (For example, want to know when something interesting has happened in the world of Machine Learning? Huginn will watch the term "machine learning" on Twitter and tell you when there is a large spike.)
  • Track the weather and get an email when it's going to rain (or snow) tomorrow
  • Follow your project names on Twitter and get updates when people mention them
  • Scrape websites and receive emails when they change
  • Track your location over time

Follow @tectonic for updates as Huginn evolves.

Examples

Please checkout the Huginn Introductory Screencast!

And now, some example screenshots. Below them are instructions to get you started.

Example list of agents

Event flow diagram

Detecting peaks in Twitter

Logging your location over time

Making a new agent

Getting Started

Quick Start

If you just want to play around, you can simply clone this repository, then perform the following steps:

  • Copy .env.example to .env cp .env.example .env
  • Edit the configuration options in .env
  • Edit the APP_SECRET_TOKEN environment variable and replace REPLACE_ME_NOW! with the output of rake secret.
  • Run rake db:create, rake db:migrate, and then rake db:seed to create a development MySQL database with some example seed data.
  • Run foreman start, visit http://localhost:5000, and login with the username of admin and the password of password.
  • Make some extra Terminal windows and run bundle exec rails runner bin/schedule.rb, bundle exec rails runner bin/twitter_stream.rb, and script/delayed_job run in separate windows.
  • Setup some Agents!

Real Start

Follow these instructions if you wish to deploy your own version of Huginn or contribute back to the project. GitHub doesn't make it easy to work with private forks of public repositories, so I recommend that you follow the following steps:

  • Make a public fork of Huginn
  • Make a private, empty GitHub repository called huginn-private
  • Duplicate your public fork into your new private repository (via GitHub's instructions):

    git clone --bare git@github.com:you/huginn.git
    cd huginn.git
    git push --mirror git@github.com:you/huginn-private.git
    cd .. && rm -rf huginn.git
    
  • Checkout your new private repository.

  • Add your Huginn public fork as a remote to your new private repository (huginn-private):

    git remote add public git@github.com:you/huginn.git
    
  • Run the steps from Quick Start above to configure your copy of Huginn.

  • When you want to contribute patches, do a remote push from your private repository to your public fork of the relevant commits, then make a pull request to this repository.

Deployment

Deployment right now is configured with Capistrano, Unicorn, and nginx. You should feel free to deploy in a different way, however, and please submit your deployment solutions back!

Required Setup

In your private copy of Huginn, do the following:

  • Edit app/models/user.rb and change the invitation code(s) in INVITATION_CODES. This controls who can signup to use your installation.
  • Edit app/mailers/system_mailer.rb and set your default from address.
  • Edit config/environments/production.rb and change the value of DOMAIN and the config.action_mailer.smtp_settings setup, which is currently setup for sending email through a Google Apps account on Gmail.
  • Setup a place for Huginn to run. I recommend making a dedicated user on your server for Huginn, but this is not required. Setup nginx or Apache to proxy pass to unicorn. There is an example nginx script in config/nginx/production.conf.
  • Setup a production MySQL database for your installation.
  • Edit config/unicorn/production.rb and replace instances of you with the correct username for your server.
  • Edit config/deploy.rb and change all instances of you and yourdomain to the appropriate values for your server setup. If you want RVM to be used and installed, uncomment the appropriate lines. Then, run cap deploy:setup followed by cap deploy. If everything goes well, this should start some unicorn workers on your server to run the Huginn web app.
  • After deploying with capistrano, SSH into your server, go to the deployment directory, and run RAILS_ENV=production bundle exec rake db:seed to generate your admin user. Immediately login to your new Huginn installation with the username of admin and the password of password and change your email and password!
  • You'll need to run bin/schedule.rb and bin/twitter_stream.rb in a daemonized way. I've just been using screen sessions, but please contribute something better!

    RAILS_ENV=production bundle exec rails runner bin/schedule.rb
    RAILS_ENV=production bundle exec rails runner bin/twitter_stream.rb
    

Optional Setup

Enable the WeatherAgent

In order to use the WeatherAgent you need an API key with Wunderground. Signup for one and then change value of api_key: your-key in your seeded WeatherAgent.

Logging your location to the UserLocationAgent

You can use Post Location on your iPhone to post your location to an instance of the UserLocationAgent. Make a new one to see instructions.

Enable DelayedJobWeb for handy delayed_job monitoring and control

  • Edit config.ru, uncomment the DelayedJobWeb section, and change the DelayedJobWeb username and password.
  • Uncomment match "/delayed_job" => DelayedJobWeb, :anchor => false in config/routes.rb.
  • Uncomment gem "delayed_job_web" in Gemfile and run bundle.

Disable SSL

We assume your deployment will run over SSL. This is a very good idea! However, if you wish to turn this off, you'll probably need to edit config/initializers/devise.rb and modify the line containing config.rememberable_options = { :secure => true }. You will also need to edit config/environments/production.rb and modify the value of config.force_ssl.

Setup Backups

Checkout config/example_backup.rb for an example script that you can use with the Backup gem.

License

Huginn is provided under the MIT License.

Contribution

Huginn is a work in progress and is hopefully just getting started. Please get involved! You can add new Agents, expand the Wiki, or help us simplify and strengthen the Agent API or core application.

Please fork, add specs, and send pull requests!

Build Status