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: add Flipt to playground #293

Merged
merged 5 commits into from
May 22, 2024
Merged

feat: add Flipt to playground #293

merged 5 commits into from
May 22, 2024

Conversation

lukas-reining
Copy link
Member

This PR

Adds Flipt to the playground as discussed with @markphelps.

@markphelps for being able to show "live changing" of flags I chose not to use the read-only mode with static flag definitions.
I chose to use SQLite and created a copy of a DB with configured flags that can be copied before doing docker compose up.
Otherwise Flipt works great with the Playground and is a great addition for showing live changes in an UI.

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
@markphelps
Copy link

cheers @lukas-reining !! thank you very much for adding Flipt to the playground!

I'm having trouble finding Flipt in the list of providers in the playground to switch between, am I doing something wrong?

CleanShot 2024-05-18 at 08 57 48

Note: I can access the Flipt UI and see that the flags / sqlite data has been imported correctly

CleanShot 2024-05-18 at 08 59 07

@lukas-reining
Copy link
Member Author

cheers @lukas-reining !! thank you very much for adding Flipt to the playground!

I'm having trouble finding Flipt in the list of providers in the playground to switch between, am I doing something wrong?

CleanShot 2024-05-18 at 08 57 48

Note: I can access the Flipt UI and see that the flags / sqlite data has been imported correctly

CleanShot 2024-05-18 at 08 59 07

Hey @markphelps, I guess you will need to comment out the image in the docker-compose.yaml for the demo and the fib service:

services:
  demo:
    image: ghcr.io/open-feature/playground-app:v0.15.2 # x-release-please-version
    # build:
    #  dockerfile: ./packages/app/Dockerfile
    #  context: .

to

services:
  demo:
    # image: ghcr.io/open-feature/playground-app:v0.15.2 # x-release-please-version
    build:
    dockerfile: ./packages/app/Dockerfile
    context: .

Does it work now? :)

@markphelps
Copy link

cheers @lukas-reining !! thank you very much for adding Flipt to the playground!
I'm having trouble finding Flipt in the list of providers in the playground to switch between, am I doing something wrong?
CleanShot 2024-05-18 at 08 57 48
Note: I can access the Flipt UI and see that the flags / sqlite data has been imported correctly
CleanShot 2024-05-18 at 08 59 07

Hey @markphelps, I guess you will need to comment out the image in the docker-compose.yaml for the demo and the fib service:

services:
  demo:
    image: ghcr.io/open-feature/playground-app:v0.15.2 # x-release-please-version
    # build:
    #  dockerfile: ./packages/app/Dockerfile
    #  context: .

to

services:
  demo:
    # image: ghcr.io/open-feature/playground-app:v0.15.2 # x-release-please-version
    build:
    dockerfile: ./packages/app/Dockerfile
    context: .

Does it work now? :)

silly me, yes works great now thank you!

one idea instead of requiring users to copy over the sqlite db before running docker-compose up would be that we could take advantage of our import functionality: https://docs.flipt.io/operations/import-export#import to import the flag state from yaml.

we do this in our examples via an init service in docker-compose, ex: https://github.com/flipt-io/flipt/blob/main/examples/openfeature/docker-compose.yml#L11-L20

it might be a bit more portable this way, but im happy either way 😄

Copy link

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @lukas-reining !! looks great

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
@lukas-reining
Copy link
Member Author

lukas-reining commented May 18, 2024

cheers @lukas-reining !! thank you very much for adding Flipt to the playground!
I'm having trouble finding Flipt in the list of providers in the playground to switch between, am I doing something wrong?
CleanShot 2024-05-18 at 08 57 48
Note: I can access the Flipt UI and see that the flags / sqlite data has been imported correctly
CleanShot 2024-05-18 at 08 59 07

Hey @markphelps, I guess you will need to comment out the image in the docker-compose.yaml for the demo and the fib service:

