-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge distributive and goss #113
Comments
Technically, this probably wouldn't be too complex. Distributive has a lot more aspects that it can examine, but is separated into packages that could just as easily be used as part of goss. What do you think @aelsabbahy? |
Just found out about Distributive this morning and https://github.com/milosgajdos83/servpeek by @milosgajdos83 a few days earlier. Perhaps we can all agree to a shared interface for probing system resources and have that be maintained as a separate package/repo, much like specinfra is a separate gem from serverspec? I haven't looked at the Distributive code yet, but would be interesting to see what checks are there and how each of us approached the problem. |
I like the idea of a shared interface library. Maybe create a new top-level project that provides a standard way of checking resources on servers that is easy to embed in other go programs. |
@aelsabbahy Here's Distributive's interface: // Check is a unified interface for health checks, it defines only the minimal
// necessary behaviors, while allowing each check to parse and store type-safe
// parameters.
type Check interface {
// ID is a uniquely identifying check name, like "running" or "temp"
ID() string
// New both validates the JSON-provided parameters (list of strings),
// and parses and stores them in an internal, typed field for later access.
New(parameters []string) (Check, error)
// Status returns the status of the check at the instant it is called.
//
// msg is a descriptive, human-readable description of the status.
//
// code is exit code defining whether or not this check is passing. 0 is
// considered passing, 1 is failing, with other values reserved for later
// use.
Status() (code int, msg string, err error)
} This is less than ideal, because each check has to parse its arguments from a string if they are actually of a different type (e.g. Port parses its argument to a uint16). The big question for our interface is probably how to maintain both a generic interface and type safety. |
Disributive and goss are almost exactly the same
Common interface // Any package would have to implement this interface
type Package interface {
// Name of the package
Name() string
// Whether the package is installed
Installed() (bool, error)
// Versions of the package that are installed
Versions() ([]string, error)
} At that point, one can build From goss's perspective, here are the important requirements from a probing library:
|
@aelsabbahy Agreed on all points. As a starting point, Distributive has subpackages |
Awesome! 👍 |
We're beginning collaboration on this document. Anybody can comment here (or on the doc) with input! |
From the doc:
In an OS with systemd (CentOS, future versions of Debian...) you don't have "service", you have "systemctl". There's no point in abstracting away the difference between them though, so it's maybe best to have one sysvinit package and one systemd package? |
This looks like a "fact" to me (similar to puppet/ansible facts). One type of check could be to evaluate the facts' values against some criteria. (But that can't model things like health checks based on http calls) I'm sure this kind of library could be used from consul as well (@armon ?), I believe consul implements almost the same thing for HTTP checks today. |
Agree, with a small modification To clarify: Interface: Implementations:
Looks more like a provider to me, take a look at the puppet provider for file. The For this library to be compatible with
Not sure I follow.. couldn't a health check simply leverage the provider? func HealthCheckUsingUrlProvider(url string) bool {
// URLProvider being an example provider from the library in our discussion
u := URLProvider.New(url)
if u.Code() == "200" {
return true
}
return false
} |
Yes; a health check should be able to use a provider like that. |
@siddharthist You've already done a great job on the distributive project, and it helps us a lot at FINN! But how would you feel about merging every feature that distributive has, into goss (given it fits into goss' design?), and then adapt goss for the mantl project going forward? It doesn't look like there are any directly conflicting interests between the two projects; no use cases that distributive solves, but goss, on the other hand, is explicitly meant not to solve? |
@eirslett That sounds just fine to me! I think maintaining a separate library would still be of interest for other projects. @stevendborrelli What do you think? |
I'm in the process of beginning to use goss as a library for distributive where its resources align. I'll keep track of progress here:
|
https://github.com/aelsabbahy/goss
Looks like goss does (almost) exactly the same thing as distributive. Would it be possible to merge the two projects? Instead of reimplementing every feature/reinventing the wheel, they could combine efforts and build more features.
@aelsabbahy
The text was updated successfully, but these errors were encountered: