Skip to content

Commit df017aa

Browse files
committed
Add README
1 parent ce34897 commit df017aa

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

managedvms/async-rest/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
# Example Web App Using Asynchronous Servlets #
3+
4+
This web app demonstrates using asynchronous servlet techniques to reduce server resources.
5+
6+
The code for this tutorial is here: [https://github.com/GoogleCloudPlatform/java-docs-samples/managedvms/async-rest](https://github.com/GoogleCloudPlatform/java-docs-samples/managedvms/async-rest).
7+
8+
9+
## Initial Setup ##
10+
11+
First, complete the following steps:
12+
13+
- [Create your project](https://developers.google.com/appengine/docs/managed-vms/) and have it enabled for Managed VMs.
14+
- Obtain an app key for the Google Places WebService API.
15+
- Download and install [the Beta build of the Google Cloud SDK](https://developers.google.com/cloud/sdk/#Quick_Start).
16+
- Install the Cloud SDK `app-engine-java` component.
17+
- Authenticate wth the gcloud SDK: gcloud auth login.
18+
- Install [Maven](http://maven.apache.org/download.cgi) if you haven't already.
19+
20+
21+
22+
## Provding your Google Places API key ##
23+
24+
You will need to edit the pom.xml file and replace YOUR_PLACES_APP_KEY with the value of your key:
25+
26+
<places.appkey>YOUR_PLACES_APP_KEY</places.appkey>
27+
28+
You then have several options of how to run it:
29+
30+
## Running locally without the AppEngine environment ##
31+
32+
The application does not use any AppEngine specific services, so you can run it simply on your local machine by doing:
33+
34+
mvn jetty:run
35+
36+
Go to http://localhost:8080 to see the webapp.
37+
38+
39+
## Running locally using Docker ##
40+
41+
The project also builds a docker image based on the jetty9 image for [Google Container Engine](https://cloud.google.com/container-engine/). The WAR file is installed in the webapps directory and the resulting image can be run locally with:
42+
43+
docker run --rm -it -p 8080:8080 jetty9-async-rest --exec -Dcom.google.appengine.demos.asyncrest.appKey=YOUR_PLACES_APP_KEY
44+
45+
Where you replace YOUR_PLACES_APP_KEY with the key you obtained in the initial setup.
46+
47+
48+
## Deploying to the cloud as an AppEngine ManagedVM ##
49+
50+
To automatically stage and deploy the webapp to your project in the cloud do:
51+
52+
mvn gcloud:deploy
53+
54+
See here for more information on the [GCloud Maven Plugin](https://github.com/GoogleCloudPlatform/gcloud-maven-plugin).
55+

0 commit comments

Comments
 (0)