Skip to content

Commit

Permalink
Merge pull request #35 from GoogleCloudPlatform/LV015
Browse files Browse the repository at this point in the history
More updates per Ludo and fixing my stupidity.
  • Loading branch information
lesv committed May 8, 2015
2 parents bb76c74 + 2dec0da commit 3a766ec
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
4 changes: 3 additions & 1 deletion java/managed-vms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
3 changes: 1 addition & 2 deletions java/managed-vms/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<artifactId>helloworld</artifactId>

<properties>
<projectid>YOUR_PROJECT_ID_HERE</projectid>
<appengine.target.version>1.9.19</appengine.target.version>
<gcloud.plugin.version>0.9.58.v20150505</gcloud.plugin.version>
<compileSource>1.7</compileSource>
Expand Down Expand Up @@ -543,7 +542,7 @@
<artifactId>gcloud-maven-plugin</artifactId>
<version>${gcloud.plugin.version}</version>
<configuration>
<gcloud_project>${projectid}</gcloud_project>
<set_default>true</set_default>
</configuration>
</plugin>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion java/managed-vms/helloworld/src/main/webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@
-->

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">

<application>${projectid}</application>

<version>hellojava</version>
<threadsafe>true</threadsafe>
<vm>true</vm>

<!--
Requesting bigtable.data scope is very important.
-->
<beta-settings>
<setting name="service_account_scopes" value="https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/devstorage.full_control" />
</beta-settings>
Expand All @@ -35,7 +29,7 @@
<max-num-instances>20</max-num-instances>
<cool-down-period-sec>330</cool-down-period-sec>
<cpu-utilization>
<target-utilization>0.8</target-utilization>
<target-utilization>0.5</target-utilization>
</cpu-utilization>
</automatic-scaling>

Expand Down
7 changes: 3 additions & 4 deletions java/managed-vms/helloworld/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@

<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>com.example.bigtable.managedvms.HelloServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<servlet-class>com.example.cloud.bigtable.helloworld.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
Expand All @@ -45,15 +44,15 @@

<servlet>
<servlet-name>json</servlet-name>
<servlet-class>com.example.bigtable.managedvms.JsonServlet</servlet-class>
<servlet-class>com.example.cloud.bigtable.helloworld.JsonServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>json</servlet-name>
<url-pattern>/json/*</url-pattern>
</servlet-mapping>

<listener>
<listener-class>com.example.bigtable.managedvms.BigtableHelper</listener-class>
<listener-class>com.example.cloud.bigtable.helloworld.BigtableHelper</listener-class>
</listener>

<!--
Expand Down

0 comments on commit 3a766ec

Please sign in to comment.