Yohoushi

Yohoushi loves GrowthForecast

View project onGitHub

About Yohoushi

Yohoushi is for all users who love graphs. It is a graphing tool designed to collaborate with GrowthForecast where Yohoushi as a front-end and GrowthForecast(s) as back-ends.

Yohoushi shows you graphs stored in a GrowthForecast in multiple approaches. You can see large-sized graphs, specify start/end time date, and see a number of thumbnail graphs in one page. And, it also supports an unlimited hierarchical graph tree.

Also, it supports multiple GrowthForecast clusters. Yohoushi provides you highly scalable system.

         +----------+                 +---+
         |          |            +--> |GF1| <--- post a number 
Ops ---> | Yohoushi | <----------+    +---+
         |          |            |    +---+
         +----------+            +--> |GF2| <--- post a number
                                      +---+

If you are already an user of GrowthForecast, no reason not to try Yohoushi! Adding Yohoushi into the existing system is really easy, just run Yohoushi. You'll notice that you don't need to change a script to post a number to GrowthForecast. Screencasts(Sorry but japanese only) help you to understand shortly how Yohoushi works.

Installation

(1) Requirements

Please install them beforehand.

  1. Ruby (>=2.0.0)
  2. MySQL or Sqlite3 (>=3.6.16)
  3. GrowthForecast (>=0.62)

(2) Install Yohoushi

Download the yohoushi from yohoushi/releases, and unarchive it. Execute the following command in the yohoushi directory.

$ bin/bundle

(3) Configure Application

Register URL(s) of GrowthForecast(s) on config/application.yml. Yohoushi connects to a GrowthForecast running on localhost:5125 as default.

# config/application.yml
multiforecast:
  mapping:
    '':     'http://localhost:5125'

To connect to multiple GrowthForecast servers, write your mapping rule as follows:

# config/application.yml
multiforecast:
  mapping:
    'app1/':     'http://host.to.growthforecast1:5125'
    'app2/':     'http://host.to.growthforecast2:5125'

In this example, Yohoushi maps graphs whose names starting from 'app1/' and 'app2/', to 'host.to.growthforecast1:5125' and 'host.to.growthforecast2:5125' respectively.

(4) Configure Database

Write MySQL configuration on config/database.yml, and execute the following command.

$ bin/rake db:create db:migrate

As default, this command connects to MySQL located on localhost:3306 with root user / no password, and creates a database named `yohoushi`.

# config/database.yml
  adapter: mysql2
  database: yohoushi
  pool: 5
  timeout: 5000
  username: root
  password: 
  host: localhost
  port: 3306

Support SQLite

To use SQLite instead of MySQL, do the following procedures.

Modify Gemfile as followings:

# Gemfile
gem 'sqlite3'  # activate this line
# gem 'mysql2' # comment out this line

Execute below commands.

$ cp config/database-sqlite.yml config/database.yml
$ bin/bundle
$ bin/rake db:create db:migrate

(5) Run

Just,

$ bin/yohoushi

And you're done! Point your web browser at http://localhost:4804.

To daemonize, run with -d option.

$ bin/yohoushi -d

To stop the daemonized Yohoushi, execute

$ bin/yohoushi stop

(6) Check

To check Yohoushi is working well, let's POST a number to GrowthForecast. Here, let me assume GrowthForecast is working on localhost:5125.

$ curl -d 'number=10' http://localhost:5125/api/service1/section1/graph1

Success if this graph is shown on Yohoushi. You may wait a minute at maximum until the Yohoushi worker synchronizes graph data with GrowthForecast.

For more information

You may use Yohoushi API or multiforecast-client to create graphs of 4 levels or more.

Use the Yohoushi API as belows. It distributes POST data to an appropriate GrowthForecast.

$ curl -d 'number=10' http://yohoushi:4804/api/graphs/sec1/sec2/sec3/graph1

However, there is a possibility that Yohoushi will be a bottleneck by overuse of its API, therefore, it is recommended to use a multiforecast-client that will POST data directly to GrowthForecast(s) according to mapping rules.