-
Notifications
You must be signed in to change notification settings - Fork 39
feature: Customer Registry quickstart bootstrap #203
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
Changes from 9 commits
fcff4f1
b680f1c
47393d6
9f1d36b
01aacf4
b2ef1f5
164d1e2
89c0abe
f8c00dd
244893a
88385e9
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,89 @@ | ||||||
| # Quickstart project: Customer Registry | ||||||
|
|
||||||
| # TODO update for quickstart instructions | ||||||
|
|
||||||
| ## Designing | ||||||
|
|
||||||
| While designing your service it is useful to read [designing services](https://developer.lightbend.com/docs/akka-serverless/designing/index.html) | ||||||
|
|
||||||
|
|
||||||
| ## Developing | ||||||
|
|
||||||
| This project has a bare-bones skeleton service ready to go, but in order to adapt and | ||||||
|
Contributor
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
|
||||||
| extend it it may be useful to read up on [developing services](https://developer.lightbend.com/docs/akka-serverless/developing/index.html) | ||||||
|
Contributor
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
|
||||||
| and in particular the [Java section](https://developer.lightbend.com/docs/akka-serverless/java-services/index.html) | ||||||
|
Contributor
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. |
||||||
|
|
||||||
|
|
||||||
| ## Building | ||||||
|
|
||||||
| To build, at a minimum you need to generate and process sources, particularly when using an IDE. | ||||||
|
Contributor
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. Not sure this sentence makes sense in the context of this sample, but I'm not sure how to change it?
Contributor
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. I agree this is a confusing sentence. Maybe just let's say "You can use Maven to build your project, which will also take care of generating code based on the (this should probably be updated everywhere) |
||||||
| To compile your project: | ||||||
|
|
||||||
| ``` | ||||||
| mvn compile | ||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
| ## Running Locally | ||||||
|
|
||||||
| In order to run your application locally, you must run the Akka Serverless proxy. The included `docker-compose` file contains the configuration required to run the proxy for a locally running application. | ||||||
|
Contributor
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
|
||||||
| It also contains the configuration to start a local Google Pub/Sub emulator that the Akka Serverless proxy will connect to. | ||||||
| To start the proxy, run the following command from this directory: | ||||||
|
|
||||||
|
|
||||||
| ``` | ||||||
| docker-compose up | ||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
| > On Linux this requires Docker 20.10 or later (https://github.com/moby/moby/pull/40007), | ||||||
| > or for a `USER_FUNCTION_HOST` environment variable to be set manually. | ||||||
|
|
||||||
| ``` | ||||||
| docker-compose -f docker-compose.yml -f docker-compose.linux.yml up | ||||||
| ``` | ||||||
|
|
||||||
| To start the application locally, the `exec-maven-plugin` is used. Use the following command: | ||||||
|
|
||||||
| ``` | ||||||
| mvn compile exec:java | ||||||
| ``` | ||||||
|
|
||||||
| With both the proxy and your application running, any defined endpoints should be available at `http://localhost:9000`. In addition to the defined gRPC interface, each method has a corresponding HTTP endpoint. Unless configured otherwise (see [Transcoding HTTP](https://developer.lightbend.com/docs/akka-serverless/java/proto.html#_transcoding_http)), this endpoint accepts POST requests at the path `/[package].[entity name]/[method]`. For example, using `curl`: | ||||||
|
|
||||||
|
|
||||||
| * Create a customer with: | ||||||
| ``` | ||||||
| grpcurl --plaintext -d '{"customer_id": "wip", "email": "[email protected]", "name": "Very Important", "address": {"street": "Road 1", "city": "The Capital"}}' localhost:9000 customer.api.CustomerService/Create | ||||||
| ``` | ||||||
| * Retrieve the customer: | ||||||
| ``` | ||||||
| grpcurl --plaintext -d '{"customer_id": "wip"}' localhost:9000 customer.api.CustomerService/GetCustomer | ||||||
| ``` | ||||||
| * Query by name: | ||||||
| ``` | ||||||
| grpcurl --plaintext -d '{"customer_name": "Very Important"}' localhost:9000 customer.view.CustomerByName/GetCustomers | ||||||
| ``` | ||||||
| * Change name: | ||||||
| ``` | ||||||
| grpcurl --plaintext -d '{"customer_id": "wip", "new_name": "Most Important"}' localhost:9000 customer.api.CustomerService/ChangeName | ||||||
| ``` | ||||||
| * Change address: | ||||||
| ``` | ||||||
| grpcurl --plaintext -d '{"customer_id": "wip", "new_address": {"street": "Street 1", "city": "The City"}}' localhost:9000 customer.api.CustomerService/ChangeAddress | ||||||
| ``` | ||||||
|
|
||||||
| ## Deploying | ||||||
|
|
||||||
| To deploy your service, install the `akkasls` CLI as documented in | ||||||
| [Setting up a local development environment](https://developer.lightbend.com/docs/akka-serverless/getting-started/set-up-development-env.html) | ||||||
| and configure a Docker Registry to upload your docker image to. | ||||||
|
|
||||||
| You will need to update the `akkasls.dockerImage` property in the `pom.xml` and refer to | ||||||
|
Contributor
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. It looks to me like the property is |
||||||
| [Configuring registries](https://developer.lightbend.com/docs/akka-serverless/deploying/registries.html) | ||||||
| for more information on how to make your docker image available to Akka Serverless. | ||||||
|
|
||||||
| Finally you can or use the [Akka Serverless Console](https://console.akkaserverless.com) | ||||||
|
Contributor
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
|
||||||
| to create a project and then deploy your service into the project either by using `mvn deploy`, | ||||||
| through the `akkasls` CLI or via the web interface. When using `mvn deploy`, Maven will also | ||||||
|
Contributor
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. The way this sentence reads, it sounds like they can use mvn deploy in the web interface. It needs to be rewritten because if they use the console, they still need to package and publish the image. Is there a separate mvn target for that that doesn't deploy? If not, we should just tell them to use the CLI.
Contributor
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. that is a great question that I don't know the answer to offhand. let's ticketify, #211 |
||||||
| conveniently package and publish your docker image prior to deployment. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| version: "3" | ||
| services: | ||
| akka-serverless-proxy: | ||
| extra_hosts: | ||
| - "host.docker.internal:host-gateway" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| version: "3" | ||
| services: | ||
| akka-serverless-proxy: | ||
| image: gcr.io/akkaserverless-public/akkaserverless-proxy:0.7.0-beta.14 | ||
| command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.eventing.support=google-pubsub-emulator | ||
| ports: | ||
| - "9000:9000" | ||
| environment: | ||
| USER_FUNCTION_HOST: ${USER_FUNCTION_HOST:-host.docker.internal} | ||
| USER_FUNCTION_PORT: ${USER_FUNCTION_PORT:-8080} | ||
| gcloud-pubsub-emulator: | ||
| image: gcr.io/google.com/cloudsdktool/cloud-sdk:341.0.0 | ||
| command: gcloud beta emulators pubsub start --project=test --host-port=0.0.0.0:8085 | ||
| ports: | ||
| - 8085:8085 |
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.