Project

gros_calin

0.0
No commit activity in last 3 years
No release in over 3 years
Make database queries available via HTTP
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
>= 0.7.1, ~> 0.7
>= 2.11.1, ~> 2.11
>= 2.3.2, ~> 2.3
>= 5.4.1, ~> 5.4
>= 1.1.0, ~> 1.1
>= 2.0.3, ~> 2.0
>= 0.3.18, ~> 0.3
~> 10.0
>= 0.5.0, ~> 0.5

Runtime

>= 1.6.0, ~> 1.6
>= 1.4.5, ~> 1.4
>= 1.4.2, ~> 1.4
>= 1.6.3, ~> 1.6
>= 0.19.1, ~> 0.19
 Project Readme

Gros-Câlin

Share your database queries via HTTP/JSON.

Build Status Dependency Status Coverage Status Code Climate

Installation

Install the gem:

$ gem install gros_calin

Depending on the drivers you'd like to use to connect your databases, you'll also have to install one or more of the following gems (see the Available drivers section below):

  • mysql2 (MySQL)
  • moped (MongoDB)

Usage

Create a configuration file (see the Configuration section below), then start the server:

$ gros_calin

If you want to place the process in the background:

$ gros_calin -d

By default, the server searches for a config.yml file in the current directory. To point to a specific location, use the -c flag:

$ gros_calin -c /path/to/config.yml

The server binds to the port 3313, use the -p flag to change the port number:

$ gros_calin -p 8080

To stop the server, hit Ctrl^C or, if you placed it in the background:

$ gros_calin stop

Configuration

Configuration takes place in a YAML file. First declare your datasources using one of the available drivers, then list the queries you'd like to give a hug.

HTTP endpoints

  • List available datasources: http://localhost:3313/
  • List available hugs for a datasource: http://localhost:3313/<datasource>
  • Query a specific hug: http://localhost:3313/<datasource>/<hug>

Available drivers

MySQL

myapp_datasource:
  driver: "mysql"
  options:
    host: "db.example.com"
    username: "operator"
    password: "secret"
    database: "myapp"
    hugs:
      sign_ups: "SELECT count(id) AS sign_ups, country_code FROM users WHERE created_at > DATE_SUB( NOW(), INTERVAL 24 HOUR) GROUP by country_code;"
# another_datasource:

See the mysql2 client for a list of available connection options.

MongoDB

projects_datasource:
  driver: "mongodb"
  options:
    hosts:
      - replset1.example.com:27017
      - replset2.example.com:27017
      - replset3.example.com:27017
    username: "operator"
    password: "secret"
    database: "myapp"
  hugs:
    issues: "db.projects.find( { score: { $lt: 3.8 } } ).sort(score: -1).toArray()"
    status: "{ failures: db.projects.find( { status: 'failed' } ).count(), success: db.projects.find( { status: 'success' } ).count() }"
    average_score: "db.builds.aggregate( { $group: { _id: '$project_id', builds: { $avg: '$score' } } }).result"
# another_datasource:

Frequently asked questions

Is it fast?

Well, it depends.

Does it scale?

It can serves up to a billion RPM (you'll have to rewrite it in Erlang, though).

"Gros-Câlin"?

Gros-Câlin (Big Cuddle) is named after the eponymous novel written by Romain Gary under the pen name Émile Ajar. In the book, M. Cousin, a statistician, lives with a python which hugs him tight and helps him cope with loneliness.

Romain Gary

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request