Skip to content

Commit

Permalink
Updated to work with new gcloud SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
elibixby committed Jan 8, 2015
1 parent 18819d5 commit 72bfff1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 36 deletions.
36 changes: 12 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ Copyright (C) 2010-2014 Google Inc.

## Sample websocket chat application for use with App Engine Java VM Runtime.

Requires [Apache Maven](http://maven.apache.org) 3.0 or greater, and
JDK 7+ in order to run. This application needs to be deployed to the
[App Engine VM Runtime][1].
This application builds and deploys a chat application which uses web sockets to Google App Engine [Managed VMs][1], using Maven and the gcloud SDK.

Make sure that you are invited to the [VM Runtime Trusted Tester
Program][2], and have [downloaded the SDK](http://commondatastorage.googleapis.com/gae-vm-runtime-tt/vmruntime_sdks.html).
## Project Setup

1. Create a billing enabled project and install the Google Cloud SDK as described [here][2].
2. Install Maven 3.1 or later as described [here](https://cloud.google.com/appengine/docs/java/managed-vms/maven#requirements).

### Create Firewall Exception

In order to run this application, you also need to configure the
Compute Engine firewall to allow incoming connections to the port 65080
Expand All @@ -17,7 +19,7 @@ by default.
Here is how to configure the Compute Engine firewall.

1. Go to the [cloud console][3].
2. Select your project which is under the VM Runtime TT program.
2. Select your project
3. Select `Compute Engine`
4. Click the `Network` menu then click the `default` network.
5. Click `Create new` button in the `Firewalls` section.
Expand All @@ -26,24 +28,10 @@ Here is how to configure the Compute Engine firewall.

Now you're good to go!

To build:

1. Rewrite the value of the `application` element in your `appengine-web.xml` to your app id.
2. Run `mvn package`
3. Run `appcfg.sh` of the SDK as follows:

$ $SDK_DIR/bin/appcfg.sh -s preview.appengine.google.com update target/websocketchat-1.0-SNAPSHOT

4. Visit `http://chat.your-app-id.appspot.com/`.

For further information, consult the [Java App
Engine](https://developers.google.com/appengine/docs/java/overview)
documentation.

To see all the available goals for the App Engine plugin, run
##Deploy

mvn help:describe -Dplugin=appengine
After setting up Maven, you can deploy your app locally, or to the Google Cloud Platform as described [here](https://cloud.google.com/appengine/docs/java/managed-vms/maven#run_and_deploy_your_app_with_the_cloud_sdk_development_server), then visit `http://chat.your-app-id.appspot.com/`.

[1]: https://docs.google.com/document/d/1VH1oVarfKILAF_TfvETtPPE3TFzIuWqsa22PtkRkgJ4
[2]: https://groups.google.com/forum/?fromgroups#!topic/google-appengine/gRZNqlQPKys
[1]: https://cloud.google.com/appengine/docs/java/managed-vms/
[2]: https://cloud.google.com/appengine/docs/java/managed-vms/#install-sdk
[3]: https://cloud.google.com/console
13 changes: 10 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<version>1.01-SNAPSHOT</version>

<groupId>com.google.appengine.demos</groupId>
<artifactId>websocketchat</artifactId>
Expand Down Expand Up @@ -115,11 +115,11 @@
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<archiveClasses>true</archiveClasses>
<archiveClasses>true</archiveClasses>
<webResources>
<!-- in order to interpolate version from pom into appengine-web.xml -->
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
Expand All @@ -132,6 +132,13 @@
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
</plugin>

<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>1.9.17</version>
</plugin>

</plugins>
</build>

Expand Down
12 changes: 3 additions & 9 deletions src/main/webapp/WEB-INF/appengine-web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,12 @@
-->

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>your-app-id</application>
<version>${appengine.app.version}</version>
<threadsafe>true</threadsafe>
<vm>true</vm>
<vm-settings>
<setting name="machine_type" value="n1-standard-1"/>
<setting name="forwarded_ports" value="65080"/>
</vm-settings>
<manual-scaling>
<instances>3</instances>
</manual-scaling>

<network>
<forwarded-port>65080</forwarded-port>
</network>
<sessions-enabled>true</sessions-enabled>
<precompilation-enabled>false</precompilation-enabled>
<system-properties>
Expand Down

0 comments on commit 72bfff1

Please sign in to comment.