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 dev server (AKA LaunchDevly) #364

Merged
merged 82 commits into from
Aug 14, 2024
Merged

Conversation

mike-zorn
Copy link
Contributor

@mike-zorn mike-zorn commented Jul 3, 2024

Requirements

  • I have added test coverage for new or changed functionality
    • We're not at 100% coverage, but there are unit tests of the business logic of the dev server and integration tests for the server-side SDK routes.
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

N/A

Describe the solution you've provided

This adds a new command to the cli, dev-server. When you start it, an HTTP server starts running on port 8765. It provides APIs that mimic the APIs that LaunchDarkly SDKs use. You can add-projects to the dev server and they will be populated with flag values from the source-environment. You can also add-overrides to change the value served by a given flag. There's also a UI that will display which flag values are being served and allow you to set overrides.

These features combine to provide a more portable solution for local & ephemeral development environments of projects using LaunchDarkly than the current state of the art: creating real environments in LaunchDarkly for each of these environments.

Describe alternatives you've considered

N/A

Additional context

Internal to LaunchDarkly Epic that details some loose ends on the dev server that are in progress.

mike-zorn and others added 30 commits June 24, 2024 09:30
incase we also proxy apis with this thing
Need to fix up some linter rules for tools & code gen
delete project
* unmarshal flagstate

* use our own type for state

* add logging and panic handling

* hello js works
* add delete dev project

* fix projects postBody

* add overrides table

* add override

* remove override

* remove delete proj stuff

* fix imports

* pr feedback

* add todo
adding groups to the commands
* unmarshal flagstate

* use our own type for state

* add note about cors

* streaming
…nt (#380)

Return 400 if sourceEnvironmentKey is not present in Post endpoint
fix: Fixup startup logging
@cgreenld
Copy link

cgreenld commented Jul 30, 2024

@mike-zorn I have a couple customers interested in something like this - any idea on timeline to get this merged?

Copy link
Contributor

@dbolson dbolson left a comment

Choose a reason for hiding this comment

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

Is there any reason not to merge this in?

@mike-zorn
Copy link
Contributor Author

Before merging, I do need to change how we're linking c dependencies. We're doing static linking of glib which is not recommended. 🤞🏻 I can make that improvement today.

There were also some concerns re: bloating the CLI that we should discuss internally.

Return a 409 when a project already exists in the dev server (vs. 500).
@cwaldren-ld
Copy link
Contributor

As a side note, it might be nice to stop vendoring deps so we don't have 743 changes here (unless someone is going to audit all of the deps.)

@cwaldren-ld
Copy link
Contributor

cwaldren-ld commented Aug 12, 2024

Before merging, I do need to change how we're linking c dependencies. We're doing static linking of glib which is not recommended. 🤞🏻 I can make that improvement today.

There were also some concerns re: bloating the CLI that we should discuss internally.

Let's be sure to test on Linux because this happened previously when CGO was enabled

cmd/cliflags/flags.go Outdated Show resolved Hide resolved
cmd/config/testdata/help.golden Outdated Show resolved Hide resolved
cmd/dev_server/projects.go Outdated Show resolved Hide resolved
cmd/dev_server/start_server.go Outdated Show resolved Hide resolved
cmd/dev_server/start_server.go Outdated Show resolved Hide resolved
internal/dev_server/adapters/sdk.go Show resolved Hide resolved
internal/dev_server/ui/.gitignore Outdated Show resolved Hide resolved
internal/dev_server/ui/index.html Outdated Show resolved Hide resolved
internal/dev_server/ui/src/IconProvider.tsx Outdated Show resolved Hide resolved
internal/dev_server/ui/vite.config.ts Show resolved Hide resolved
.goreleaser.yaml Outdated
- amd64
- arm64
ldflags:
- -s
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get comments on what each flag is doing?

env:
- CGO_ENABLED=0
- TOOLCHAIN_BASE=
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment explaining what this is trying to achieve (and why we need to do it manually) would be great 👍

.goreleaser.yaml Outdated
env:
- GO111MODULE=on
- CGO_ENABLED=1
- DOCKER_CLI_EXPERIMENTAL=enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment explaining why each of these is needed would be great

env:
GITHUB_TOKEN: ${{ inputs.token }}
HOMEBREW_DEPLOY_KEY: ${{ inputs.homebrew-gh-secret }}
- name: Upload assets
Copy link
Contributor

Choose a reason for hiding this comment

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

Has it been verified that the uploaded results exactly match (or are expected) compared to previous releases, since the goreleaser-action is no longer being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're still using the goreleaser action. We're just also uploading the artifacts that were generated alongside the action run, so that it's easier to test dry runs.

shell: bash
run: |
echo $DOCKER_TOKEN | docker login --username $DOCKER_USERNAME --password-stdin
CONTAINER_ID="$(
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment explaining why the normal goreleaser-action can't be used would be great

@mike-zorn mike-zorn merged commit 373bb0a into main Aug 14, 2024
6 checks passed
@mike-zorn mike-zorn deleted the moonshot-ld-dev-server branch August 14, 2024 22:50
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.

10 participants