GithubHelp home page GithubHelp logo

gru's Introduction

Gru - Orchestration made easy with Go and Lua

Build Status GoDoc Go Report Card Join the chat at https://gitter.im/dnaeon/gru Codewake

Gru is a fast and concurrent orchestration framework powered by Go and Lua, which allows you to manage your UNIX/Linux systems with ease.

Documentation

You can find the latest documentation here.

The API documentation is available here.

Features

  • Written in fast, compiled language - Go
  • Uses a fast, lightweight, embeddable, scripting language as the DSL - Lua
  • Concurrent execution of idempotent operations
  • Distributed - using etcd for node discovery and communication and Git for version control and data sync
  • Easy to deploy - comes with a single, statically linked binary
  • Suitable for orchestration and configuration management

Status

Gru is in constant development. Consider the API unstable as things may change without a notice.

Contributions

Gru is hosted on Github. Please contribute by reporting issues, suggesting features or by sending patches using pull requests.

License

Gru is Open Source and licensed under the BSD License.

References

References to articles related to this project in one way or another.

gru's People

Contributors

annupuri avatar dnaeon avatar gitter-badger avatar kaey avatar skinp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gru's Issues

Be more flexible when managing services on a FreeBSD system

@kaey

I've been checking the resource for service management on FreeBSD systems, and thought that we could perhaps make it even better.

One thing that I'd like to do is get rid of the logic for sendmail service, and have the resource be more flexible, so that we don't have to hard-code all services, which don't use YES and NO as the rcvalues.

Here's a diff I came up with.

diff --git a/resource/service_freebsd.go b/resource/service_freebsd.go
index 7bb82e8..0bbf84a 100644
--- a/resource/service_freebsd.go
+++ b/resource/service_freebsd.go
@@ -24,6 +24,16 @@ type Service struct {
    // RCVar (see rc.subr(8)), set to {svcname}_enable by default.
    // If service doesn't define rcvar, you should set svc.rcvar = "".
    RCVar string `luar:"rcvar"`
+
+   // RCValue is the value used when setting the rcvar.
+   // If no value is provided, then the default ones will be used,
+   // which are "YES" and "NO" when a service is respectively
+   // being enabled or disabled.
+   //
+   // Use this field only when the service does not use the
+   // default values for rcvar, for example the "sendmail"
+   // service for which you should use "NONE" as the value.
+   RCValue string `luar:"rcvalue"`
 }

 // NewService creates a new resource for managing services
@@ -98,18 +108,18 @@ func (s *Service) Update() error {
        return nil
    }