services:
  demo:
    image: ghcr.io/open-feature/playground-app:v0.15.2 # x-release-please-version
    # build:
    #  dockerfile: ./packages/app/Dockerfile
    #  context: .

to

services:
  demo:
    # image: ghcr.io/open-feature/playground-app:v0.15.2 # x-release-please-version
    build:
    dockerfile: ./packages/app/Dockerfile
    context: .

Does it work now? :)

silly me, yes works great now thank you!

one idea instead of requiring users to copy over the sqlite db before running docker-compose up would be that we could take advantage of our import functionality: https://docs.flipt.io/operations/import-export#import to import the flag state from yaml.

we do this in our examples via an init service in docker-compose, ex: https://github.com/flipt-io/flipt/blob/main/examples/openfeature/docker-compose.yml#L11-L20

it might be a bit more portable this way, but im happy either way 😄

Oh I have completely overseen the import function.
I switched to using it, basically exactly as you did in the linked code.
This is great and is even better for starters, thanks!
What do you think @markphelps?

Copy link

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double approve

@beeme1mr
Copy link
Member

I'm not able to get it working locally. Flipt errors getting the db driver for dqlite. Here's what I'm seeing the logs.

playground-flipt-1            |     _________       __ 
playground-flipt-1            |    / ____/ (_)___  / /_
playground-flipt-1            |   / /_  / / / __ \/ __/
playground-flipt-1            |  / __/ / / / /_/ / /_  
playground-flipt-1            | /_/   /_/_/ .___/\__/  
playground-flipt-1            |          /_/           
playground-flipt-1            | 
playground-flipt-1            | Version: v1.42.0
playground-flipt-1            | Commit: 5ac6a4f16e8ac9d0eb931486b06fbddc62857d0d
playground-flipt-1            | Build Date: 2024-05-15T13:58:18Z
playground-flipt-1            | Go Version: go1.22.2
playground-flipt-1            | OS/Arch: linux/amd64
playground-flipt-1            | 
playground-flipt-1            | A newer version of Flipt exists at https://github.com/flipt-io/flipt/releases/tag/v1.42.1, 
playground-flipt-1            | please consider updating to the latest version.
playground-flipt-1            | Error: getting db driver for: sqlite3: unable to open database file: no such file or directory
playground-flipt-1 exited with code 1

The init script is also trying to mount flipt.yml but that doesn't exist at the root of the project.

Copy link

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple things related to @beeme1mr 's comments

.gitignore Show resolved Hide resolved
docker-compose.yaml Outdated Show resolved Hide resolved
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
@lukas-reining
Copy link
Member Author

Yes, these were wrong, I completely oversaw those after changing to the import feature @markphelps.
Can you try again @beeme1mr?

@beeme1mr
Copy link
Member

It runs now but the UI wasn't bootstrapped with the flags.

image

I'm looking into it now.

@beeme1mr
Copy link
Member

The error message is:

playground-init_flipt-1       | 2024-05-21T19:09:25Z    DEBUG   configuration source    {"path": "/etc/flipt/config/default.yml"}
playground-init_flipt-1       | Error: getting db driver for: sqlite3: unable to open database file: no such file or directory

It looks like we're missing default.yml in the config folder.

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
@beeme1mr
Copy link
Member

It's working for me now. Please try my changes to make sure it works for others.

@lukas-reining
Copy link
Member Author

Works for me too @beeme1mr! :)

@lukas-reining lukas-reining merged commit ab99a8e into main May 22, 2024
3 checks passed
lukas-reining pushed a commit that referenced this pull request May 22, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.16.0](v0.15.2...v0.16.0)
(2024-05-22)


### 🐛 Bug Fixes

* **deps:** update dependency flagsmith-nodejs to v3.3.0
([d4a4468](d4a4468))


### ✨ New Features

* add Flipt to playground
([#293](#293))
([ab99a8e](ab99a8e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants