Giter Club home page Giter Club logo

servpeek's Introduction

servpeek

circleci GoDoc

Introspective peek into your infrastructure guts

Motivation

Currently the most widely used tools for testing your infrastructure are serverspec and infrataster.

However these tools being written in ruby carry a decent amount of runtime an gem dependencies. Writing a simple tool in Go programming language would help to address runtime dependency "issue" and would further simplify the ditribution and speed of deployment of infrastructure.

Current state

Current project design might be a bit of an overkill mostly because of my Go incompetence or because the projects tries to create abstractions on top of already existing abstractions (package managers, commands etc.). Turns out modelling this is not that easy :-/

Project currently provides support for various package managers: apt, yum, apk, gem and pip as well as file and service inspections. More resources will be added later as the project moves on [if].

Usage

The project does not offer a single program to run as it stands right now. Instead a simple API is provided that allows you to build your own go binaries that can then be used to test your infrastrucure. Statically linked binary alleviates a necessity to have any language runtime available on the tested infrastructure servers. Obviously, you have an option to create your own _test.go files that can be run using go test, but like already said you will need to have the go tool chain available on the tested server. The choice is really up to you, but my recommendation is to build and shipt the binaries.

Example

Get the package:

$ go get github.com/milosgajdos83/servpeek

Write a go program that does some testing:

package main

import (
	"log"

	"github.com/milosgajdos83/servpeek/file"
	"github.com/milosgajdos83/servpeek/pkg"
)

func main() {
	// Test if a gem package is installed
	gemPkg, err := pkg.NewPackage("gem", "bundler", "1.10.6")
	if err != nil {
		log.Fatal(err)
	}

	if err := pkg.IsInstalled(gemPkg); err != nil {
		log.Fatal(err)
	}

	// Test if /etc/hosts is a regular file
	f := file.NewFile("/etc/hosts")
	if err := file.IsRegular(f); err != nil {
		log.Fatal(err)
	}
}

You can find a more elaborate example program in the examples directory.

TODO

  • A LOT more resources
  • Better logging and error statements

servpeek's People

Contributors

agonzalezro avatar milosgajdos avatar

Watchers

 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.