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

chore: In gnodev, add option web-help-remote, use it in gnoweb #2135

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jefft0
Copy link
Contributor

@jefft0 jefft0 commented May 17, 2024

gnodev starts gnoweb which can show a help page with the gnokey command for each function. The help for the gnokey command includes -remote which is the same as the gnodev listening address. But the gnokey command is meant to be used from a different computer, and the address which gnodev listens on can be different than the address to connect from outside. (In our use case, gnodev runs in a docker container behind a reverse proxy.)

The gnoweb command already has an option -help-remote which is used on the help page. When gnodev starts gnoweb, it gives its own listening address. This PR adds a gnodev command line option -web-help-remote . If supplied, this overrides and is used when starting gnoweb.

…rver

Signed-off-by: Jeff Thompson <jeff@thefirst.org>
Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 49.01%. Comparing base (c6cde63) to head (f3693bc).

Files Patch % Lines
contribs/gnodev/cmd/gnodev/main.go 0.00% 6 Missing ⚠️
contribs/gnodev/cmd/gnodev/setup_web.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2135      +/-   ##
==========================================
- Coverage   49.14%   49.01%   -0.14%     
==========================================
  Files         576      576              
  Lines       77616    77463     -153     
==========================================
- Hits        38148    37971     -177     
- Misses      36377    36411      +34     
+ Partials     3091     3081      -10     
Flag Coverage Δ
contribs/gnodev 24.01% <0.00%> (-0.18%) ⬇️
contribs/gnofaucet 14.46% <ø> (ø)
contribs/gnokeykc 0.00% <ø> (ø)
contribs/gnomd 0.00% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gfanton
Copy link
Member

gfanton commented May 22, 2024

Thinking more about this, I'm not really sure about adding this. I don't want to have to duplicate every flag of gnoweb into gnodev. What do you think about simply running a separate instance of gnoweb on the side targeting your gnodev instance?

@jefft0
Copy link
Contributor Author

jefft0 commented May 22, 2024

@gfanton, I don't see an option in gnodev to not start gnoweb. What should we do if we run gnoweb separately?

@gfanton
Copy link
Member

gfanton commented May 23, 2024

don't see an option in gnodev to not start gnoweb.

I think will should probably add an option to disable gnoweb in gnodev

What should we do if we run gnoweb separately?

If you run gnoweb separately, you can use the -help-remote, -remote, and -bind flags to correctly achieve what you want. Assuming you're running gnodev within a Docker container or behind a reverse proxy, it should be easy to not expose gnoweb on gnodev (even if it's actually running) and run it on another instance.

@jefft0
Copy link
Contributor Author

jefft0 commented May 23, 2024

Thanks. Sounds good. Do you want me to change this PR to "Add an option to disable gnoweb in gnodev" ?
What should the gnodev option be? There is already an option -web-listener . Should we allow -web-listener none ?

@D4ryl00
Copy link
Contributor

D4ryl00 commented May 24, 2024

If I can argue, I think gnodev should handle every service for us, like a hub. So it would stay simple for us to deploy the services through gnodev.
I don't see what would be the problem to recreate each option in gnodev for each services. So for us (devs), we would have a central configuration for all services. It would be great. If you categorize the options list in gnodev --help, it would be easy to find them. No matter if there are 100 options. The more there are, the more gnodev would be useful.

It's my opinion.

@moul
Copy link
Member

moul commented May 24, 2024

Gnodev should be the go-to tool for developers to work locally and showcase their projects. Running multiple manual containers should be considered advanced, while using gnodev in Docker can be a standard method to isolate multiple services on a server. Therefore, I recommend enabling gnodev to configure gnoweb accordingly.

People developing or running standalone Gnoweb should be experienced individuals or actual Gnoweb developers, in my opinion.

maxGas int64
chainId string
serverMode bool
webHelpRemote string
Copy link
Member

Choose a reason for hiding this comment

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

Embed gnoweb.Config instead of using individual gnoweb flags.

Copy link
Member

Choose a reason for hiding this comment

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

gnodev.Config should include specific flags and embed configurations like gnoweb.Config, gnoland.Config, etc.

Comment on lines 13 to +19
webConfig := gnoweb.NewDefaultConfig()
webConfig.RemoteAddr = dnode.GetRemoteAddress()
webConfig.HelpRemote = dnode.GetRemoteAddress()
if cfg.webHelpRemote != "" {
webConfig.HelpRemote = cfg.webHelpRemote
} else {
webConfig.HelpRemote = dnode.GetRemoteAddress()
}
Copy link
Member

Choose a reason for hiding this comment

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

Initialize webConfig on the main struct and manage all flag updates using flags. In essence, inherit and share flag logic from subcomponents like gnoweb, gnoland, etc.

@@ -121,3 +121,4 @@ While `gnodev` is running, the following shortcuts are available:
| --server-mode | disable interaction, and adjust logging for server use. |
| --verbose | enable verbose output for development |
| --web-listener | web server listening address |
| --web-help-remote | web server help page's remote addr |
Copy link
Member

Choose a reason for hiding this comment

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

Eventually, we can use --web- or --gnoweb- as prefixes for Gnoweb, and --node- or --gnoland- for the node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

4 participants