This repository has been archived by the owner on Mar 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Flexible responses #47
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
245951a
initial commit for migration to akka serverless
7699deb
initial value entity and view support
2fc1e57
removing google proto
ca107d7
removing akka serverless proto
f070eab
cleanup
a8f5888
adding requirements
16a3cc7
preparing for build
925cb8c
Merge pull request #1 from jpollock/serverless_migration
jpollock d56e3d8
updating to account for akka serverless protocol apis (health and ter…
1dbe51c
addressing some action requirements
ca548f1
getting read for initial release
2ea6742
getting read for initial release
2baab76
cleaning up some release issues
47df2b4
updating proxy protocol version
0a0e842
getting ready for first prod release
4874748
removing health check meaningless logging
62c6cc9
first pass at solving the issue such that state and function response…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Contributors | ||
|
||
## Special thanks for all the people who had helped this project so far: | ||
|
||
* [sleipnir](https://github.com/sleipnir) (Creator) | ||
* [marcellanz](https://github.com/marcellanz) (Creator) | ||
* [chomnoue](https://github.com/chomnoue) (Creator) | ||
* [pvlugter](https://github.com/pvlugter) (Creator) | ||
* [GratefulTony](https://github.com/GratefulTony) (Creator) | ||
* [jpollock](https://github.com/jpollock) (Akka Serverless Migrator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,30 +1,21 @@ | ||||||
Akka Serverless makes development and operation of high-performing stateful services enjoyable: it provides SDKs for building services, and a managed cloud platform for deploying them. The SDKs expose a simple programming model, available in popular programming languages, that eliminates the need for plumbing code to handle database access or connections. The managed platform relieves you from configuring and maintaining the orchestration platform, and the data stores. Akka Serverless auto-scales services, and handles network partitions and failures. It also gives clear visibility into the running system with unified and scalable logging and monitoring. | ||||||
|
||||||
Cloudstate is a specification, protocol, and reference implementation for providing distributed state management patterns suitable for **Serverless** computing. | ||||||
The current supported and envisioned patterns include: | ||||||
Read more [here](https://developer.lightbend.com/docs/akka-serverless/index.html) and sign-up [here](https://console.akkaserverless.com/p/register#) for a free account. | ||||||
|
||||||
* **Event Sourcing** | ||||||
* **Conflict-Free Replicated Data Types (CRDTs)** | ||||||
* **Key-Value storage** | ||||||
* **P2P messaging** | ||||||
* **CQRS read side projections** | ||||||
The Akka Serverless Python user language support is a library that implements the Akka Serverless protocol and offers an pythonistic API | ||||||
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.
Suggested change
User Language Support Library is old Cloudstate speak I think. 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. Yes, Akka Serverless is using |
||||||
for writing components that implement the types supported by the Akka Serverless protocol. It is a [Tier 3 SDK](https://developer.lightbend.com/docs/akka-serverless/reference/service-api-reference.html). | ||||||
|
||||||
Cloudstate is polyglot, which means that services can be written in any language that supports gRPC, | ||||||
and with language specific libraries provided that allow idiomatic use of the patterns in each language. | ||||||
Cloudstate can be used either by itself, in combination with a Service Mesh, | ||||||
or it is envisioned that it will be integrated with other Serverless technologies such as [Knative](https://knative.dev/). | ||||||
|
||||||
Read more about the design, architecture, techniques, and technologies behind Cloudstate in [this section in the documentation](https://github.com/cloudstateio/cloudstate/blob/master/README.md#enter-cloudstate). | ||||||
|
||||||
The Cloudstate Python user language support is a library that implements the Cloudstate protocol and offers an pythonistic API | ||||||
for writing entities that implement the types supported by the Cloudstate protocol. | ||||||
|
||||||
The Cloudstate documentation can be found [here](https://cloudstate.io/docs/) | ||||||
The Akka Serverless documentation can be found [here](https://developer.lightbend.com/docs/akka-serverless/index.html) | ||||||
|
||||||
## Install and update using pip: | ||||||
|
||||||
``` | ||||||
pip install -U cloudstate | ||||||
pip install -U akkaserverless | ||||||
``` | ||||||
## Use Starter App | ||||||
|
||||||
Visit https://github.com/jpollock/akka-serverless-starter-python to use that repository as a template. Simply click "Use this template". (Explanation for the process, general to Github, is [here](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/creating-a-repository-from-a-template)). | ||||||
|
||||||
|
||||||
## A Simple EventSourced Example: | ||||||
|
||||||
|
@@ -35,26 +26,26 @@ pip install -U cloudstate | |||||
syntax = "proto3"; | ||||||
|
||||||
import "google/protobuf/empty.proto"; | ||||||
import "cloudstate/entity_key.proto"; | ||||||
import "akkaserverless/annotations.proto"; | ||||||
import "google/api/annotations.proto"; | ||||||
import "google/api/http.proto"; | ||||||
|
||||||
package com.example.shoppingcart; | ||||||
|
||||||
message AddLineItem { | ||||||
string user_id = 1 [(.cloudstate.entity_key) = true]; | ||||||
string user_id = 1 [(akkaserverless.field).entity_key = true]; | ||||||
string product_id = 2; | ||||||
string name = 3; | ||||||
int32 quantity = 4; | ||||||
} | ||||||
|
||||||
message RemoveLineItem { | ||||||
string user_id = 1 [(.cloudstate.entity_key) = true]; | ||||||
string user_id = 1 [(akkaserverless.field).entity_key = true]; | ||||||
string product_id = 2; | ||||||
} | ||||||
|
||||||
message GetShoppingCart { | ||||||
string user_id = 1 [(.cloudstate.entity_key) = true]; | ||||||
string user_id = 1 [(akkaserverless.field).entity_key = true]; | ||||||
} | ||||||
|
||||||
message LineItem { | ||||||
|
@@ -102,16 +93,16 @@ Here is an example of how to compile the sample proto file: | |||||
python -m grpc_tools.protoc -I../../protos --python_out=. --grpc_python_out=. ../../protos/shoppingcart.proto | ||||||
``` | ||||||
|
||||||
### 3. Implement your business logic under an EventSourced Cloudstate Entity | ||||||
### 3. Implement your business logic under an EventSourced Akka Serverless Entity | ||||||
|
||||||
``` | ||||||
from dataclasses import dataclass, field | ||||||
from typing import MutableMapping | ||||||
|
||||||
from google.protobuf.empty_pb2 import Empty | ||||||
|
||||||
from cloudstate.event_sourced_context import EventSourcedCommandContext | ||||||
from cloudstate.event_sourced_entity import EventSourcedEntity | ||||||
from akkaserverless.event_sourced_context import EventSourcedCommandContext | ||||||
from akkaserverless.event_sourced_entity import EventSourcedEntity | ||||||
from shoppingcart.domain_pb2 import (Cart as DomainCart, LineItem as DomainLineItem, ItemAdded, ItemRemoved) | ||||||
from shoppingcart.shoppingcart_pb2 import (Cart, LineItem, AddLineItem, RemoveLineItem) | ||||||
from shoppingcart.shoppingcart_pb2 import (_SHOPPINGCART, DESCRIPTOR as FILE_DESCRIPTOR) | ||||||
|
@@ -127,7 +118,7 @@ def init(entity_id: str) -> ShoppingCartState: | |||||
return ShoppingCartState(entity_id) | ||||||
|
||||||
|
||||||
entity = EventSourcedEntity(_SHOPPINGCART, [FILE_DESCRIPTOR], init) | ||||||
entity = EventSourcedEntity(_SHOPPINGCART, [FILE_DESCRIPTOR], 'carts', init) | ||||||
|
||||||
|
||||||
def to_domain_line_item(item): | ||||||
|
@@ -207,29 +198,30 @@ def remove_item(state: ShoppingCartState, item: RemoveLineItem, ctx: EventSource | |||||
### 4. Register Entity | ||||||
|
||||||
``` | ||||||
from cloudstate.cloudstate import CloudState | ||||||
from akkaserverless.akkaserverless_service import AkkaServerlessService | ||||||
from shoppingcart.shopping_cart_entity import entity as shopping_cart_entity | ||||||
import logging | ||||||
|
||||||
if __name__ == '__main__': | ||||||
logging.basicConfig() | ||||||
CloudState().register_event_sourced_entity(shopping_cart_entity).start() | ||||||
service = AkkaServerlessService() | ||||||
service.add_component(shopping_cart_entity) | ||||||
service.start() | ||||||
|
||||||
``` | ||||||
|
||||||
### 5. Deployment | ||||||
|
||||||
Cloudstate runs on Docker and Kubernetes you need to package your application so that it works as a Docker container | ||||||
and can deploy it together with Cloudstate Operator on Kubernetes, the details and examples of all of which can be found [here](https://code.visualstudio.com/docs/containers/quickstart-python), [here](https://github.com/cloudstateio/python-support/blob/master/shoppingcart/Dockerfile) and [here](https://cloudstate.io/docs/core/current/user/deployment/index.html). | ||||||
See [here](https://developer.lightbend.com/docs/akka-serverless/deploying/index.html) for deployment information. | ||||||
|
||||||
## Contributing | ||||||
|
||||||
For guidance on setting up a development environment and how to make a contribution to Cloudstate, | ||||||
see the contributing [project page](https://github.com/cloudstateio/python-support) or consult an official documentation [here](https://cloudstate.io/docs/). | ||||||
TODO | ||||||
|
||||||
## Links | ||||||
|
||||||
* [Website](https://cloudstate.io/) | ||||||
* [Documentation](https://cloudstate.io/docs/) | ||||||
* [Releases](https://pypi.org/project/cloudstate/) | ||||||
* [Code](https://github.com/cloudstateio/python-support) | ||||||
* [Issue tracker](https://github.com/cloudstateio/python-support/issues) | ||||||
* [Website](https://https://www.lightbend.com/akka-serverless/) | ||||||
* [Documentation](https://developer.lightbend.com/docs/akka-serverless/) | ||||||
* [Releases](https://pypi.org/project/akkaserverless/) | ||||||
* [Code](https://github.com/jpollock/akkaserverless-python-sdk) | ||||||
* [Issue tracker](https://github.com/jpollock/akkaserverless-python-sdk/issues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,13 +1,19 @@ | ||||||||||
# Python User Language Support | ||||||||||
Python User Language Support for [Cloudstate](https://github.com/cloudstateio/cloudstate). | ||||||||||
# Akka Serverless Python SDK | ||||||||||
|
||||||||||
Source code for the Akka Serverless Python package. | ||||||||||
|
||||||||||
For more information see the documentation for [implementing Akka Serverless services in JavaScript](https://developer.lightbend.com/docs/akka-serverless/javascript/). | ||||||||||
|
||||||||||
|
||||||||||
This package is a fork of the original [Python SDK](https://github.com/cloudstateio/python-support) for [Cloudstate](https://cloudstate.io/). This Akka Serverless package is heavily indebted to the [C]loudstate contributors](https://github.com/cloudstateio/python-support/graphs/contributors), especially [Adriano Santos](https://github.com/sleipnir) and [Marcel Lanz](https://github.com/marcellanz). | ||||||||||
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.
Suggested change
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.
Suggested change
|
||||||||||
|
||||||||||
## Installation via source | ||||||||||
|
||||||||||
``` | ||||||||||
> git clone https://github.com/cloudstateio/python-support.git | ||||||||||
Cloning into 'python-support'... | ||||||||||
> git clone https://github.com/jpollock/akkaserverless-python-sdk.git | ||||||||||
Cloning into 'akkaserverless-python-sdk'... | ||||||||||
|
||||||||||
> cd python-support | ||||||||||
> cd akkaserverless-python-sdk | ||||||||||
> python3 -m venv ./venv | ||||||||||
> source ./venv/bin/activate | ||||||||||
> python --version | ||||||||||
|
@@ -24,10 +30,13 @@ python setup.py bdist_wheel | |||||||||
|
||||||||||
### local install | ||||||||||
``` | ||||||||||
python -m pip install dist/cloudstate-<the version>-py3-none-any.whl | ||||||||||
python -m pip install dist/akkaserverless-<the version>-py3-none-any.whl | ||||||||||
``` | ||||||||||
|
||||||||||
### build and run tck, including provisional tests for stateless functions. | ||||||||||
|
||||||||||
NOTE: TODO; this is not setup or developed. | ||||||||||
|
||||||||||
``` | ||||||||||
./extended_tck.sh | ||||||||||
``` |
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks for keeping a Contributors list while migrating this to AS.