-   rcValue := "YES"
-   if !s.Enable {
-       rcValue = "NO"
-       if s.RCVar == "sendmail_enable" {
-           // I think sendmail is the only service, that requires NONE to be disabled.
-           rcValue = "NONE"
+   // Pick a default value, if we don't have one already
+   if s.RCValue == "" {
+       switch s.Enable {
+       case true:
+           s.RCValue = "YES"
+       case false:
+           s.RCValue = "NO"
        }
    }

    // TODO: rcvar should probably be deleted from rc.conf, when disabling service (except for sendmail).
-   // Currently we set it to NO.
-   return exec.Command("sysrc", fmt.Sprintf(`%s="%s"`, s.RCVar, rcValue)).Run()
+   return exec.Command("sysrc", fmt.Sprintf(`%s="%s"`, s.RCVar, s.RCValue)).Run()
 }

 func init() {

@kaey what do you think about this one?

Thanks,
Marin

Create base resource interface

Currently Gru is able to send tasks to remote minions, which once they receive the task simply execute a command.

We should take it further and implement a base resource type, which would give us a layer of abstraction on the commands/tasks being executed.

This would allow for creating resources such as package, file, service, etc. which would manage things in idempotent manner.

Add support for Vault

Add support for Vault so that we can use it to retrieve sensitive information from Lua when creating resources.

Create File resource

Implement resource for managing files, e.g.

resource "file" {
  path = "$HOME/.tmux.conf"
  owner = "dnaeon"
  group = "dnaeon"
}

DSL: Importing of modules

Be able to use imports in the HCL-based DSL language used to declare resources.

This would make it possible to create modular catalogs and allow for code re-use.

new release with most recent changes?

Last release is from 2017, but there have been more recent changes since, which address various bugs & new functionality. Perhaps makes sense to make a new release to avoid go getting master directly?

Create Shell resource

Implement a resource for executing shell commands.

Example resource declaration:

resource "shell" {
  name = "echoes foo"
  command = "echo foo"
}

Resource catalog

Use a resource catalog for all resources loaded from the given input and create a DAG graph to determine the proper order of resource evaluation.

Error while building gru

Hi,

I'm getting the output below, while trying to build gru after downloading it from github. Could you please take a look ?

root@pc:/home/user/go/gru#

ls
catalog classifier client contrib docs graph gructl integration LICENSE main.go Makefile minion README.md resource site task utils version
root@pc:/home/user/go/gru# make
go get -v -t -d ./...
github.com/dnaeon/gru (download)
created GOPATH=/root/go; see 'go help gopath'
github.com/coreos/etcd (download)
github.com/coreos/go-semver (download)
github.com/ugorji/go (download)
github.com/deckarep/golang-set (download)
github.com/blang/semver (download)
github.com/coreos/go-systemd (download)
github.com/godbus/dbus (download)
github.com/coreos/pkg (download)
github.com/pborman/uuid (download)
github.com/vmware/govmomi (download)
github.com/yuin/gopher-lua (download)
Fetching https://layeh.com/gopher-luar?go-get=1
Parsing meta tags from https://layeh.com/gopher-luar?go-get=1 (status code 200)
get "layeh.com/gopher-luar": found meta tag get.metaImport{Prefix:"layeh.com/gopher-luar", VCS:"git", RepoRoot:"https://github.com/layeh/gopher-luar"} at https://layeh.com/gopher-luar?go-get=1
layeh.com/gopher-luar (download)
github.com/dnaeon/backoff (download)
github.com/gosuri/uiprogress (download)
github.com/gosuri/uilive (download)
github.com/gosuri/uitable (download)
github.com/mattn/go-runewidth (download)
github.com/urfave/cli (download)
github.com/dnaeon/go-vcr (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
go build -ldflags="-s -w" -o bin/gructl -v
github.com/coreos/etcd/pkg/pathutil
github.com/coreos/etcd/pkg/types
github.com/coreos/go-semver/semver
github.com/ugorji/go/codec
github.com/deckarep/golang-set
github.com/coreos/etcd/version
github.com/blang/semver
github.com/coreos/etcd/pkg/srv
github.com/godbus/dbus
github.com/dnaeon/gru/graph
github.com/coreos/pkg/dlopen
github.com/pborman/uuid
github.com/dnaeon/gru/utils
github.com/vmware/govmomi/vim25/debug
github.com/vmware/govmomi/vim25/progress
github.com/vmware/govmomi/vim25/types
github.com/coreos/go-systemd/util
github.com/coreos/go-systemd/dbus
github.com/vmware/govmomi/vim25/xml
github.com/yuin/gopher-lua/ast
github.com/yuin/gopher-lua/parse
github.com/yuin/gopher-lua/pm
github.com/yuin/gopher-lua
github.com/dnaeon/gru/classifier
github.com/dnaeon/backoff
github.com/dnaeon/gru/task
github.com/gosuri/uilive
github.com/gosuri/uiprogress/util/strutil
github.com/gosuri/uiprogress
github.com/mattn/go-runewidth
github.com/gosuri/uitable/util/strutil
github.com/gosuri/uitable/util/wordwrap
github.com/gosuri/uitable
github.com/urfave/cli
github.com/dnaeon/gru/version
layeh.com/gopher-luar
github.com/coreos/etcd/client
github.com/vmware/govmomi/vim25/soap
github.com/vmware/govmomi/vim25/methods
github.com/vmware/govmomi/vim25
github.com/vmware/govmomi/vim25/mo
github.com/vmware/govmomi/property
github.com/vmware/govmomi/session
github.com/vmware/govmomi/list
github.com/vmware/govmomi/nfc
github.com/vmware/govmomi/task
github.com/vmware/govmomi
github.com/vmware/govmomi/object
github.com/vmware/govmomi/find
github.com/dnaeon/gru/resource

github.com/dnaeon/gru/resource

/root/go/src/github.com/dnaeon/gru/resource/vsphere_cluster.go:134:18: obj.ReconfigureCluster undefined (type *object.ClusterComputeResource has no field or method ReconfigureCluster)
Makefile:4: recipe for target 'build' failed
make: *** [build] Error 2

Create Package resource

Implement a resource for managing packages, e.g.

resource "package" {
  name = "tmux"
  state = "installed"
}

Resource dependencies

Implement resource dependencies and resolve the dependency graph, e.g. service X -> package X.

This would make it possible to define the order of how resources are being evaluated and processed.

Create Service resource

Implement resource for managing services, e.g.

resource "service" {
 name = "nginx"
 state = "running"
 enable = true
}

Syncing of modules and data to minions

We do want to have a way to sync modules and data files to remote minions.

That way we can also run minions in stand-alone mode if needed, but would allow minions to continue running in case we get disconnected.

Create a Timer resource

Would be nice to have a resource which can run commands or evaluate other resources periodically.

Something like a time.Ticker.

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.