Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ jobs:
- restore_deps_cache
- set-sdk-version
- build-maven-java
- run:
name: Customer Registry quickstart
command: |
cd samples/customer-registry-quickstart
echo "Running mvn with SDK version: '$SDK_VERSION'"
mvn -Dakkaserverless-sdk.version=$SDK_VERSION verify -Pit
- run:
name: Views "Customer Registry" sample
command: |
Expand Down
89 changes: 89 additions & 0 deletions samples/customer-registry-quickstart/README.md
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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
While designing your service it is useful to read [designing services](https://developer.lightbend.com/docs/akka-serverless/designing/index.html)
To understand the Akka Serverless concepts that are a basis for this example, see [Designing services](https://developer.lightbend.com/docs/akka-serverless/designing/index.html) in the documentation.



## Developing

This project has a bare-bones skeleton service ready to go, but in order to adapt and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
This project has a bare-bones skeleton service ready to go, but in order to adapt and
This project demonstrates use of Value Entity and View components.

extend it it may be useful to read up on [developing services](https://developer.lightbend.com/docs/akka-serverless/developing/index.html)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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)
To understand more about these components, see

and in particular the [Java section](https://developer.lightbend.com/docs/akka-serverless/java-services/index.html)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Contributor

@raboof raboof Aug 18, 2021

Choose a reason for hiding this comment

The 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 .proto definitions:"?

(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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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.
To run the example locally, you must run the Akka Serverless proxy. The included `docker-compose` file contains the configuration required to run the proxy.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks to me like the property is dockerImage not akkasls.dockerImage?

[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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Finally you can or use the [Akka Serverless Console](https://console.akkaserverless.com)
Finally you can use `akkasls` or the [Akka Serverless Console](https://console.akkaserverless.com)

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor

@raboof raboof Aug 18, 2021

Choose a reason for hiding this comment

The 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.
5 changes: 5 additions & 0 deletions samples/customer-registry-quickstart/docker-compose.linux.yml
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"
15 changes: 15 additions & 0 deletions samples/customer-registry-quickstart/docker-compose.yml
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
Loading