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

Open
wants to merge 67 commits into
base: main
Choose a base branch
from

Conversation

mike-zorn
Copy link

@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
    • I'm not sure what is meant by this.

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
hoshsadiq and others added 18 commits June 27, 2024 09:55
* Move devserver db to XDG_STATE_HOME

* Move devserver db to XDG_STATE_HOME

* Use XDG lib instead
* Use go generate instead of make

* Add ui asset handler
* adding sync project api

* adding expand to post

* updating cli command to match actual api

* minor refactor
* add dev stream uri to config file

* actually use the value

* change variable name
* feat: add frontend build

* tweak fs so that the paths work out

---------

Co-authored-by: Mike Zorn <[email protected]>
* adding context to post and patch

* refactoring out the expand params
bug: fix override
add new dev-server ui cmd
This adds support for mobile and PHP SDKs. It also relocates the list of the
supported endpoints to the package docs instead of a random comment.
Improves error handling when an sdk connects and a project is missing.

Previous behavior was a scary panic log. Now there's a more helpful

```
2024/06/28 16:26:02 project, default2, not found
2024/06/28 16:26:02 You may need to call ldcli dev-server add-project
```
This adds some integration tests for go server SDK & Dev server.
* check if flag exists before adding override

* fix error handling

* fix imports
This ended up being needed because a dependency used a standard library
package which became available in 1.22.
@mike-zorn mike-zorn marked this pull request as ready for review July 3, 2024 22:03
mike-zorn and others added 11 commits July 8, 2024 08:16
* Remove WIP comments with API ideas

No longer relevant

* add failing unit test for deregister issue

* use sync map
* add store mock and bundle mocks together in same directory

* override.go tests

* new test file and put observer_test in test package

* more tests

* Final project tests

* fix nit and tests, add more coverage

* PR suggestions
Documents the build process for the dev server. Also fixes a go generate command and removes an extraneous comment.
* chore: Replace login client with resources client (#366)

Replace login client with resources client

* Ensure extra trailing slash doesn't break requests

* use new unauthenticated request method on resources client

* fix imports

---------

Co-authored-by: Danny Olson <[email protected]>
#373)

* add params object to allow easier extensibility of function args

* don't allow full customization of the IP, just port (duh)

* Add cmd param

* reorderin'

Co-authored-by: Mike Zorn <[email protected]>

---------

Co-authored-by: Mike Zorn <[email protected]>
* Add event, emit event, rename a field

* server side update

* client side event

* Code consolidation and cleanup

* little more cleanup

* half an attempt at an integration test

* correct log text

* add overrides

* add expected times (causes timeout)

* make test go

* Make comment more accurate

Co-authored-by: Mike Zorn <[email protected]>

* chans are pointer types already

* modify test

---------

Co-authored-by: Mike Zorn <[email protected]>
* JSON flags now use modal, catch formatting errors

* fixed 'only show flags with overrides' bug

* refactoring

* refactoring

* json update modal now dismissed when new override value accepted

* minor tweak

* remove unnecessarily generated /bin, /.vscode, and undo version change to package-lock

* Use close render prop from Dialog

---------

Co-authored-by: Abram Thau <[email protected]>
Co-authored-by: Keegan Watkins <[email protected]>
Allow customized contexts when creating a project
* rename function to be more accurate

* first couple tests

* more tests

* add remaining tests

* rename function to be more accurate
…nt (#380)

Return 400 if sourceEnvironmentKey is not present in Post endpoint
fix: Fixup startup logging
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.

None yet

7 participants