Skip to content

Commit 3a766ec

Browse files
committed
Merge pull request #35 from GoogleCloudPlatform/LV015
More updates per Ludo and fixing my stupidity.
2 parents bb76c74 + 2dec0da commit 3a766ec

File tree

6 files changed

+11
-15
lines changed

6 files changed

+11
-15
lines changed

java/managed-vms/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ Download the [Jar](https://storage.googleapis.com/cloud-bigtable/jars/bigtable-h
9090

9191
### Deploying as a managed VM app
9292

93-
1. Set the `project_ID` in `pom.xml`
93+
1. If you haven't already done so, set your project in the gcloud tool.
94+
95+
`gcloud config set project PROJECT_ID`
9496

9597
1. Set `PROJECT_ID`, `CLUSTER_UNIQUE_ID`, and `Zone` (if necessary) in `src/main/java/com/example/bigtable/managedvms/BigtableHelper.java`
9698

java/managed-vms/helloworld/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
<artifactId>helloworld</artifactId>
2828

2929
<properties>
30-
<projectid>YOUR_PROJECT_ID_HERE</projectid>
3130
<appengine.target.version>1.9.19</appengine.target.version>
3231
<gcloud.plugin.version>0.9.58.v20150505</gcloud.plugin.version>
3332
<compileSource>1.7</compileSource>
@@ -543,7 +542,7 @@
543542
<artifactId>gcloud-maven-plugin</artifactId>
544543
<version>${gcloud.plugin.version}</version>
545544
<configuration>
546-
<gcloud_project>${projectid}</gcloud_project>
545+
<set_default>true</set_default>
547546
</configuration>
548547
</plugin>
549548

java/managed-vms/helloworld/src/main/java/com.example.cloud.bigtable.helloworld/BigtableHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class BigtableHelper implements ServletContextListener {
3939
**/
4040
private static final String PROJECT_ID = "PROJECT_ID_HERE";
4141
private static final String CLUSTER_ID = "CLUSTER_UNIQUE_ID";
42+
4243
private static final String ZONE = "us-central1-b";
4344

4445
// The initial connection to Cloud Bigtable is an expensive operation -- We cache this Connection
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM gae-bt-v02
22

3-
# ENV GOOGLE_APPLICATION_CREDENTIALS=
3+
# The below line is only needed if you want to "mvn gcloud:run" on your local computer
4+
# ENV GOOGLE_APPLICATION_CREDENTIALS=/app/WEB-INF/YOUR_KEY_FILE.json
45

56
ADD . /app

java/managed-vms/helloworld/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,10 @@
1616
-->
1717

1818
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
19-
20-
<application>${projectid}</application>
2119

22-
<version>hellojava</version>
2320
<threadsafe>true</threadsafe>
2421
<vm>true</vm>
2522

26-
<!--
27-
Requesting bigtable.data scope is very important.
28-
-->
2923
<beta-settings>
3024
<setting name="service_account_scopes" value="https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/devstorage.full_control" />
3125
</beta-settings>
@@ -35,7 +29,7 @@
3529
<max-num-instances>20</max-num-instances>
3630
<cool-down-period-sec>330</cool-down-period-sec>
3731
<cpu-utilization>
38-
<target-utilization>0.8</target-utilization>
32+
<target-utilization>0.5</target-utilization>
3933
</cpu-utilization>
4034
</automatic-scaling>
4135

java/managed-vms/helloworld/src/main/webapp/WEB-INF/web.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535

3636
<servlet>
3737
<servlet-name>hello</servlet-name>
38-
<servlet-class>com.example.bigtable.managedvms.HelloServlet</servlet-class>
39-
<load-on-startup>1</load-on-startup>
38+
<servlet-class>com.example.cloud.bigtable.helloworld.HelloServlet</servlet-class>
4039
</servlet>
4140
<servlet-mapping>
4241
<servlet-name>hello</servlet-name>
@@ -45,15 +44,15 @@
4544

4645
<servlet>
4746
<servlet-name>json</servlet-name>
48-
<servlet-class>com.example.bigtable.managedvms.JsonServlet</servlet-class>
47+
<servlet-class>com.example.cloud.bigtable.helloworld.JsonServlet</servlet-class>
4948
</servlet>
5049
<servlet-mapping>
5150
<servlet-name>json</servlet-name>
5251
<url-pattern>/json/*</url-pattern>
5352
</servlet-mapping>
5453

5554
<listener>
56-
<listener-class>com.example.bigtable.managedvms.BigtableHelper</listener-class>
55+
<listener-class>com.example.cloud.bigtable.helloworld.BigtableHelper</listener-class>
5756
</listener>
5857

5958
<!--

0 commit comments

Comments
 (0)