Skip to content

Commit

Permalink
Add deployment tests. Closes #21.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Nov 13, 2015
1 parent 5469269 commit 903d495
Show file tree
Hide file tree
Showing 48 changed files with 855 additions and 884 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**/node_modules/**
npm-debug.log
coverage/
coverage/

test/encrypted/nodejs-docs-samples.json
64 changes: 35 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
sudo: false
# Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

sudo: required
language: node_js
node_js:
- "stable"
- "0.12"
- "0.10"

cache:
Expand All @@ -20,38 +34,30 @@ cache:

services:
- redis-server
- docker

env:
- 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
- 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

before_install:
#ENCRYPT YOUR PRIVATE KEY (If you need authentication)
# 1. Install and login to the Travis CLI:
# $ gem install travis
# $ travis login
# 2. Move your json private key to client_secrets.json
# 3. Run:
# $ travis encrypt-file client_secrets.json --add
# 4. Commit changes:
# $ git add client_secrets.json.enc
# $ git commit client_secrets.json.enc .travis.yml

- if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
mkdir -p $HOME/gcloud &&
wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz --directory-prefix=$HOME/gcloud &&
cd $HOME/gcloud &&
tar xzf google-cloud-sdk.tar.gz &&
printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh &&
cd $TRAVIS_BUILD_DIR;
fi
- openssl aes-256-cbc -K $encrypted_95e832a36b06_key -iv $encrypted_95e832a36b06_iv -in nodejs-docs-samples.json.enc -out nodejs-docs-samples.json -d
- if [ -a nodejs-docs-samples.json ]; then
gcloud auth activate-service-account --key-file nodejs-docs-samples.json;
fi

install:
#Add app specific setup here
#Use '-q' to disable interactive prompts
- if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
mkdir -p $HOME/gcloud &&
wget https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz --directory-prefix=$HOME/gcloud &&
cd $HOME/gcloud &&
tar xzf google-cloud-sdk.tar.gz &&
printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh &&
source /home/travis/.bash_profile &&
cd $TRAVIS_BUILD_DIR;
fi
- gcloud components update -q
- gcloud components update app -q
- 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
- if [ -a test/encrypted/nodejs-docs-samples.json ]; then
gcloud auth activate-service-account --key-file test/encrypted/nodejs-docs-samples.json;
fi

after_success:
- npm run coveralls

after_script:
- gsutil -m cp *.log gs://nodejs-docs-samples-travis-deployments
120 changes: 104 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
# Google Cloud Platform NodeJS Samples

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

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

## Google App Engine

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

### Frameworks

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

### Services
### Databases

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

### Tools

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

### More information
## Google Storage

- Auth sample - [Source code][storage_1] | [Google Cloud Docs][storage_2]

## Example Apps

- nodejs-getting-started - [Source code][nodejs_1] | [App Engine Tutorial 1][nodejs_2] | [App Engine Tutorial 2][nodejs_3]
- gcloud-node-todos - [Source code][todos_1]
- gitnpm - [Source code][gitnpm_1]
- gcloud-kvstore - [Source code][kvstore_1]

## More information

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

## Contributing changes

* See [CONTRIBUTING.md](CONTRIBUTING.md)
Contributions welcome!

See [CONTRIBUTING.md](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md)

## Licensing

* See [LICENSE](LICENSE)
Apache Version 2.0

See [LICENSE](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/LICENSE)

[storage_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/storage/authSample.js
[storage_2]: https://cloud.google.com/storage/docs/authentication#acd-examples

[express_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/express
[express_2]: https://cloud.google.com/nodejs/resources/frameworks/express
[express_3]: http://express-dot-nodejs-docs-samples.appspot.com
[express_4]: http://expressjs.com/

[geddy_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/geddy
[geddy_2]: https://cloud.google.com/nodejs/resources/frameworks/geddy
[geddy_3]: http://geddy-dot-nodejs-docs-samples.appspot.com
[geddy_4]: http://geddyjs.org/

[hapi_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/hapi
[hapi_2]: https://cloud.google.com/nodejs/resources/frameworks/hapi
[hapi_3]: http://hapi-dot-nodejs-docs-samples.appspot.com
[hapi_4]: http://hapijs.com/

[loopback_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/loopback
[loopback_2]: https://cloud.google.com/nodejs/resources/frameworks/loopback
[loopback_3]: http://loopback-dot-nodejs-docs-samples.appspot.com
[loopback_4]: http://loopback.io/

[koa_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/koa
[koa_2]: https://cloud.google.com/nodejs/resources/frameworks/koa
[koa_3]: http://koa-dot-nodejs-docs-samples.appspot.com
[koa_4]: http://koajs.com/

[kraken_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/kraken
[kraken_2]: https://cloud.google.com/nodejs/resources/frameworks/kraken
[kraken_3]: http://kraken-dot-nodejs-docs-samples.appspot.com
[kraken_4]: http://krakenjs.com/

[restify_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/restify
[restify_2]: https://cloud.google.com/nodejs/resources/frameworks/restify
[restify_3]: http://restify-dot-nodejs-docs-samples.appspot.com
[restify_4]: http://restify.com/

[sails_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/sails
[sails_2]: https://cloud.google.com/nodejs/resources/frameworks/sails
[sails_3]: http://sails-dot-nodejs-docs-samples.appspot.com
[sails_4]: http://sailsjs.org/

[redis_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/redis
[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis
[redis_3]: http://redis.io/

[gcloud_1]: https://github.com/GoogleCloudPlatform/gcloud-node
[gcloud_2]: https://googlecloudplatform.github.io/gcloud-node/#/

[grunt_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/grunt
[grunt_2]: https://cloud.google.com/nodejs/resources/tools/grunt
[grunt_3]: http://grunt-dot-nodejs-docs-samples.appspot.com
[grunt_4]: http://gruntjs.com/

[mailgun_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/mailgun
[mailgun_2]: https://cloud.google.com/nodejs/resources/tools/mailgun
[mailgun_3]: http://www.mailgun.com/

[nodejs_1]: https://github.com/GoogleCloudPlatform/nodejs-getting-started
[nodejs_2]: https://cloud.google.com/nodejs/getting-started/hello-world
[nodejs_3]: https://cloud.google.com/nodejs/getting-started/tutorial-app

[todos_1]: https://github.com/GoogleCloudPlatform/gcloud-node-todos

[gitnpm_1]: https://github.com/stephenplusplus/gitnpm

[kvstore_1]: https://github.com/stephenplusplus/gcloud-kvstore
29 changes: 0 additions & 29 deletions appengine/README.md

This file was deleted.

48 changes: 9 additions & 39 deletions appengine/express/README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,13 @@
## Express on Google App Engine
## Express.js on Google App Engine

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

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

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

View the [Express app generator guide](http://expressjs.com/starter/generator.html).

### Configure

Create an `app.yaml` in the root of your application with the following
contents:

```yaml
runtime: nodejs
vm: true
api_version: 1
env_variables:
PORT: 8080
```
### Deploy
For convenience, you can use an npm script to run the `gcloud` command. Add
these lines to your `package.json` file:

```json
"scripts": {
"start": "node ./bin/www",
"deploy": "gcloud preview app deploy app.yaml --promote --project <your-project-id>"
}
```

At the terminal you can now run the following command to deploy your
application:

```
$ npm deploy
```
[1]: http://expressjs.com/
[2]: https://cloud.google.com/nodejs/resources/frameworks/express
[3]: http://express-dot-nodejs-docs-samples.appspot.com
1 change: 0 additions & 1 deletion appengine/express/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# [START app_yaml]
runtime: nodejs
vm: true
api_version: 1
env_variables:
PORT: 8080
# [END app_yaml]
2 changes: 1 addition & 1 deletion appengine/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"start": "node ./bin/www",
"deploy": "gcloud preview app deploy app.yaml --promote --project express-demo"
"deploy": "gcloud preview app deploy app.yaml"
},
"dependencies": {
"body-parser": "^1.14.1",
Expand Down
Loading

0 comments on commit 903d495

Please sign in to comment.