From ece20d7ac447e773ebb71f59d642eef23065ff94 Mon Sep 17 00:00:00 2001 From: Mark Phelps <209477+markphelps@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:46:15 -0400 Subject: [PATCH] Libsql (#136) * feat: libsql updates * chore: fix ` * chore: add note about auth token --- configuration/overview.mdx | 26 +++++++++---------- configuration/storage.mdx | 51 ++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 31 deletions(-) diff --git a/configuration/overview.mdx b/configuration/overview.mdx index 2434895..f91e4d9 100644 --- a/configuration/overview.mdx +++ b/configuration/overview.mdx @@ -142,19 +142,19 @@ These properties are as follows: ### Database -| Property | Description | Default | Since | -| ------------------------------ | ------------------------------------------------------------------------------------------- | ----------------------------------- | ---------------------- | -| db.url | URL to access Flipt database | file:/(OS Dependent)/flipt/flipt.db | v1.26.0 \*OS Dependent | -| db.protocol | Protocol (SQLite, MySQL, PostgreSQL, CockroachDB) for Flipt database (URL takes precedence) | | v0.18.0 | -| db.host | Host to access Flipt database (URL takes precedence) | | v0.18.0 | -| db.port | Port to access Flipt database (URL takes precedence) | | v0.18.0 | -| db.name | Name of Flipt database (URL takes precedence) | | v0.18.0 | -| db.user | User to access Flipt database (URL takes precedence) | | v0.18.0 | -| db.password | Password to access Flipt database (URL takes precedence) | | v0.18.0 | -| db.max_idle_conn | The maximum number of connections in the idle connection pool | 2 | v0.17.0 | -| db.max_open_conn | The maximum number of open connections to the database | unlimited | v0.17.0 | -| db.conn_max_lifetime | Sets the maximum amount of time in which a connection can be reused | unlimited | v0.17.0 | -| db.prepared_statements_enabled | Enable or disable prepared statements for database queries | true | v1.23.1 | +| Property | Description | Default | Since | +| ------------------------------ | ------------------------------------------------------------------- | ----------------------------------- | ---------------------- | +| db.url | URL to access Flipt database | file:/(OS Dependent)/flipt/flipt.db | v1.26.0 \*OS Dependent | +| db.protocol | Protocol for Flipt database (URL takes precedence) | | v0.18.0 | +| db.host | Host to access Flipt database (URL takes precedence) | | v0.18.0 | +| db.port | Port to access Flipt database (URL takes precedence) | | v0.18.0 | +| db.name | Name of Flipt database (URL takes precedence) | | v0.18.0 | +| db.user | User to access Flipt database (URL takes precedence) | | v0.18.0 | +| db.password | Password to access Flipt database (URL takes precedence) | | v0.18.0 | +| db.max_idle_conn | The maximum number of connections in the idle connection pool | 2 | v0.17.0 | +| db.max_open_conn | The maximum number of open connections to the database | unlimited | v0.17.0 | +| db.conn_max_lifetime | Sets the maximum amount of time in which a connection can be reused | unlimited | v0.17.0 | +| db.prepared_statements_enabled | Enable or disable prepared statements for database queries | true | v1.23.1 | ### Storage diff --git a/configuration/storage.mdx b/configuration/storage.mdx index 7ea55e2..e1dc1d8 100644 --- a/configuration/storage.mdx +++ b/configuration/storage.mdx @@ -5,16 +5,16 @@ description: This document describes how to configure Flipt's storage backend me ## 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/) 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/) databases. -SQLite is enabled by default for simplicity, however, you should use PostgreSQL, MySQL, or CockroachDB if you intend to run multiple copies of Flipt in a high -availability configuration. + + As of [v1.29.0](https://github.com/flipt-io/flipt/releases/tag/v1.29.0), Flipt + also supports [libSQL](https://github.com/tursodatabase/libsql) which is a + fork of SQLite that can be accessed over a network via + [sqld](https://github.com/tursodatabase/libsql/tree/main/libsql-server). + - - All databases except for SQLite must exist and be up and running before Flipt - will be able to connect to it. - +SQLite is enabled by default for simplicity, however, you should use PostgreSQL, MySQL, or CockroachDB if you intend to run multiple copies of Flipt in a high availability configuration. The database connection can be configured as follows: @@ -32,6 +32,31 @@ db: url: file:/var/opt/flipt/flipt.db ``` +### LibSQL + +See our [libSQL Example](https://github.com/flipt-io/flipt/blob/main/examples/database/libsql) for a working example of how to use libSQL with Flipt. + +#### Local + +```yaml +db: + # libsql: informs flipt to use libSQL + url: libsql://file:/var/opt/flipt/flipt.db +``` + +#### Remote + + + If using [Turso](https://turso.tech/) you must use a [database auth + token](https://docs.turso.tech/reference/turso-cli#creating-a-database-token) + to access the database. + + +```yaml +db: # http(s): informs flipt to use libSQL over HTTP(s) via sqld/Turso + url: https://db-[your-github-name].turso.io?authToken=[your-auth-token] +``` + ### PostgreSQL ```yaml @@ -91,11 +116,6 @@ when the migration container exits, having no effect on your Flipt instance! ## Filesystem - - This feature was added as an experiment in Flipt `v1.23.0` and officially - supported in Flipt `v1.25.0`. - - The following backend types are designed to support declarative management of feature flag state. In particular, they're designed to support GitOps practices with minimal external dependencies. @@ -213,11 +233,6 @@ See our [GitOps Guide](/guides/get-going-with-gitops) for an example of how to s ### Object - - This feature was added as an experiment in Flipt `v1.24.0` and officially - supported in Flipt `v1.25.0`. - - The object storage type supports using a hosted object storage service as the source of truth for Flipt state configuration. Currently, Flipt supports the [S3 API](https://aws.amazon.com/s3/) as a backend. This means the AWS S3 and open-source alternatives such as [Minio](https://github.com/minio/minio) can be leveraged as Flipt backends.