Slide 1

Slide 1 text

Deploying a Full Stack Node.js Application to IBM Bluemix IBM Bluemix Webinar Tuesday, June 16, 2015 Bradley Holt, Developer Advocate @BradleyHolt

Slide 2

Slide 2 text

Location Tracker •  Stores data locally in PouchDB •  Front end built with AngularJS •  Authentication logic built with Node.js •  User interface built with Leaflet •  Replicates location data to Cloudant •  More info: https://cloudant.com/location-tracker/ 2

Slide 3

Slide 3 text

3 Location Tracker Part 3: https://cloudant.com/location-tracker/

Slide 4

Slide 4 text

Deploying Manually

Slide 5

Slide 5 text

Clone from GitHub 5 $ git clone https://github.com/cloudant-labs/location-tracker-nodejs.git
 
 $ cd location-tracker-nodejs"

Slide 6

Slide 6 text

Sign up for IBM Bluemix •  Deploy with one command •  Based on Cloud Foundry •  Sign up at: https://bluemix.net/ 6

Slide 7

Slide 7 text

Install the Cloud Foundry CLI 7 •  Allows you to deploy and modify applications and service instances •  Set up instructions available at: https://www.ng.bluemix.net/docs/#starters/install_cli.html •  Installers and binaries for Debian, Red Hat, Mac OS X, Windows, and other Linux systems available at: https://github.com/cloudfoundry/cli/releases

Slide 8

Slide 8 text

Configure the Cloud Foundry CLI 8 1.  Connect to Bluemix using the cf api command. For example: $ cf api https://api.ng.bluemix.net" 2.  Log in to Bluemix using the cf login command. For example: $ cf login -u [email protected] -o [email protected] -s myspace" 3.  Don't deploy to Bluemix quite yet!

Slide 9

Slide 9 text

Create a Cloudant Service 9 $ cf create-service cloudantNoSQLDB Shared cloudant-location-tracker-db"

Slide 10

Slide 10 text

10

Slide 11

Slide 11 text

11

Slide 12

Slide 12 text

12

Slide 13

Slide 13 text

13

Slide 14

Slide 14 text

IBM Cloudant •  Globally distributed data layer for web and mobile applications •  MongoDB-style queries •  Advanced geospatial capabilities •  Full text search indexing 14

Slide 15

Slide 15 text

JSON Documents 15 {
 _id: "6EF9D2B0-13D3-1378-8D30-39E3CE0B36C2",
 _rev: "1-0b457efcf82fb29492ef927ba5b6ee15",
 type: "Feature",
 geometry: {
 type: "Point",
 coordinates: [
 -71.1028,
 42.3691
 ]
 },
 properties: {
 session_id: "3486b13f-7b8a-8a96-dfbf-9b82800e367f",
 timestamp: 1422928591717
 }
 }

Slide 16

Slide 16 text

Deploy! 16 $ cf push"

Slide 17

Slide 17 text

17

Slide 18

Slide 18 text

18

Slide 19

Slide 19 text

How it Works

Slide 20

Slide 20 text

20

Slide 21

Slide 21 text

Location Tracker Files 21

Slide 22

Slide 22 text

The Application Manifest (manifest.yml) 22

Slide 23

Slide 23 text

Node.js Buildpack •  Builds the application by installing the npm dependencies declared in package.json" •  Executes any scripts declared in package.json" •  Provides a Node.js runtime environment in which to start your application 23

Slide 24

Slide 24 text

Deploy Scripts (package.json) 24

Slide 25

Slide 25 text

The Procfile (Procfile) 25

Slide 26

Slide 26 text

Configuration 26

Slide 27

Slide 27 text

Further Reading •  Location Tracker https://cloudant.com/location-tracker/ •  Cloudant Node.js library https://github.com/cloudant/nodejs-cloudant •  PouchDB http://pouchdb.com/ •  Webinar: Integrate User Management and Cloudant Query into a Node.js/ Cloudant Application https://cloudant.com/resources/webinars/ 27

Slide 28

Slide 28 text

Bradley Holt Developer Advocate [email protected] @BradleyHolt github.com/bradley-holt