Skip to content

feat: Add dev server (AKA LaunchDevly)#364

Merged
mike-zorn merged 82 commits into
mainfrom
moonshot-ld-dev-server
Aug 14, 2024
Merged

feat: Add dev server (AKA LaunchDevly)#364
mike-zorn merged 82 commits into
mainfrom
moonshot-ld-dev-server

Conversation

@mike-zorn
Copy link
Copy Markdown

@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
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread cmd/cliflags/flags.go Outdated
Comment thread cmd/config/testdata/help.golden Outdated
Comment thread cmd/dev_server/projects.go Outdated
Comment thread cmd/dev_server/start_server.go Outdated
Comment thread cmd/dev_server/start_server.go Outdated
Comment thread internal/dev_server/adapters/sdk.go
Comment thread internal/dev_server/sdk/stream_server_flags.go
Comment thread internal/dev_server/ui/.gitignore Outdated
Comment thread internal/dev_server/ui/index.html Outdated
Comment thread internal/dev_server/ui/src/IconProvider.tsx Outdated
Comment thread internal/dev_server/ui/vite.config.ts
Comment thread .goreleaser.yaml Outdated
- amd64
- arm64
ldflags:
- -s
Copy link
Copy Markdown
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?

Comment thread .goreleaser.yaml
goarch: "386"
env:
- CGO_ENABLED=0
- TOOLCHAIN_BASE=
Copy link
Copy Markdown
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 👍

Comment thread .goreleaser.yaml Outdated
env:
- GO111MODULE=on
- CGO_ENABLED=1
- DOCKER_CLI_EXPERIMENTAL=enabled
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

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