-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Migrate API Server #6426
Migrate API Server #6426
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6426 +/- ##
==========================================
+ Coverage 54.80% 55.79% +0.99%
==========================================
Files 378 465 +87
Lines 22391 27800 +5409
==========================================
+ Hits 12272 15512 +3240
- Misses 9194 11183 +1989
- Partials 925 1105 +180 |
I have the basis of this feature working. We're going to need to rethink the design and use of |
…s-sdk into bez/6408-integrate-rest-svc
…s-sdk into bez/6408-integrate-rest-svc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long overdue. Huge improvement would like to test but afk today
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK, code looks good. Will test on Monday
@@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ | |||
|
|||
### Client Breaking | |||
|
|||
* (api) [\#6426](https://github.com/cosmos/cosmos-sdk/pull/6426) The ability to start an out-of-process API REST server has now been removed. Instead, the API server is now started in-process along with the application and Tendermint. Configuration options have been added to `app.toml` to enable/disable the API server along with additional HTTP server options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* (api) [\#6426](https://github.com/cosmos/cosmos-sdk/pull/6426) The ability to start an out-of-process API REST server has now been removed. Instead, the API server is now started in-process along with the application and Tendermint. Configuration options have been added to `app.toml` to enable/disable the API server along with additional HTTP server options. | |
* (api) [\#6426](https://github.com/cosmos/cosmos-sdk/pull/6426) The ability to start an out-of-process API REST server has now been removed. Instead, the API server is now started in-process along with the application and Tendermint. Configuration options, i.e legacy flags, have been migrated to `app.toml` to enable/disable the API server along with additional HTTP server options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legacy flags? What legacy flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is brilliant, left suggestions for a couple of cosmetic changes.
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
I'll leave this PR open for another day or so to allow people to test, until I merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested ACK
It'd be nice if we could add the docs from Gaia and update them for the SDK. Maybe a follow-up issue/PR |
// APIConfig defines the API listener configuration. | ||
type APIConfig struct { | ||
// Enable defines if the API server should be enabled. | ||
Enable bool `mapstructure:"enable"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexanderbez just saw this is not used, is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYM not used? It is used and is false
by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, maybe I am wrong but inside here
cosmos-sdk/server/api/server.go
Line 48 in 8ee7d1f
func (s *Server) Start(cfg config.Config) error { |
I dont see any if Config.API.Enabled and I am going crazy with it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/cosmos/cosmos-sdk/blob/master/server/start.go#L195
We should probably create the config before that and use that instead. Mind creating a small PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave it in my hands!
Description
This PR revises the model in which a API (REST) server is started. The server is now started in process along with the application binary & Tendermint -- everything is in a single process. This drastically reduces various complexities and simplifies the mental model.
Operators may now enable/disable the API server along with various other options. In the future, they'll be able to provide Caddy/TLS/Proxy configurations as well.
One thing left to consider is if how to handle proof verifications (i.e. trust-node) -- I left a TODO for this.
From an app developer's POV, not much changes. They still provide module route registration, except instead of passing it to a command, they now pass it along with their app constructor to the start command.
To test:
make build-docker-local-simapp
(only needed to be invoked once to build the image)make clean localnet-start
BUILDDIR=./build/macos make build-sim
make localnet-stop
closes: #6408
/cc @jackzampolin @marbar3778
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorer