-
Notifications
You must be signed in to change notification settings - Fork 7
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
Versioning documentation #61
Changes from all commits
3a25890
d27da5e
fce84f1
eb7939d
94437bf
94bbcd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 5 | ||
sidebar_position: 6 | ||
--- | ||
|
||
# Throubleshooting | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Versioning | ||
|
||
Restate comes with different solutions to update the services, to simplify development and evolution of your codebase without sacrificing Restate's strong guarantees. | ||
|
||
## Deploy a new service revision | ||
|
||
As described in the [deployment documentation](./deployment.md#deploying-services), *service endpoints* are immutable, and are assumed to be reacheable throughout the entire lifecycle of an invocation. In order to deploy any change to a service, either in the protobuf definition and/or in the business logic, a new service endpoint should be deployed and registered. | ||
|
||
When registering a new service endpoint, Restate will detect if it contains already registered services, and will treat them as new revisions. Any new invocations to that service will be executed by the newly registered service endpoint, thus guaranteeing that new invocations are always routed to the latest service revision, while *old* invocations will continue to use the previous service endpoint. It must be guaranteed that the old service endpoint lives until all the existing invocations complete. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Service name. |
||
|
||
For example, let's assume there is a `greeter.Greeter` service deployed on the service endpoint available at `http://greeter-v1/`. To update it, deploy a new service endpoint available at `http://greeter-v2/`, containing the new revision of `greeter.Greeter`, and then register it: | ||
|
||
```bash | ||
$ curl <RESTATE_META_ENDPOINT>/endpoints --json '{"uri": "http://greeter-v2/"}' | ||
``` | ||
|
||
This returns: | ||
|
||
```json | ||
{ | ||
"id": "Z3JlZXRlci12Mi8", | ||
"services": [ | ||
{ | ||
"name": "greeter.Greeter", | ||
"revision": 2 | ||
} | ||
] | ||
} | ||
``` | ||
|
||
This notifies that Restate detected a new revision of an already existing service, and from now on it will route any invocation of `greeter.Greeter` to `http://greeter-v2/`, while any existing invocation to `greeter.Greeter`, e.g. an invocation sleeping for some time, will continue executing on `http://greeter-v1/` until the end. | ||
|
||
To check which endpoint is currently serving new invocations of `greeter.Greeter`: | ||
|
||
```bash | ||
$ curl <RESTATE_META_ENDPOINT>/services/greeter.Greeter | ||
``` | ||
|
||
This returns: | ||
|
||
```json | ||
{ | ||
"name": "greeter.Greeter", | ||
"revision": 2, | ||
"endpoint_id": "Z3JlZXRlci12Mi8", | ||
[...] | ||
} | ||
``` | ||
|
||
To get more info about the endpoint serving it: | ||
|
||
```bash | ||
$ curl <RESTATE_META_ENDPOINT>/endpoints/Z3JlZXRlci12Mi8 | ||
``` | ||
|
||
```json | ||
{ | ||
"id": "Z3JlZXRlci12Mi8", | ||
"uri": "http://greeter-v2/", | ||
"additional_headers": {}, | ||
"protocol_type": "BidiStream", | ||
"services": [ | ||
{ | ||
"name": "greeter.Greeter", | ||
"revision": 2 | ||
} | ||
] | ||
} | ||
``` | ||
|
||
For more details on the API, refer to the [Meta operational API docs](./meta-rest-api.mdx#tag/service_endpoint/operation/create_service_endpoint). | ||
|
||
## Updating the Protobuf service schema | ||
|
||
Restate adopts the same rules as [Protobuf for schema evolution](https://protobuf.dev/programming-guides/dos-donts/), but adds on top the following constraints: | ||
|
||
* You can't change the instance type of a service. | ||
* You can't modify the key fields in Keyed services. | ||
Comment on lines
+81
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe link to the definition of instance types and keyed services. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that there isn't a page dedicated to that, nor in general to our service contracts, see #60 |
||
|
||
In all the aforementioned cases, you should define a new service instead. | ||
|
||
:::info | ||
Currently Restate doesn't implement all the "schema incompatibility" checks, so you must make sure the applied changes are backward compatible. | ||
::: | ||
|
||
## State compatibility | ||
|
||
When updating Keyed and Singleton services, the new revisions will continue to use the same state created by previous revisions. You must ensure state entries are evolved in a backward compatible way. |
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.
Is
--json
supported by allcurl
version that we want to support?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.
Don't know, see #31. The deployments page was using the
--json
parameter, so I did the same here. I can replace with the old command template, but TBH I think this is better to read.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.
Maybe a solution is specifying that you need a curl version more recent than 7.82.0?
So people for who this fails, understand that they need to upgrade curl?
But I also think that there should be a single unified command across the docs for discovery.
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.
Added a suggestion to specify the curl (>v7.82.0) requirement