From 2dec0da29fc048c78a26a6d27f985a517faf88a8 Mon Sep 17 00:00:00 2001 From: Les Vogel Date: Fri, 8 May 2015 14:12:32 -0700 Subject: [PATCH] More updates per Ludo and fixing my stupidity. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Instead of setting project_ID & version in the pom.xml, let gcloud do it 2. Fix package names in web.xml (My Bad .. some files didn’t get copied) 3. Get rid of projectID & version from appengine-web.xml 4. Get rid of old comment and set target utilization to 0.5 - another change that didn’t get migrated. 5. Add comment for GOOGLE_APPLICATION_CREDENTIALS 6. Add set_default key to mvn --- java/managed-vms/README.md | 4 +++- java/managed-vms/helloworld/pom.xml | 3 +-- .../BigtableHelper.java | 1 + java/managed-vms/helloworld/src/main/webapp/Dockerfile | 3 ++- .../helloworld/src/main/webapp/WEB-INF/appengine-web.xml | 8 +------- .../helloworld/src/main/webapp/WEB-INF/web.xml | 7 +++---- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/java/managed-vms/README.md b/java/managed-vms/README.md index 094be80d..9da2aa91 100644 --- a/java/managed-vms/README.md +++ b/java/managed-vms/README.md @@ -90,7 +90,9 @@ Download the [Jar](https://storage.googleapis.com/cloud-bigtable/jars/bigtable-h ### Deploying as a managed VM app -1. Set the `project_ID` in `pom.xml` +1. If you haven't already done so, set your project in the gcloud tool. + + `gcloud config set project PROJECT_ID` 1. Set `PROJECT_ID`, `CLUSTER_UNIQUE_ID`, and `Zone` (if necessary) in `src/main/java/com/example/bigtable/managedvms/BigtableHelper.java` diff --git a/java/managed-vms/helloworld/pom.xml b/java/managed-vms/helloworld/pom.xml index 5821139a..edf93ee5 100644 --- a/java/managed-vms/helloworld/pom.xml +++ b/java/managed-vms/helloworld/pom.xml @@ -27,7 +27,6 @@ helloworld - YOUR_PROJECT_ID_HERE 1.9.19 0.9.58.v20150505 1.7 @@ -543,7 +542,7 @@ gcloud-maven-plugin ${gcloud.plugin.version} - ${projectid} + true diff --git a/java/managed-vms/helloworld/src/main/java/com.example.cloud.bigtable.helloworld/BigtableHelper.java b/java/managed-vms/helloworld/src/main/java/com.example.cloud.bigtable.helloworld/BigtableHelper.java index 73de5197..f56ec818 100644 --- a/java/managed-vms/helloworld/src/main/java/com.example.cloud.bigtable.helloworld/BigtableHelper.java +++ b/java/managed-vms/helloworld/src/main/java/com.example.cloud.bigtable.helloworld/BigtableHelper.java @@ -39,6 +39,7 @@ public class BigtableHelper implements ServletContextListener { **/ private static final String PROJECT_ID = "PROJECT_ID_HERE"; private static final String CLUSTER_ID = "CLUSTER_UNIQUE_ID"; + private static final String ZONE = "us-central1-b"; // The initial connection to Cloud Bigtable is an expensive operation -- We cache this Connection diff --git a/java/managed-vms/helloworld/src/main/webapp/Dockerfile b/java/managed-vms/helloworld/src/main/webapp/Dockerfile index 5d98d045..8a74f768 100644 --- a/java/managed-vms/helloworld/src/main/webapp/Dockerfile +++ b/java/managed-vms/helloworld/src/main/webapp/Dockerfile @@ -1,5 +1,6 @@ FROM gae-bt-v02 -# ENV GOOGLE_APPLICATION_CREDENTIALS= +# The below line is only needed if you want to "mvn gcloud:run" on your local computer +# ENV GOOGLE_APPLICATION_CREDENTIALS=/app/WEB-INF/YOUR_KEY_FILE.json ADD . /app diff --git a/java/managed-vms/helloworld/src/main/webapp/WEB-INF/appengine-web.xml b/java/managed-vms/helloworld/src/main/webapp/WEB-INF/appengine-web.xml index 3c81cd2f..a3434285 100644 --- a/java/managed-vms/helloworld/src/main/webapp/WEB-INF/appengine-web.xml +++ b/java/managed-vms/helloworld/src/main/webapp/WEB-INF/appengine-web.xml @@ -16,16 +16,10 @@ --> - - ${projectid} - hellojava true true - @@ -35,7 +29,7 @@ 20 330 - 0.8 + 0.5 diff --git a/java/managed-vms/helloworld/src/main/webapp/WEB-INF/web.xml b/java/managed-vms/helloworld/src/main/webapp/WEB-INF/web.xml index 55657b30..22c880c8 100644 --- a/java/managed-vms/helloworld/src/main/webapp/WEB-INF/web.xml +++ b/java/managed-vms/helloworld/src/main/webapp/WEB-INF/web.xml @@ -35,8 +35,7 @@ hello - com.example.bigtable.managedvms.HelloServlet - 1 + com.example.cloud.bigtable.helloworld.HelloServlet hello @@ -45,7 +44,7 @@ json - com.example.bigtable.managedvms.JsonServlet + com.example.cloud.bigtable.helloworld.JsonServlet json @@ -53,7 +52,7 @@ - com.example.bigtable.managedvms.BigtableHelper + com.example.cloud.bigtable.helloworld.BigtableHelper