Giter Club home page Giter Club logo

laika's Introduction

Laika

CircleCI Coverage Status

Laika is a feature flag/feature toggle service, written in Go, that allows the creation of flags and their activation/deactivation for specific environments. This way it is possible to control in which environments each feature is available. For instance, when a new feature is developed and released, it would make sense if it was only made available, at first, in a testing or Q&A environment, and only later in production. With Laika this can be achieved by simply going to a web page, selecting the feature, and changing its status on the desired environments.

Using Laika in a project thus allows for fast and continuous feature release and deployment.

laika-php is a PHP library that handles communication with Laika's API. You can get it here.

laika-react is a React JS module that handles communication with Laika's API. You can get it here.

API Reference

Laika uses CQRS, the query endpoints are as follows.

Method Endpoint Description
GET /api/health Check the service health
GET /api/features List all features
GET /api/features/:name Get a feature by name
GET /api/features/:name/status/:env Get the status of a feature
in a particular environment
GET /api/environments List all environments

The command endpoint is for manipulating data.

Method Endpoint Example body Description
POST /api/events/environment_created {"name":"staging"} Create a new environment.
POST /api/events/feature_created {"name":"feature1"} Create a new feature.
POST /api/events/user_created {"username":"admin","password":"secret"} Create a new user.
POST /api/events/feature_toggled {"feature":"feature1","environment":"staging","status":true} Toggle a feature.
POST /api/events/feature_deleted {"name":"feature1"} Delete a feature.
POST /api/events/environments_ordered {"order":["dev","staging"]} Change env display order.
POST /api/events/environment_deleted {"name":"staging"} Delete an environment.

Client

Laika contains a polling HTTP client that allows to easily check for enabled/disabled features on Go code. It can be found in the client package.

Install

$ go get -u github.com/MEDIGO/laika/client

Usage

package main

import (
	"log"

	"github.com/MEDIGO/laika/client"
)

func main() {
	c, err := client.NewClient(client.Config{
		Addr:        "127.0.0.1:8000",
		Username:    "my-username",
		Password:    "my-password",
		Environment: "prod",
	})

	if err != nil {
		log.Fatal(err)
	}

	if c.IsEnabled("my-awesome-feature", false) {
		log.Print("IT'S ALIVE!")
	} else {
		log.Print("Move along. Nothing to see here.")
	}
}

Developing

To develop Laika you need to have the following tools installed in your machine:

Build and start the docker contaniers and continuously run/build the server and UI with:

$ make develop

And start hacking!

$ open http://localhost:8000

Testing

The whole test suite can be executed with:

$ make test

The docker setup starts with a mysql database. If you would like to connect to your own database, you can pass the configuration to them with the following environment variables:

LAIKA_TEST_MYSQL_HOST=db
LAIKA_TEST_MYSQL_PORT=3306
LAIKA_TEST_MYSQL_USERNAME=root
LAIKA_TEST_MYSQL_PASSWORD=root
LAIKA_TEST_MYSQL_DBNAME=laika

Current state of the project

In the current release of Laika, it is possible to create feature flags and enable/disable them in the existing environments.

Wishlist

  • Specify country access (e.g. feature only enabled in Germany).
  • Specify user access with percentage (e.g. feature only enabled for 30% of the user base).
  • Have a field for environment creation on the web page.
  • History for flag status changes.

Copyright and license

Copyright © 2019 MEDIGO GmbH.

Laika is licensed under the MIT License. See LICENSE for the full license text.

laika's People

Contributors

alexyans avatar d-buettner avatar dbrabera avatar dependabot[bot] avatar eggman64 avatar jo-ie avatar mbernardes avatar pb- avatar peterzernia avatar soonick avatar ssimono avatar utsavtiwary04 avatar

Watchers

 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.