fabric8-toggles-service

command module
v0.0.0-...-e98f407 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

= Fabric8 toggles service

// Settings:
:allow-uri-read:
:safe: unsafe
:idprefix:
:idseparator: -
ifndef::env-github[:icons: font]
ifdef::env-github,env-browser[]
:toc: macro
:toclevels: 1
endif::[]
ifdef::env-github[]
:branch: master
:status:
:outfilesuffix: .adoc
:!toc-title:
:caution-caption: :fire:
:important-caption: :exclamation:
:note-caption: :paperclip:
:tip-caption: :bulb:
:warning-caption: :warning:
endif::[]

toc::[]

== Overview

The fabric8-toggles-service is the client service to run with the link:https://github.com/fabric8-services/fabric8-toggles/[fabric8-toggles] server.
The server is heavily based on link:https://github.com/Unleash/unleash[Unleash server], a *feature toggle system*, that gives you a great overview over all feature toggles across all your applications and services.
It comes with official client implementations for Java, Node.js and Go.

fabric8-server defines 4 level of toggle configuration: `internal`, `experimental`, `beta` or `released`.
The activation strategy is per userGroupId.

Using the admin console deployed with fabric8-toggle, you can easily
move a feature from `experimental` to `beta`.
This client makes use of the unleash Go SDK to connect to fabric8-toggles server.

You can see usage of the service in link:https://github.com/fabric8-ui/fabric8-ui[fabric8-ui].

== Development

=== Build

The following guide is mainly targeted towards a Linux or macOS development
machine.

==== Pre-requisites

Have the following installed on your machine:

`go` Install link:https://golang.org/dl/[GoLang from 1.8+], set the environment variable `GOPATH`.

==== Get the code

```sh
$ git clone https://github.com/fabric8-services/fabric8-toggles-services $GOPATH/src/github.com/fabric8-services/fabric8-toggles-service
```

==== Build

To fetch the Go dependencies, generate code (link:https://github.com/goadesign/goa[GOA framework]) and finally build the project you can
type:

[source,shell]
----
$ cd $GOPATH/src/github.com/fabric8-services/fabric8-toggles-service
$ make clean build
----

==== Run test

To run unit tests:
```
make build test
```

=== Docker build

* build image from centos

```
make image
```

* run your docker image in minishift
```
make deploy-minishift
```

* Deploy locally:

```
F8_TOGGLES_URL=http://toggles-fabric8.192.168.64.4.xip.io/api F8_AUTH_URL=https://auth.prod-preview.openshift.io make run
```
where `F8_TOGGLES_URL` points to the exposed route on minishift and `F8_AUTH_URL` target prod-preview.

=== Configure

==== Configure unleash database

* Go to fabric8-toggles-server admin console (ie: the unleash admin console) http://fabric8-toggles-fabric8.MINISHIFT_IP.nip.io
* In strategy tab:
  ** add a strategy with name `enableByLevel` with a parameter `level`, choose `string` for parameter type.
  ** add a strategy with name `enableByEmails` with a parameter `emails`, choose `list` for parameter type.
* Go to features list:
  ** add a feature with name "Planner", give a description and add the newly created `enableByLevel` strategy, enter `released`.
  ** add a feature with name `Analyze`, give a description and add the newly created `enableByEmails` strategy, enter your prod-preview and prod emails.
for `level`. Enable the feature.

[NOTE]
This is a temporary settings, the fabric8-server should bootstrap those values.

==== Test your service locally with a curl

* For anonymous user

```
$ curl http://localhost:8080/api/features?names\=Planner
{
  "data": [
    {
      "attributes": {
        "description": "Planner's description",
        "enabled": true,
        "enablement-level": "released",
        "user-enabled": true
      },
      "id": "Planner",
      "type": "features"
    }
  ]
}
```

* For logged-in user

```
$ export TOKEN=YOUT_TOKEN
$ curl http://localhost:8080/api/features\?group\=Analyze -H "Authorization: Bearer $TOKEN"
```

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
goasupport

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL