Skip to content

Frontend development: redirect instead of proxy #19177

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

Merged
merged 3 commits into from
Dec 5, 2023
Merged

Conversation

geropl
Copy link
Member

@geropl geropl commented Dec 1, 2023

Description

This allows you to overlay the Dashboard with any other version, as long as you can reach the source from your browser.

Steps

Just like before, do:

Get a workspace with your modified version of dashboard

  1. start a workspace on this branch
  2. start dashboard with yarn start-local

On the Gitpod installation you want to change the dashboard on

In this preview:

  1. login to the preview
  2. become admin by: leeway run components:make-user-admin (or as me to do it for you)
    a. go to /admin/users and grant yourself the "developer" role
  3. run gp url 3000, and use that value to stick it into the "header editor" of your choice, so it matches this preview
  4. Visit this preview

You should now be able to change the dashboard on the fly, incl. hot-reload. 🎉

Thank you @selfcontained for the idea and help with webpack!

Summary generated by Copilot

🤖[deprecated] Generated by Copilot at 9317b88

Refactored the proxy plugin for frontend development with hot reloading and live reloading. Renamed the package and module from workspacedownload to frontend_dev and added unit tests for the index.html rewriting logic. Modified the files frontend_dev.go, frontend_dev_test.go, and go.mod.

Related Issue(s)

Fixes #

How to test

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft preemptible
    Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

This removes the "proxy needs network access to upstream" constraint, by relying on the developers browser
@geropl geropl force-pushed the gpl/frontend-dev-direct branch from 9a8ba4d to c74bcb3 Compare December 4, 2023 11:07
@roboquat roboquat added size/XS and removed size/XL labels Dec 4, 2023
@geropl geropl changed the title [wip] Frontend development: redirect instead of proxy Frontend development: redirect instead of proxy Dec 4, 2023
@geropl geropl marked this pull request as ready for review December 4, 2023 11:13
@mustard-mh
Copy link
Contributor

start dashboard with yarn start-local, and make sure to expose port 3000 as "public" 🔓

We could make it open with another port and mark this port as public in .gitpod.yml

@mustard-mh
Copy link
Contributor

become admin by: leeway run components:make-user-admin (or as me to do it for you)
a. go to /admin/users and grant yourself the "developer" role

And make developer role granting as a leeway script

@geropl geropl requested a review from a team as a code owner December 5, 2023 08:05
@roboquat roboquat added size/XL and removed size/XS labels Dec 5, 2023
@geropl
Copy link
Member Author

geropl commented Dec 5, 2023

@mustard-mh @selfcontained Now also with the relevant commit... 😑

Copy link
Contributor

@mustard-mh mustard-mh left a comment

Choose a reason for hiding this comment

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

Works like a charm!!

[nit not blocking] will it be better if we put document inside README.md?

@geropl
Copy link
Member Author

geropl commented Dec 5, 2023

/unhold

@roboquat roboquat merged commit f78eff2 into main Dec 5, 2023
@roboquat roboquat deleted the gpl/frontend-dev-direct branch December 5, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants