Skip to content

Commit

Permalink
Added Node.js simple example workflow
Browse files Browse the repository at this point in the history
updated with smarterclayton feedback

Updated for official repo
  • Loading branch information
sspeiche committed Apr 24, 2015
1 parent b935023 commit 035a294
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ available on top of Kubernetes and Docker.
* [Hello OpenShift](./hello-openshift) is a simple Hello World style application that can be used to start a simple pod
* [OpenShift Sample](./sample-app) is an end-to-end application demonstrating the full
OpenShift v3 concept chain - images, builds, deployments, and templates.
* [Node.js echo Sample](./nodejs-echo) highlights the simple workflow from creating project, new app from GitHub, building, deploying, running and updating.
54 changes: 54 additions & 0 deletions examples/nodejs-echo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Node.js `echo` Service on OpenShift!
-----------------

This example will serve an http response of various "machine" stats from the "machine" the Node.js app is running on to [http://host:8080](http://host:8080).

### OpenShift setup ###

I just used the Docker all-in-one launch as described in the [origins project](https://github.com/openshift/origins).

### The project ###

If you don't have a project setup all ready, go ahead and take care of that

$ osc new-project nodejs-echo --display-name="nodejs-echo" --description="Sample Node.js app"

That's it, project has been created. Though it would probably be good to set your current project to this, such as:

$ osc project nodejs-echo

### The app ###

Now let's pull in the app source code from [GitHub repo](https://github.com/openshift/nodejs-example) (fork if you like)

#### create ####

$ osc new-app https://github.com/openshift/nodejs-example
That should be it, `new-app` will take care of creating the right build configuration, deployment configuration and service definition. Next you'll be able to kick off the build.

Note, you can follow along with the web console (located at https://ip-address:8443/console) to see what new resources have been created and watch the progress of the build and deployment.

#### build ####

$ osc start-build nodejs-echo --follow

You can alternatively leave off `--follow` and use `osc build-logs nodejs-echo-n` where n is the number of the build (output of start-build).

#### deploy ####

happens automatically, to monitor its status either watch the web console or `osc get pods` to see when the pod is up. Another helpful command is

$ osc status

This will help indicate what IP address the service is running, the default port for it to deploy at is 8080.

#### enjoy ####

Run/test our app by simply doing an HTTP GET request

$ curl ip-address:8080

#### update ####

Assuming you used the URL of your own forked report, we can easily push changes to that hosted repo and simply repeat the steps above to build (this is obviously just demonstrating the manually kicking off of builds) which will trigger the new built image to be deployed.

0 comments on commit 035a294

Please sign in to comment.