File tree Expand file tree Collapse file tree 6 files changed +11
-15
lines changed
java/com.example.cloud.bigtable.helloworld Expand file tree Collapse file tree 6 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,9 @@ Download the [Jar](https://storage.googleapis.com/cloud-bigtable/jars/bigtable-h
90
90
91
91
### Deploying as a managed VM app
92
92
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 `
94
96
95
97
1 . Set ` PROJECT_ID ` , ` CLUSTER_UNIQUE_ID ` , and ` Zone ` (if necessary) in ` src/main/java/com/example/bigtable/managedvms/BigtableHelper.java `
96
98
Original file line number Diff line number Diff line change 27
27
<artifactId >helloworld</artifactId >
28
28
29
29
<properties >
30
- <projectid >YOUR_PROJECT_ID_HERE</projectid >
31
30
<appengine .target.version>1.9.19</appengine .target.version>
32
31
<gcloud .plugin.version>0.9.58.v20150505</gcloud .plugin.version>
33
32
<compileSource >1.7</compileSource >
543
542
<artifactId >gcloud-maven-plugin</artifactId >
544
543
<version >${gcloud.plugin.version} </version >
545
544
<configuration >
546
- <gcloud_project > ${projectid} </ gcloud_project >
545
+ <set_default >true</ set_default >
547
546
</configuration >
548
547
</plugin >
549
548
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ public class BigtableHelper implements ServletContextListener {
39
39
**/
40
40
private static final String PROJECT_ID = "PROJECT_ID_HERE" ;
41
41
private static final String CLUSTER_ID = "CLUSTER_UNIQUE_ID" ;
42
+
42
43
private static final String ZONE = "us-central1-b" ;
43
44
44
45
// The initial connection to Cloud Bigtable is an expensive operation -- We cache this Connection
Original file line number Diff line number Diff line change 1
1
FROM gae-bt-v02
2
2
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
4
5
5
6
ADD . /app
Original file line number Diff line number Diff line change 16
16
-->
17
17
18
18
<appengine-web-app xmlns =" http://appengine.google.com/ns/1.0" >
19
-
20
- <application >${projectid}</application >
21
19
22
- <version >hellojava</version >
23
20
<threadsafe >true</threadsafe >
24
21
<vm >true</vm >
25
22
26
- <!--
27
- Requesting bigtable.data scope is very important.
28
- -->
29
23
<beta-settings >
30
24
<setting name =" service_account_scopes" value =" https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/devstorage.full_control" />
31
25
</beta-settings >
35
29
<max-num-instances >20</max-num-instances >
36
30
<cool-down-period-sec >330</cool-down-period-sec >
37
31
<cpu-utilization >
38
- <target-utilization >0.8 </target-utilization >
32
+ <target-utilization >0.5 </target-utilization >
39
33
</cpu-utilization >
40
34
</automatic-scaling >
41
35
Original file line number Diff line number Diff line change 35
35
36
36
<servlet >
37
37
<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 >
40
39
</servlet >
41
40
<servlet-mapping >
42
41
<servlet-name >hello</servlet-name >
45
44
46
45
<servlet >
47
46
<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 >
49
48
</servlet >
50
49
<servlet-mapping >
51
50
<servlet-name >json</servlet-name >
52
51
<url-pattern >/json/*</url-pattern >
53
52
</servlet-mapping >
54
53
55
54
<listener >
56
- <listener-class >com.example.bigtable.managedvms .BigtableHelper</listener-class >
55
+ <listener-class >com.example.cloud. bigtable.helloworld .BigtableHelper</listener-class >
57
56
</listener >
58
57
59
58
<!--
You can’t perform that action at this time.
0 commit comments