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

make more convinient for developing in the remote machine #1132

Merged
merged 3 commits into from
Feb 7, 2022

Conversation

baurine
Copy link
Collaborator

@baurine baurine commented Jan 10, 2022

When a user develops TiDB dashboard in a remote machine and accesses the frontend page in the local, he will get the following error by accessing http://{remote_addr}:3001/dashboard in the local browser:

image

Because the frontend can't access the backend API by http://127.0.0.0:12333/dashboard/api.

Solutions:

  1. Forward local port 12333 to the remote, for example: ssh -L 12333:locahost:12333 remote_addr.

  2. Run TiDB dashboard backend by bin/tidb-dashboard --host 0.0.0.0 and set REACT_APP_DASHBOARD_API_URL=http://{remote_addr}:12333 in the .env file

  3. Run TiDB dashboard backend by bin/tidb-dashboard --host 0.0.0.0 and use http://${window.location.hostname}:12333/dashboard instead of http://127.0.0.01:12333/dashboard as API addr prefix.

This PR implements solution 3, and I think this would bring a little more convenience for the developers to develop in a remote machine.

- this can bring a little more convenience when developing in a remote
machine
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jan 10, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • breeswish

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@baurine baurine changed the title misc: use window.location.hostname replace 127.0.0.1 for backend api addr make more convinient for developing in the remote machine Jan 10, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2022

Codecov Report

Merging #1132 (f9d9a72) into master (4a262b3) will decrease coverage by 1.18%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1132      +/-   ##
==========================================
- Coverage   29.42%   28.24%   -1.19%     
==========================================
  Files         210      227      +17     
  Lines       11877    12841     +964     
  Branches      647      647              
==========================================
+ Hits         3495     3627     +132     
- Misses       8243     9064     +821     
- Partials      139      150      +11     
Flag Coverage Δ
be_integration_test_latest 6.88% <ø> (?)
be_integration_test_v4.0.1 6.88% <ø> (?)
be_unit_test 24.00% <ø> (ø)
e2e_test 46.88% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
ui/lib/client/baseUrl.ts 63.63% <0.00%> (ø)
pkg/utils/topology/topology.go 0.00% <0.00%> (ø)
pkg/utils/version/version.go 0.00% <0.00%> (ø)
pkg/config/dynamic_config_manager.go 0.00% <0.00%> (ø)
pkg/utils/topology/pd.go 0.00% <0.00%> (ø)
pkg/utils/topology/store.go 0.00% <0.00%> (ø)
pkg/utils/fx.go 0.00% <0.00%> (ø)
pkg/utils/topology/monitor.go 0.00% <0.00%> (ø)
pkg/apiserver/slowquery/service.go 0.00% <0.00%> (ø)
pkg/config/dynamic_config.go 0.00% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a262b3...f9d9a72. Read the comment docs.

@breezewish
Copy link
Member

Nice trick!

@breezewish breezewish merged commit 7c0696f into pingcap:master Feb 7, 2022
@baurine baurine deleted the avoid-port-forward branch February 7, 2022 10:15
shhdgit pushed a commit to shhdgit/tidb-dashboard that referenced this pull request Mar 16, 2022
shhdgit pushed a commit to shhdgit/tidb-dashboard that referenced this pull request Mar 16, 2022
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.

4 participants