Coder Social home page Coder Social logo

gleam's Introduction

Gleam

Build Status

Gleam is a cluster for helping system operations. It works with etcd.

Every Gleam watches at least two files:

  • /gleam/node/$NAME - for one-node tasks;
  • /gleam/region/$REGION - for cluster tasks (Every Gleam instance can watch multi-regions).

Gleam will register itself as file /gleam/info/$NAME with running informations. It watches the file /gleam/node/$NAME for one-node tasks. If the file was changed, Gleam will be notified.

Gleam nodes watch the file /gleam/region/$REGION for cluster tasks. When the file is changed, all watching Gleam will be notified.

The message (the file contents) is JSON encoding data with the function name and data. Gleam calls the function with data.

{
    Name: (string),
    Data: (interface{}),
}

Dependencies

Installing & Running

All useful scripts were put at the directory shell.

Server node

Compile Gleam, and run it:

$ go get github.com/mikespook/gleam/cmd/gleam
$ $GOBIN/gleam

Witch takes the following flags:

  • -ca-file="": Path to the CA file
  • -cert-file="": Path to the cert file
  • -config="": Path to configuration file
  • -etcd="http://127.0.0.1:4001": A comma-delimited list of etcd
  • -key-file="": Path to the key file
  • -log="": log to write (empty for STDOUT)
  • -log-level="all": log level ('error', 'warning', 'message', 'debug', 'all' and 'none' are combined with '|')
  • -name="$HOST-$PID": Name of this node, $HOST-$PID will be used as default.
  • -pid="": PID file
  • -region="default": A comma-delimited list of regions to watch
  • -script="": Directory of lua scripts

The configuration settings will cover flags.

Client

Gleam supplies a package

$ go get github.com/mikespook/gleam

And a cli command

$ go get github.com/mikespook/gleam/cmd/gleam-client
$ $GOBIN/gleam-client

To operate Gleam nodes.

You can read client's source code for the package's usage.

The cli command takes the following flags:

  • -ca-file="": Path to the CA file
  • -cert-file="": Path to the cert file
  • -etcd="http://127.0.0.1:4001": A comma-delimited list of etcd
  • -key-file="": Path to the key file
  • -log="": log to write (empty for STDOUT)
  • -log-level="all": log level ('error', 'warning', 'message', 'debug', 'all' and 'none' are combined with '|')

And commands include :

  • call: Call a function on nodes file
  • region: List all regions
  • node: List all nodes
  • info: List all nodes info

See shell/test_*.sh for more information.

Case study

Let's see a case for synchronizing configurations.

Assume we have a cluster witch need to synchronize thire crontab configurations. In an old school way, we may use rsync, scp or something else to synchronize the configuration from one server to the others. Through gleam we just need some steps to complate this job:

  1. etcd instances are running on systems in a same cluster;
  2. gleam nodes connected to the etcd cluster should be watching a same region(Eg. default);
  3. The configuration content has been writen to a file in etcd.
  4. Tell gleam call the lua script config::sync for synchronizing configuration.
  5. Done.

See test_config_sync.sh for more details.

Authors

Open Source - MIT Software License

See LICENSE.

gleam's People

Contributors

mikespook avatar

Watchers

Angryfox avatar  avatar

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.