Skip to content

Commit

Permalink
chore: minor readme updates and tweaks (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps authored Oct 8, 2023
1 parent 8d0ee39 commit 503058c
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@ We'll be adding more applications over time, so check back often!

- [Chatbot](./chatbot/README.md) - A set of tutorials on how to use Flipt in different scenarios, based on the idea of releasing an AI-powered chatbot.
- [Cup](./cup/README.md) - A tutorial demonstrating the [Cup project](https://github.com/flipt-io/cup) managing different configuration formats.

## Prerequisites

- [Node.js](https://nodejs.org/en/download/) (v16 or higher)
- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Sidecar](./sidecar/README.md) - Demonstrates how to use Flipt as a sidecar to your application for fast evaluations in various configurations.

## Usage

1. Clone this repository
1. `cd` into a subdirectory (e.g. `cd chatbot`)
1. Run `./scripts/start`
1. Run `./scripts/start` or similar scripts to start the application

## Troubleshooting

Expand Down
3 changes: 2 additions & 1 deletion chatbot/scripts/start
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

set -e

cd "$(dirname "$0")/.."

pushd frontend
npm i && npm run start
popd
18 changes: 9 additions & 9 deletions cup/argo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ This labs section explores configuring an end-to-end CD pipeline with Argo and C

![Cup with ArgoCD Diagram](./diagram.svg)

https://github.com/flipt-io/labs/assets/1253326/4dfb87ec-446c-40dc-84d1-2764bd600fd1
<https://github.com/flipt-io/labs/assets/1253326/4dfb87ec-446c-40dc-84d1-2764bd600fd1>

The project deploys a simple application via Argo, which responds with a JSON payload containing its environment variables.
It also configures an instance of Cup and a source Git repository hosted via Gitea.

Once deployed to a local `kind` cluster, you can experiment with reading and reconfiguring the deployment configuration via the `cup` CLI.

### Requirements
## Prerequisites

- Go
- Kubectl
- Docker
- [Docker](https://www.docker.com/)
- [Kubectl](https://kubernetes.io/docs/reference/kubectl/)
- [Cup CLI](https://github.com/flipt-io/cup#cli)
- Dagger (Optional)
- [Dagger](https://dagger.io/) (Optional)

### Running
## Running

```console
# clone the labs repository
Expand All @@ -33,7 +33,7 @@ cd labs/cup/argo
./scripts/start
```

### Experiment!
## Experiment

This process can take a while for the first time.

Expand All @@ -47,8 +47,8 @@ It will:
- Port-forward the various services
- [ArgoCD](http://localhost:8080) (Skip the TLS warning check output from previous step for username and password)
- [Gitea](http://localhost:3000) (Username: `cup` Password: `password`)
- Cupd API is forwarded to http://localhost:8181
- Demo app API is forwarded to http://localhost:8282
- Cupd API is forwarded to <http://localhost:8181>
- Demo app API is forwarded to <http://localhost:8282>

The end result is an entire CD pipeline in your local Docker instance.
From here you can leverage the `cup` CLI to interface with `cupd`.
Expand Down
3 changes: 3 additions & 0 deletions cup/argo/scripts/start
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash
set -e

cd "$(dirname "$0")/.."

if command -v dagger > /dev/null; then
dagger run go run ./cmd/provision/main.go
Expand Down
17 changes: 9 additions & 8 deletions sidecar/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Flipt as a Sidecar
------------

The intent of this lab is to explore the ways that clients can achieve fast evaluations from Flipt for their feature flags. The use case here is that users would like data locality for their feature flag state, so they do not have to worry about network latency to evaluate a feature, especially for their most critical application paths.
The intent of this lab is to explore the ways that clients can achieve fast evaluations from Flipt for their feature flags. The use case here is that users want data locality for their feature flag state, so they do not have to worry about network latency to evaluate a feature, especially for their most critical application paths.

## Replication

This project is housed under the `replication` directory. The purpose is for a user to run their application which depends on feature flags with a sidecar Flipt process that pulls data from either an Object Store (S3 bucket) or a Local Filesystem to the container. The evaluation data can then be accessed over `localhost` by talking to the Flipt sidecar.

Lets get started!

Prerequisites:
## Prerequisites

- [Docker](https://www.docker.com/)
- [Kubectl](https://kubernetes.io/docs/reference/kubectl/)
- [Minikube](https://minikube.sigs.k8s.io/docs/)
Expand All @@ -21,6 +22,7 @@ Run the deploy script `scripts/start-object-store` to provision the cluster and
<img src="./replication/diagrams/diagram-object-store.svg" alt="Object Store Replication" width="500px" />

This above script deploys the following to Kubernetes:

- `minio`: Object store that has an S3 compatible API
- `flipt-master`: Serves as the main Flipt application, this is where users will be accessing the UI to make relevant changes
- `sample-app`: Serves as the pod with Flipt running as a sidecar, `flipt-sidecar`. There is also a container called `evaluation-client` that will make evaluation calls to the sidecar
Expand All @@ -45,16 +47,15 @@ Here are the steps to do so:
1. Access the frontend for the `sample-app` via Kubernetes port-forward

```bash
$ kubectl port-forward svc/sample-app --namespace default 8000:8000
kubectl port-forward svc/sample-app --namespace default 8000:8000
```

2. Switch between `Sidecar` and `Master` and choose a flag `flag_001 - flag_010` and evaluate the time difference


You can also access the `flipt-master` via Kubernetes port-forward and make changes to the state via the UI:

```bash
$ kubectl port-forward svc/flipt-master --namespace default 8080:8080
kubectl port-forward svc/flipt-master --namespace default 8080:8080
```

### cURL
Expand All @@ -64,13 +65,13 @@ For users of the terminal you can also hit an endpoint to see the differences of
1. Port forward `sample-app`

```bash
$ kubectl port-forward svc/sample-app --namespace default 8000:8000
kubectl port-forward svc/sample-app --namespace default 8000:8000
```

2. Make request with `curl`

```bash
$ curl localhost:8000/cli/backend/{backend}/evaluation/{flagKey}
curl localhost:8000/cli/backend/{backend}/evaluation/{flagKey}
```

The backend should be of either type (`sidecar` or `master`), and the `flagKey` should be between `flag_001 - flag_010`.
The backend should be of either type (`sidecar` or `master`), and the `flagKey` should be between `flag_001 - flag_010`.
2 changes: 1 addition & 1 deletion sidecar/replication/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM golang:1.21-alpine
WORKDIR /app

COPY go.* .
COPY index.tmpl .
COPY index.html.tmpl .
COPY main.go .

RUN go build -o /evaluation-client
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sidecar/replication/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"google.golang.org/grpc/status"
)

//go:embed index.tmpl
//go:embed index.html.tmpl
var indexTmplContent string

var t = template.Must(template.New("").Parse(indexTmplContent))
Expand Down

0 comments on commit 503058c

Please sign in to comment.