Skip to content

Commit f6bd6be

Browse files
committed
Add deployment tests. Closes #21.
1 parent 5469269 commit f6bd6be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+855
-884
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
**/node_modules/**
22
npm-debug.log
3-
coverage/
3+
coverage/
4+
5+
test/encrypted/nodejs-docs-samples.json

.travis.yml

+35-29
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
sudo: false
1+
# Copyright 2015, Google, Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
sudo: required
215
language: node_js
316
node_js:
417
- "stable"
18+
- "0.12"
519
- "0.10"
620

721
cache:
@@ -20,38 +34,30 @@ cache:
2034

2135
services:
2236
- redis-server
37+
- docker
2338

2439
env:
25-
- PATH=$PATH:$HOME/gcloud/google-cloud-sdk/bin GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/nodejs-docs-samples.json TEST_BUCKET_NAME=cloud-samples-tests TEST_PROJECT_ID=cloud-samples-tests #Other environment variables on same line
40+
- PATH=$PATH:$HOME/gcloud/google-cloud-sdk/bin GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/test/encrypted/nodejs-docs-samples.json TEST_BUCKET_NAME=nodejs-docs-samples TEST_PROJECT_ID=nodejs-docs-samples #Other environment variables on same line
2641

2742
before_install:
28-
#ENCRYPT YOUR PRIVATE KEY (If you need authentication)
29-
# 1. Install and login to the Travis CLI:
30-
# $ gem install travis
31-
# $ travis login
32-
# 2. Move your json private key to client_secrets.json
33-
# 3. Run:
34-
# $ travis encrypt-file client_secrets.json --add
35-
# 4. Commit changes:
36-
# $ git add client_secrets.json.enc
37-
# $ git commit client_secrets.json.enc .travis.yml
38-
39-
- if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
40-
mkdir -p $HOME/gcloud &&
41-
wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz --directory-prefix=$HOME/gcloud &&
42-
cd $HOME/gcloud &&
43-
tar xzf google-cloud-sdk.tar.gz &&
44-
printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh &&
45-
cd $TRAVIS_BUILD_DIR;
46-
fi
47-
- openssl aes-256-cbc -K $encrypted_95e832a36b06_key -iv $encrypted_95e832a36b06_iv -in nodejs-docs-samples.json.enc -out nodejs-docs-samples.json -d
48-
- if [ -a nodejs-docs-samples.json ]; then
49-
gcloud auth activate-service-account --key-file nodejs-docs-samples.json;
50-
fi
51-
52-
install:
53-
#Add app specific setup here
54-
#Use '-q' to disable interactive prompts
43+
- if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
44+
mkdir -p $HOME/gcloud &&
45+
wget https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz --directory-prefix=$HOME/gcloud &&
46+
cd $HOME/gcloud &&
47+
tar xzf google-cloud-sdk.tar.gz &&
48+
printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh &&
49+
source /home/travis/.bash_profile &&
50+
cd $TRAVIS_BUILD_DIR;
51+
fi
52+
- gcloud components update -q
53+
- gcloud components update app -q
54+
- openssl aes-256-cbc -K $encrypted_fda0b707c7d5_key -iv $encrypted_fda0b707c7d5_iv -in test/encrypted/nodejs-docs-samples.json.enc -out test/encrypted/nodejs-docs-samples.json -d
55+
- if [ -a test/encrypted/nodejs-docs-samples.json ]; then
56+
gcloud auth activate-service-account --key-file test/encrypted/nodejs-docs-samples.json;
57+
fi
5558

5659
after_success:
5760
- npm run coveralls
61+
62+
after_script:
63+
- gsutil -m cp *.log gs://nodejs-docs-samples-travis-deployments

README.md

+104-16
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
11
# Google Cloud Platform NodeJS Samples
22

3-
This repository holds the samples used in the nodejs documentation on [cloud.google.com/nodejs](https://cloud.google.com/nodejs).
3+
This repository holds the samples used in the nodejs documentation on
4+
[cloud.google.com/nodejs](https://cloud.google.com/nodejs).
45

56
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/nodejs-docs-samples.svg)](https://travis-ci.org/GoogleCloudPlatform/nodejs-docs-samples)
67

78
## Google App Engine
89

9-
This is a collection of samples and instructions to run common nodejs frameworks and applications on [Google App Engine](http://cloud.google.com/nodejs).
10+
This is a collection of samples and instructions to run common nodejs frameworks
11+
and applications on [Google App Engine](http://cloud.google.com/nodejs).
1012

1113
### Frameworks
1214

13-
- [Express](appengine/express/)
14-
- [Hapi](appengine/hapi/)
15-
- [Loopback](appengine/loopback/)
16-
- [Sails](appengine/sails/)
17-
- [Koa](appengine/koa/)
18-
- [Kraken](appengine/kraken/)
19-
- [Restify](appengine/restify/)
20-
- [Geddy](appengine/geddy/)
15+
- Express.js - [Source code][express_1] | [App Engine Tutorial][express_2] | [Live demo][express_3] | [Documentation][express_4]
16+
- Geddy.js - [Source code][geddy_1] | [App Engine Tutorial][geddy_2] | [Live demo][geddy_3] | [Documentation][geddy_4]
17+
- Hapi.js - [Source code][hapi_1] | [App Engine Tutorial][hapi_2] | [Live demo][hapi_3] | [Documentation][hapi_4]
18+
- Loopback.js - [Source code][loopback_1] | [App Engine Tutorial][loopback_2] | [Live demo][loopback_3] | [Documentation][loopback_4]
19+
- Koa.js - [Source code][koa_1] | [App Engine Tutorial][koa_2] | [Live demo][koa_3] | [Documentation][koa_4]
20+
- Kraken.js - [Source code][kraken_1] | [App Engine Tutorial][kraken_2] | [Live demo][kraken_3] | [Documentation][kraken_4]
21+
- Restify.js - [Source code][restify_1] | [App Engine Tutorial][restify_2] | [Live demo][restify_3] | [Documentation][restify_4]
22+
- Sails.js - [Source code][sails_1] | [App Engine Tutorial][sails_2] | [Live demo][sails_3] | [Documentation][sails_4]
2123

22-
### Services
24+
### Databases
2325

24-
- [Redis](appengine/redis/)
26+
- Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3]
2527

2628
### Tools
2729

28-
- [Grunt](appengine/grunt/)
30+
- gcloud-node - [Source code][gcloud_1] | [Documentation][gcloud_2]
31+
- Grunt.js - [Source code][grunt_1] | [App Engine Tutorial][grunt_2] | [Live demo][grunt_3] | [Documentation][grunt_4]
32+
- Mailgun - [Source code][mailgun_1] | [App Engine Tutorial][mailgun_2] | [Documentation][mailgun_3]
2933

30-
### More information
34+
## Google Storage
35+
36+
- Auth sample - [Source code][storage_1] | [Google Cloud Docs][storage_2]
37+
38+
## Example Apps
39+
40+
- nodejs-getting-started - [Source code][nodejs_1] | [App Engine Tutorial 1][nodejs_2] | [App Engine Tutorial 2][nodejs_3]
41+
- gcloud-node-todos - [Source code][todos_1]
42+
- gitnpm - [Source code][gitnpm_1]
43+
- gcloud-kvstore - [Source code][kvstore_1]
44+
45+
## More information
3146

3247
- [Getting started with nodejs on Google Cloud](http://cloud.google.com/nodejs/)
3348
- See our other [Google Cloud Platform github repos](https://github.com/GoogleCloudPlatform) for sample applications and scaffolding for other frameworks and use cases.
@@ -36,8 +51,81 @@ This is a collection of samples and instructions to run common nodejs frameworks
3651

3752
## Contributing changes
3853

39-
* See [CONTRIBUTING.md](CONTRIBUTING.md)
54+
Contributions welcome!
55+
56+
See [CONTRIBUTING.md](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md)
4057

4158
## Licensing
4259

43-
* See [LICENSE](LICENSE)
60+
Apache Version 2.0
61+
62+
See [LICENSE](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/LICENSE)
63+
64+
[storage_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/storage/authSample.js
65+
[storage_2]: https://cloud.google.com/storage/docs/authentication#acd-examples
66+
67+
[express_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/express
68+
[express_2]: https://cloud.google.com/nodejs/resources/frameworks/express
69+
[express_3]: http://express-dot-nodejs-docs-samples.appspot.com
70+
[express_4]: http://expressjs.com/
71+
72+
[geddy_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/geddy
73+
[geddy_2]: https://cloud.google.com/nodejs/resources/frameworks/geddy
74+
[geddy_3]: http://geddy-dot-nodejs-docs-samples.appspot.com
75+
[geddy_4]: http://geddyjs.org/
76+
77+
[hapi_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/hapi
78+
[hapi_2]: https://cloud.google.com/nodejs/resources/frameworks/hapi
79+
[hapi_3]: http://hapi-dot-nodejs-docs-samples.appspot.com
80+
[hapi_4]: http://hapijs.com/
81+
82+
[loopback_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/loopback
83+
[loopback_2]: https://cloud.google.com/nodejs/resources/frameworks/loopback
84+
[loopback_3]: http://loopback-dot-nodejs-docs-samples.appspot.com
85+
[loopback_4]: http://loopback.io/
86+
87+
[koa_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/koa
88+
[koa_2]: https://cloud.google.com/nodejs/resources/frameworks/koa
89+
[koa_3]: http://koa-dot-nodejs-docs-samples.appspot.com
90+
[koa_4]: http://koajs.com/
91+
92+
[kraken_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/kraken
93+
[kraken_2]: https://cloud.google.com/nodejs/resources/frameworks/kraken
94+
[kraken_3]: http://kraken-dot-nodejs-docs-samples.appspot.com
95+
[kraken_4]: http://krakenjs.com/
96+
97+
[restify_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/restify
98+
[restify_2]: https://cloud.google.com/nodejs/resources/frameworks/restify
99+
[restify_3]: http://restify-dot-nodejs-docs-samples.appspot.com
100+
[restify_4]: http://restify.com/
101+
102+
[sails_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/sails
103+
[sails_2]: https://cloud.google.com/nodejs/resources/frameworks/sails
104+
[sails_3]: http://sails-dot-nodejs-docs-samples.appspot.com
105+
[sails_4]: http://sailsjs.org/
106+
107+
[redis_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/redis
108+
[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis
109+
[redis_3]: http://redis.io/
110+
111+
[gcloud_1]: https://github.com/GoogleCloudPlatform/gcloud-node
112+
[gcloud_2]: https://googlecloudplatform.github.io/gcloud-node/#/
113+
114+
[grunt_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/grunt
115+
[grunt_2]: https://cloud.google.com/nodejs/resources/tools/grunt
116+
[grunt_3]: http://grunt-dot-nodejs-docs-samples.appspot.com
117+
[grunt_4]: http://gruntjs.com/
118+
119+
[mailgun_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/mailgun
120+
[mailgun_2]: https://cloud.google.com/nodejs/resources/tools/mailgun
121+
[mailgun_3]: http://www.mailgun.com/
122+
123+
[nodejs_1]: https://github.com/GoogleCloudPlatform/nodejs-getting-started
124+
[nodejs_2]: https://cloud.google.com/nodejs/getting-started/hello-world
125+
[nodejs_3]: https://cloud.google.com/nodejs/getting-started/tutorial-app
126+
127+
[todos_1]: https://github.com/GoogleCloudPlatform/gcloud-node-todos
128+
129+
[gitnpm_1]: https://github.com/stephenplusplus/gitnpm
130+
131+
[kvstore_1]: https://github.com/stephenplusplus/gcloud-kvstore

appengine/README.md

-29
This file was deleted.

appengine/express/README.md

+9-39
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,13 @@
1-
## Express on Google App Engine
1+
## Express.js on Google App Engine
22

3-
> [Express](http://expressjs.com) is a minimal and flexible Node.js web
4-
application framework that provides a robust set of features for web and mobile
5-
applications.
3+
> [Express][1] is a minimal and flexible Node.js web application framework that
4+
provides a robust set of features for web and mobile applications.
65

7-
You can view the deployed demo app [here](https://express-demo.appspot.com).
6+
Read the [Express.js on App Engine Tutorial][2] for how to run and deploy this
7+
sample app.
88

9-
### Create a new Express app
9+
You can also view the [live demo][3] and read the [Express.js documentation][1].
1010

11-
View the [Express app generator guide](http://expressjs.com/starter/generator.html).
12-
13-
### Configure
14-
15-
Create an `app.yaml` in the root of your application with the following
16-
contents:
17-
18-
```yaml
19-
runtime: nodejs
20-
vm: true
21-
api_version: 1
22-
env_variables:
23-
PORT: 8080
24-
```
25-
26-
### Deploy
27-
28-
For convenience, you can use an npm script to run the `gcloud` command. Add
29-
these lines to your `package.json` file:
30-
31-
```json
32-
"scripts": {
33-
"start": "node ./bin/www",
34-
"deploy": "gcloud preview app deploy app.yaml --promote --project <your-project-id>"
35-
}
36-
```
37-
38-
At the terminal you can now run the following command to deploy your
39-
application:
40-
41-
```
42-
$ npm deploy
43-
```
11+
[1]: http://expressjs.com/
12+
[2]: https://cloud.google.com/nodejs/resources/frameworks/express
13+
[3]: http://express-dot-nodejs-docs-samples.appspot.com

appengine/express/app.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# [START app_yaml]
1515
runtime: nodejs
1616
vm: true
17-
api_version: 1
1817
env_variables:
1918
PORT: 8080
2019
# [END app_yaml]

appengine/express/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"scripts": {
1111
"start": "node ./bin/www",
12-
"deploy": "gcloud preview app deploy app.yaml --promote --project express-demo"
12+
"deploy": "gcloud preview app deploy app.yaml"
1313
},
1414
"dependencies": {
1515
"body-parser": "^1.14.1",

0 commit comments

Comments
 (0)