Skip to content
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

feat(config): add details around OCI #143

Merged
merged 8 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 55 additions & 47 deletions configuration/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,52 @@ The server will check in a few different locations for server configuration (in
You can edit any of these properties to your liking, and on restart Flipt will
pick up the new changes.

These properties are as follows:
## Environment Variables

All options in the configuration file can be overridden using environment
variables using the syntax:

```yaml
FLIPT_<SectionName>_<KeyName>
```

Environment variables **MUST** have `FLIPT_` prefix and be in `UPPER_SNAKE_CASE` format.

<Note>
Using environment variables to override defaults is especially helpful when
running with Docker as described in the [Installation](/installation)
documentation.
</Note>

Keys should be uppercase and `.` should be replaced by `_`. For example,
given these configuration settings:

```yaml
server:
grpc_port: 9000

### General
db:
url: file:/var/opt/flipt/flipt.db
```

You can override them using:

```console
export FLIPT_SERVER_GRPC_PORT=9001
export FLIPT_DB_URL="postgres://postgres@localhost:5432/flipt?sslmode=disable"
```

### Multiple Values

Some configuration options can have a list of values. For example, the `cors.allowed_origins` option can have multiple origins.

In this case, you can use a space separated list of values for the environment variable override:

```console
export FLIPT_CORS_ALLOWED_ORIGINS="http://localhost:3000 http://localhost:3001"
```

## Configuration Parameters

| Property | Description | Default | Since |
| ----------------------------- | ------------------------------------------------------------- | ------------------- | ------- |
Expand Down Expand Up @@ -199,6 +242,16 @@ These properties are as follows:
| storage.object.s3.endpoint | The S3 endpoint to use for object storage | | v1.25.0 |
| storage.object.s3.poll_interval | The interval to poll S3 for changes | 30s | v1.25.0 |

#### Storage OCI

| Property | Description | Default | Since |
| ------------------------------------------ | ----------------------------------------------------- | --------------------- | ------- |
| storage.object.oci.repository | The target bundle repository (with optional registry) | | v1.31.0 |
| storage.object.oci.authentication.username | The username to use for authentication | | v1.31.0 |
| storage.object.oci.authentication.password | The password to use for authentication | | v1.31.0 |
| storage.object.oci.bundles_directory | The directory in which to store local bundles | $config/flipt/bundles | v1.31.0 |
| storage.object.oci.poll_interval | The interval to poll the registry for changes | 30s | v1.31.0 |
GeorgeMac marked this conversation as resolved.
Show resolved Hide resolved

### Cache

| Property | Description | Default | Since |
Expand Down Expand Up @@ -291,48 +344,3 @@ be logged in the Flipt logs when a deprecated configuration option is used.

All deprecated options are listed in the [DEPRECATIONS](https://github.com/flipt-io/flipt/blob/main/DEPRECATIONS.md) file
in the Flipt repository as well as the [CHANGELOG](https://github.com/flipt-io/flipt/blob/main/CHANGELOG.md).

## Environment Variables

All options in the configuration file can be overridden using environment
variables using the syntax:

```yaml
FLIPT_<SectionName>_<KeyName>
```

Environment variables **MUST** have `FLIPT_` prefix and be in `UPPER_SNAKE_CASE` format.

<Note>
Using environment variables to override defaults is especially helpful when
running with Docker as described in the [Installation](/installation)
documentation.
</Note>

Keys should be uppercase and `.` should be replaced by `_`. For example,
given these configuration settings:

```yaml
server:
grpc_port: 9000

db:
url: file:/var/opt/flipt/flipt.db
```

You can override them using:

```console
export FLIPT_SERVER_GRPC_PORT=9001
export FLIPT_DB_URL="postgres://postgres@localhost:5432/flipt?sslmode=disable"
```

### Multiple Values

Some configuration options can have a list of values. For example, the `cors.allowed_origins` option can have multiple origins.

In this case, you can use a space separated list of values for the environment variable override:

```console
export FLIPT_CORS_ALLOWED_ORIGINS="http://localhost:3000 http://localhost:3001"
```
49 changes: 43 additions & 6 deletions configuration/storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: Storage
description: This document describes how to configure Flipt's storage backend mechanisms.
---

## Databases
## Relational Database Backends
GeorgeMac marked this conversation as resolved.
Show resolved Hide resolved

Flipt supports [SQLite](https://www.sqlite.org/index.html), [PostgreSQL](https://www.postgresql.org/), [CockroachDB](https://www.cockroachlabs.com/) and [MySQL](https://dev.mysql.com/) databases.
Flipt supports [SQLite](https://www.sqlite.org/index.html), [PostgreSQL](https://www.postgresql.org/), [CockroachDB](https://www.cockroachlabs.com/) and [MySQL](https://dev.mysql.com/) relational databases.

<Note>
As of [v1.29.0](https://github.com/flipt-io/flipt/releases/tag/v1.29.0), Flipt
Expand Down Expand Up @@ -114,14 +114,14 @@ docker run -it -v $HOME/flipt:/var/opt/flipt flipt/flipt:latest /bin/sh -c './fl
If you don't use mounted volumes to persist your data, your data will be lost
when the migration container exits, having no effect on your Flipt instance!

## Filesystem
## Declarative Backends
GeorgeMac marked this conversation as resolved.
Show resolved Hide resolved

The following backend types are designed to support declarative management of feature flag state.
The following backend types are designed to support declarative management of feature flag state via a well-known file format.
In particular, they're designed to support GitOps practices with minimal external dependencies.

Currently, we classify `local`, `git`, and `object` as the three filesystem backends.
Currently, we classify `local`, `git`, `object` and `oci` as the four declarative backends.
The `local` backend has been primarily developed to support a local development experience,
whereas, the `git` and `object` backends are intended for production and serve flag state directly from a configurable repository and Git reference (e.g. branch) or object storage bucket.
whereas, the `git`, `object` and `oci` backends are intended for production use.

### Read Only Mode

Expand Down Expand Up @@ -321,6 +321,43 @@ AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
```

### OCI

Since `v1.31.0`, Flipt supports using any [OCI](https://opencontainers.org/) compatible registry as a declarative backend source.
Flipt has its own custom OCI manifest format (we call them `bundles`), which can be built and managed using the [Flipt CLI](/cli/commands/bundle).

<Tabs>
<Tab title="Environment Variable">

```bash
FLIPT_STORAGE_TYPE="oci"
FLIPT_STORAGE_OCI_REPOSITORY="some.oci.registry/repository/image:tag"
FLIPT_STORAGE_OCI_POLL_INTERVAL="30s"
# authentication credentials
FLIPT_STORAGE_OCI_AUTHENTICATION_USERNAME="username"
FLIPT_STORAGE_OCI_AUTHENTICATION_PASSWORD="password"
# location used for storing local bundles
FLIPT_STORAGE_OCI_BUNDLES_DIRECTORY="<user_config_dir>/flipt/bundles"
```

</Tab>
<Tab title="Configuration Yaml">

```yaml
storage:
type: "oci"
oci:
repository: "some.oci.registry/repository/image:tag"
poll_interval: "30s"
authentication:
username: "username"
password: "password"
bundles_directory: "<user_config_dir>/flipt/bundles"
```

</Tab>
</Tabs>

### Flag State Configuration

Each of Flipt's filesystem backends expects you to represent your feature flag configuration via a set of YAML files.
Expand Down
6 changes: 3 additions & 3 deletions guides/get-going-with-gitops.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ Flipt will track the HEAD of this repository's `main` branch.
Changes will eventually propagate into our running instance of Flipt.

<Info>
Head to [Configuration: Storage: Filesystem
Backends](/configuration/storage#filesystem) to learn more about configuring
these backend types for Flipt.
Head to [Configuration: Storage: Declarative Backends
Backends](/configuration/storage#declarative-backends) to learn more about
configuring these backend types for Flipt.
</Info>

### Pushing Our New Flag To Production
Expand Down
3 changes: 2 additions & 1 deletion integration/rest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Official Flipt REST clients are currently available in the following languages:
href="https://github.com/flipt-io/flipt-php"
title="PHP (Beta)"
icon="php"
color="#4c8abe">
color="#4c8abe"
>
Evaluate flags in your PHP applications
</Card>
<Card
Expand Down
2 changes: 1 addition & 1 deletion tooling/github-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: How to use our GitHub Actions to automate your workflows.

![Flipt Validate Action](/images/tooling/validate-action.png)

The [flipt-validate action](https://github.com/flipt-io/validate-action) is used to validate your [features.yml](/configuration/storage#flag-state-configuration) files in a GitHub workflow. We recommend to use this action in your workflow to ensure that your Flipt data is syntactically and semantically valid before deploying when using [Git](https://www.flipt.io/docs/configuration/storage#git) or other [file-based backends](https://www.flipt.io/docs/configuration/storage#filesystem).
The [flipt-validate action](https://github.com/flipt-io/validate-action) is used to validate your [features.yml](/configuration/storage#flag-state-configuration) files in a GitHub workflow. We recommend to use this action in your workflow to ensure that your Flipt data is syntactically and semantically valid before deploying when using [Git](https://www.flipt.io/docs/configuration/storage#git) or other [declarative backends](https://www.flipt.io/docs/configuration/storage#declarative-backends).

It uses the [`flipt validate`](/cli/commands/validate) command under the hood to validate your data. If the data is invalid, the action will fail and provide a detailed error annotation at the source of the error.

Expand Down