From 9a913714c753551667d257a28c2718b1390851ad Mon Sep 17 00:00:00 2001 From: Ben Parees Date: Tue, 23 May 2017 15:53:51 -0400 Subject: [PATCH 01/24] Revert "Revert "Changed templates to use nodejs:6"" --- openshift/templates/nodejs-mongodb-persistent.json | 2 +- openshift/templates/nodejs-mongodb.json | 2 +- openshift/templates/nodejs.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index c570ca5..0d1b5ad 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -102,7 +102,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "nodejs:4" + "name": "nodejs:6" }, "env": [ { diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 161f158..36b646c 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -102,7 +102,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "nodejs:4" + "name": "nodejs:6" }, "env": [ { diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index 47951d3..462d169 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -89,7 +89,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "nodejs:4" + "name": "nodejs:6" }, "env": [ { From 5d9081445f584b56b8ff9ba36bd5983457d7de9d Mon Sep 17 00:00:00 2001 From: Jim Minter Date: Tue, 13 Jun 2017 12:49:00 +0100 Subject: [PATCH 02/24] update templates to use template.openshift.io/expose-uri --- openshift/templates/nodejs-mongodb-persistent.json | 5 ++++- openshift/templates/nodejs-mongodb.json | 5 ++++- openshift/templates/nodejs.json | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index 0d1b5ad..1673708 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -58,7 +58,10 @@ "kind": "Route", "apiVersion": "v1", "metadata": { - "name": "${NAME}" + "name": "${NAME}", + "annotations": { + "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" + } }, "spec": { "host": "${APPLICATION_DOMAIN}", diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 36b646c..214c110 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -58,7 +58,10 @@ "kind": "Route", "apiVersion": "v1", "metadata": { - "name": "${NAME}" + "name": "${NAME}", + "annotations": { + "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" + } }, "spec": { "host": "${APPLICATION_DOMAIN}", diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index 462d169..9599e42 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -45,7 +45,10 @@ "kind": "Route", "apiVersion": "v1", "metadata": { - "name": "${NAME}" + "name": "${NAME}", + "annotations": { + "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" + } }, "spec": { "host": "${APPLICATION_DOMAIN}", From 1a31042c813617d5b1f844bc3b3c67c6d9bd01e3 Mon Sep 17 00:00:00 2001 From: Corey Daley Date: Sun, 25 Jun 2017 23:08:48 -0400 Subject: [PATCH 03/24] Updating GITHUB_WEBHOOK_SECRET description --- openshift/templates/nodejs-mongodb-persistent.json | 2 +- openshift/templates/nodejs-mongodb.json | 2 +- openshift/templates/nodejs.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index fecb846..031fa53 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -487,7 +487,7 @@ { "name": "GITHUB_WEBHOOK_SECRET", "displayName": "GitHub Webhook Secret", - "description": "A secret string used to configure the GitHub webhook.", + "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", "generate": "expression", "from": "[a-zA-Z0-9]{40}" }, diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 6a55f02..ecffe1d 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -463,7 +463,7 @@ { "name": "GITHUB_WEBHOOK_SECRET", "displayName": "GitHub Webhook Secret", - "description": "A secret string used to configure the GitHub webhook.", + "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", "generate": "expression", "from": "[a-zA-Z0-9]{40}" }, diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index 297c815..4816e00 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -261,7 +261,7 @@ { "name": "GITHUB_WEBHOOK_SECRET", "displayName": "GitHub Webhook Secret", - "description": "A secret string used to configure the GitHub webhook.", + "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", "generate": "expression", "from": "[a-zA-Z0-9]{40}" }, From 324865499e4ab83a7c50f7347dd3d470036ad182 Mon Sep 17 00:00:00 2001 From: Corey Daley Date: Fri, 4 Aug 2017 11:17:33 -0400 Subject: [PATCH 04/24] Adding compatibility section --- README.md | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6d0bb80..8e8223c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,33 @@ -Node.js sample app on OpenShift! + + + + +- [Node.js sample app on OpenShift!](#nodejs-sample-app-on-openshift) + * [OpenShift Origin v3 setup](#openshift-origin-v3-setup) + + [Running a virtual machine with Vagrant](#running-a-virtual-machine-with-vagrant) + + [Starting a Docker container](#starting-a-docker-container) + + [Downloading the Binary](#downloading-the-binary) + + [Running an Ansible playbook](#running-an-ansible-playbook) + * [Creating a project](#creating-a-project) + * [Creating new apps](#creating-new-apps) + + [Create a new app from source code (method 1)](#create-a-new-app-from-source-code-method-1) + + [Create a new app from a template (method 2)](#create-a-new-app-from-a-template-method-2) + + [Build the app](#build-the-app) + + [Deploy the app](#deploy-the-app) + + [Configure routing](#configure-routing) + + [Create a new app from an image (method 3)](#create-a-new-app-from-an-image-method-3) + + [Setting environment variables](#setting-environment-variables) + + [Success](#success) + + [Pushing updates](#pushing-updates) + * [Debugging](#debugging) + * [Web UI](#web-ui) + * [Looking for help](#looking-for-help) + * [Compatibility](#compatibility) + * [License](#license) + + + +## Node.js sample app on OpenShift! ----------------- This example will serve a welcome page and the current hit count as stored in a database. @@ -205,11 +234,14 @@ To run this example from the Web UI, you can same steps following done on the CL OpenShift 3: Node.js Sample -## Looking for help +### Looking for help If you get stuck at some point, or think that this document needs further details or clarification, you can give feedback and look for help using the channels mentioned in [the OpenShift Origin repo](https://github.com/openshift/origin), or by filing an issue. +### Compatibility -## License +This repository is compatible with Node.js 4 and higher, excluding any alpha or beta versions. + +### License This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to [CC0](http://creativecommons.org/publicdomain/zero/1.0/). From 5ffcf0a43c25130745cae8411090b32449e2321f Mon Sep 17 00:00:00 2001 From: Jim Minter Date: Fri, 11 Aug 2017 11:38:32 -0500 Subject: [PATCH 05/24] add template completion detection --- openshift/templates/nodejs-mongodb-persistent.json | 6 ++++-- openshift/templates/nodejs-mongodb.json | 6 ++++-- openshift/templates/nodejs.json | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index a9c3653..df3704b 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -87,7 +87,8 @@ "metadata": { "name": "${NAME}", "annotations": { - "description": "Defines how to build the application" + "description": "Defines how to build the application", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { @@ -152,7 +153,8 @@ "metadata": { "name": "${NAME}", "annotations": { - "description": "Defines how to deploy the application server" + "description": "Defines how to deploy the application server", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 53a6147..eb6ab33 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -87,7 +87,8 @@ "metadata": { "name": "${NAME}", "annotations": { - "description": "Defines how to build the application" + "description": "Defines how to build the application", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { @@ -152,7 +153,8 @@ "metadata": { "name": "${NAME}", "annotations": { - "description": "Defines how to deploy the application server" + "description": "Defines how to deploy the application server", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index e53b85d..b674cf2 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -74,7 +74,8 @@ "metadata": { "name": "${NAME}", "annotations": { - "description": "Defines how to build the application" + "description": "Defines how to build the application", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { @@ -139,7 +140,8 @@ "metadata": { "name": "${NAME}", "annotations": { - "description": "Defines how to deploy the application server" + "description": "Defines how to deploy the application server", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { From 5647b2a31ce6aa31b354980cbfcab3af8fccbca8 Mon Sep 17 00:00:00 2001 From: Jim Minter Date: Fri, 18 Aug 2017 12:14:14 -0500 Subject: [PATCH 06/24] add missing template.alpha.openshift.io/wait-for-ready annotations to examples --- openshift/templates/nodejs-mongodb-persistent.json | 3 ++- openshift/templates/nodejs-mongodb.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index df3704b..8bc3015 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -309,7 +309,8 @@ "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { - "description": "Defines how to deploy the database" + "description": "Defines how to deploy the database", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index eb6ab33..3df47d6 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -292,7 +292,8 @@ "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { - "description": "Defines how to deploy the database" + "description": "Defines how to deploy the database", + "template.alpha.openshift.io/wait-for-ready": "true" } }, "spec": { From 08397daddde971bbae27b54e7bfdc35f874df051 Mon Sep 17 00:00:00 2001 From: mordicool Date: Sat, 2 Sep 2017 21:37:58 +0300 Subject: [PATCH 07/24] Update server.js --- server.js | 1 - 1 file changed, 1 deletion(-) diff --git a/server.js b/server.js index 36dc199..b828a81 100644 --- a/server.js +++ b/server.js @@ -2,7 +2,6 @@ var express = require('express'), fs = require('fs'), app = express(), - eps = require('ejs'), morgan = require('morgan'); Object.assign=require('object-assign') From 64c46cb6ee84d6cdb7e96f54bb7a1b7362bff107 Mon Sep 17 00:00:00 2001 From: Mordechai Weinberg Date: Sun, 3 Sep 2017 21:44:36 +0300 Subject: [PATCH 08/24] Update server.js No need for fs module here --- server.js | 1 - 1 file changed, 1 deletion(-) diff --git a/server.js b/server.js index b828a81..0415948 100644 --- a/server.js +++ b/server.js @@ -1,6 +1,5 @@ // OpenShift sample Node application var express = require('express'), - fs = require('fs'), app = express(), morgan = require('morgan'); From d6a27c221f53258b79a7ae61a09c7bc0aa0c8f56 Mon Sep 17 00:00:00 2001 From: Jim Minter Date: Tue, 12 Sep 2017 16:17:41 -0500 Subject: [PATCH 09/24] add basic helm chart --- helm/nodejs/Chart.yaml | 9 ++++ helm/nodejs/templates/NOTES.txt | 3 ++ helm/nodejs/templates/buildconfig.yaml | 38 ++++++++++++++++ helm/nodejs/templates/deploymentconfig.yaml | 49 +++++++++++++++++++++ helm/nodejs/templates/imagestream.yaml | 6 +++ helm/nodejs/templates/route.yaml | 9 ++++ helm/nodejs/templates/service.yaml | 13 ++++++ helm/nodejs/values.yaml | 20 +++++++++ 8 files changed, 147 insertions(+) create mode 100755 helm/nodejs/Chart.yaml create mode 100644 helm/nodejs/templates/NOTES.txt create mode 100755 helm/nodejs/templates/buildconfig.yaml create mode 100755 helm/nodejs/templates/deploymentconfig.yaml create mode 100755 helm/nodejs/templates/imagestream.yaml create mode 100644 helm/nodejs/templates/route.yaml create mode 100755 helm/nodejs/templates/service.yaml create mode 100644 helm/nodejs/values.yaml diff --git a/helm/nodejs/Chart.yaml b/helm/nodejs/Chart.yaml new file mode 100755 index 0000000..18c8d40 --- /dev/null +++ b/helm/nodejs/Chart.yaml @@ -0,0 +1,9 @@ +name: nodejs +version: 0.1 +description: An example Node.js application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md. +keywords: +- quickstart +- nodejs +home: https://access.redhat.com +sources: +- https://github.com/openshift/nodejs-ex diff --git a/helm/nodejs/templates/NOTES.txt b/helm/nodejs/templates/NOTES.txt new file mode 100644 index 0000000..94c70dd --- /dev/null +++ b/helm/nodejs/templates/NOTES.txt @@ -0,0 +1,3 @@ +The following service(s) have been created in your project: {{ .Values.name }}. + +For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md. diff --git a/helm/nodejs/templates/buildconfig.yaml b/helm/nodejs/templates/buildconfig.yaml new file mode 100755 index 0000000..2153999 --- /dev/null +++ b/helm/nodejs/templates/buildconfig.yaml @@ -0,0 +1,38 @@ +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: {{ .Values.name | quote }} + annotations: + description: Defines how to build the application +spec: + source: + type: Git + git: + uri: {{ .Values.source_repository_url | quote }} + ref: {{ .Values.source_repository_ref | quote }} + contextDir: {{ .Values.context_dir | quote }} + strategy: + type: Source + sourceStrategy: + from: + kind: ImageStreamTag + namespace: {{ .Values.namespace | quote }} + name: nodejs:6 + env: + - name: NPM_MIRROR + value: {{ .Values.npm_mirror | quote }} + output: + to: + kind: ImageStreamTag + name: {{ print .Values.name ":latest" | quote }} + triggers: + - type: ImageChange + - type: ConfigChange + - type: GitHub + github: + secret: {{ .Values.github_webhook_secret | default (randAlphaNum 40) | quote }} + - type: Generic + generic: + secret: {{ .Values.generic_webhook_secret | default (randAlphaNum 40) | quote }} + postCommit: + script: npm test diff --git a/helm/nodejs/templates/deploymentconfig.yaml b/helm/nodejs/templates/deploymentconfig.yaml new file mode 100755 index 0000000..6380bff --- /dev/null +++ b/helm/nodejs/templates/deploymentconfig.yaml @@ -0,0 +1,49 @@ +kind: DeploymentConfig +apiVersion: apps.openshift.io/v1 +metadata: + name: {{ .Values.name | quote }} + annotations: + description: Defines how to deploy the application server + template.alpha.openshift.io/wait-for-ready: 'true' +spec: + strategy: + type: Rolling + triggers: + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - nodejs-example + from: + kind: ImageStreamTag + name: {{ print .Values.name ":latest" | quote }} + - type: ConfigChange + replicas: 1 + selector: + name: {{ .Values.name | quote }} + template: + metadata: + name: {{ .Values.name | quote }} + labels: + name: {{ .Values.name | quote }} + spec: + containers: + - name: nodejs-example + image: " " + ports: + - containerPort: 8080 + readinessProbe: + timeoutSeconds: 3 + initialDelaySeconds: 3 + httpGet: + path: "/" + port: 8080 + livenessProbe: + timeoutSeconds: 3 + initialDelaySeconds: 30 + httpGet: + path: "/" + port: 8080 + resources: + limits: + memory: {{ .Values.memory_limit | quote }} diff --git a/helm/nodejs/templates/imagestream.yaml b/helm/nodejs/templates/imagestream.yaml new file mode 100755 index 0000000..2252dc5 --- /dev/null +++ b/helm/nodejs/templates/imagestream.yaml @@ -0,0 +1,6 @@ +kind: ImageStream +apiVersion: image.openshift.io/v1 +metadata: + name: {{ .Values.name | quote }} + annotations: + description: Keeps track of changes in the application image diff --git a/helm/nodejs/templates/route.yaml b/helm/nodejs/templates/route.yaml new file mode 100644 index 0000000..eeb16ca --- /dev/null +++ b/helm/nodejs/templates/route.yaml @@ -0,0 +1,9 @@ +kind: Route +apiVersion: route.openshift.io/v1 +metadata: + name: {{ .Values.name | quote }} +spec: + host: {{ .Values.application_domain | quote }} + to: + kind: Service + name: {{ .Values.name | quote }} diff --git a/helm/nodejs/templates/service.yaml b/helm/nodejs/templates/service.yaml new file mode 100755 index 0000000..cfcc8ca --- /dev/null +++ b/helm/nodejs/templates/service.yaml @@ -0,0 +1,13 @@ +kind: Service +apiVersion: v1 +metadata: + name: {{ .Values.name | quote }} + annotations: + description: Exposes and load balances the application pods +spec: + ports: + - name: web + port: 8080 + targetPort: 8080 + selector: + name: {{ .Values.name | quote }} diff --git a/helm/nodejs/values.yaml b/helm/nodejs/values.yaml new file mode 100644 index 0000000..2a2509c --- /dev/null +++ b/helm/nodejs/values.yaml @@ -0,0 +1,20 @@ +# Name: The name assigned to all of the frontend objects defined in this template. +name: nodejs-example +# Namespace: The OpenShift Namespace where the ImageStream resides. +namespace: openshift +# Memory Limit: Maximum amount of memory the container can use. +memory_limit: 512Mi +# Git Repository URL: The URL of the repository with your application source code. +source_repository_url: https://github.com/openshift/nodejs-ex.git +# Git Reference: Set this to a branch name, tag or other ref of your repository if you are not using the default branch. +source_repository_ref: +# Context Directory: Set this to the relative path to your project if it is not in the root of your repository. +context_dir: +# Application Hostname: The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted. +application_domain: +# GitHub Webhook Secret: Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted. +github_webhook_secret: +# Generic Webhook Secret: A secret string used to configure the Generic webhook. +generic_webhook_secret: +# Custom NPM Mirror URL: The custom NPM mirror URL +npm_mirror: From 8ac25c1e3cdfb58dee6086bf4dda731e9de83cce Mon Sep 17 00:00:00 2001 From: Ben Parees Date: Thu, 19 Oct 2017 14:42:43 +0200 Subject: [PATCH 10/24] remove template prefix from tsb annotations --- openshift/templates/nodejs-mongodb-persistent.json | 8 ++++---- openshift/templates/nodejs-mongodb.json | 8 ++++---- openshift/templates/nodejs.json | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index 8bc3015..9543b56 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -8,10 +8,10 @@ "description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", "tags": "quickstart,nodejs", "iconClass": "icon-nodejs", - "template.openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration.", - "template.openshift.io/provider-display-name": "Red Hat, Inc.", - "template.openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", - "template.openshift.io/support-url": "https://access.redhat.com" + "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration.", + "openshift.io/provider-display-name": "Red Hat, Inc.", + "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", + "openshift.io/support-url": "https://access.redhat.com" } }, "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 3df47d6..0649d62 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -8,10 +8,10 @@ "description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.", "tags": "quickstart,nodejs", "iconClass": "icon-nodejs", - "template.openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration. The database is stored in non-persistent storage, so this configuration should be used for experimental purposes only.", - "template.openshift.io/provider-display-name": "Red Hat, Inc.", - "template.openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", - "template.openshift.io/support-url": "https://access.redhat.com" + "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration. The database is stored in non-persistent storage, so this configuration should be used for experimental purposes only.", + "openshift.io/provider-display-name": "Red Hat, Inc.", + "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", + "openshift.io/support-url": "https://access.redhat.com" } }, "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index b674cf2..eb922c6 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -8,10 +8,10 @@ "description": "An example Node.js application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", "tags": "quickstart,nodejs", "iconClass": "icon-nodejs", - "template.openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration and application deployment configuration. It does not include a database.", - "template.openshift.io/provider-display-name": "Red Hat, Inc.", - "template.openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", - "template.openshift.io/support-url": "https://access.redhat.com" + "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration and application deployment configuration. It does not include a database.", + "openshift.io/provider-display-name": "Red Hat, Inc.", + "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", + "openshift.io/support-url": "https://access.redhat.com" } }, "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", From b84f207d3d06a0dad06a5cb1d0ca618c7716fb37 Mon Sep 17 00:00:00 2001 From: Jim Minter Date: Tue, 7 Nov 2017 13:03:41 -0600 Subject: [PATCH 11/24] remove expose annotations from quickstarts and add bindable: false --- openshift/templates/nodejs-mongodb-persistent.json | 8 +++----- openshift/templates/nodejs-mongodb.json | 8 +++----- openshift/templates/nodejs.json | 8 +++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index 9543b56..7f2a5d8 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -11,7 +11,8 @@ "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration.", "openshift.io/provider-display-name": "Red Hat, Inc.", "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", - "openshift.io/support-url": "https://access.redhat.com" + "openshift.io/support-url": "https://access.redhat.com", + "template.openshift.io/bindable": "false" } }, "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", @@ -58,10 +59,7 @@ "kind": "Route", "apiVersion": "v1", "metadata": { - "name": "${NAME}", - "annotations": { - "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" - } + "name": "${NAME}" }, "spec": { "host": "${APPLICATION_DOMAIN}", diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 0649d62..b3afae4 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -11,7 +11,8 @@ "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration. The database is stored in non-persistent storage, so this configuration should be used for experimental purposes only.", "openshift.io/provider-display-name": "Red Hat, Inc.", "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", - "openshift.io/support-url": "https://access.redhat.com" + "openshift.io/support-url": "https://access.redhat.com", + "template.openshift.io/bindable": "false" } }, "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", @@ -58,10 +59,7 @@ "kind": "Route", "apiVersion": "v1", "metadata": { - "name": "${NAME}", - "annotations": { - "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" - } + "name": "${NAME}" }, "spec": { "host": "${APPLICATION_DOMAIN}", diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index eb922c6..8da9851 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -11,7 +11,8 @@ "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration and application deployment configuration. It does not include a database.", "openshift.io/provider-display-name": "Red Hat, Inc.", "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", - "openshift.io/support-url": "https://access.redhat.com" + "openshift.io/support-url": "https://access.redhat.com", + "template.openshift.io/bindable": "false" } }, "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", @@ -45,10 +46,7 @@ "kind": "Route", "apiVersion": "v1", "metadata": { - "name": "${NAME}", - "annotations": { - "template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}" - } + "name": "${NAME}" }, "spec": { "host": "${APPLICATION_DOMAIN}", From 4759b1bf2ded1f94e0d9ab310f2c6cfd4ca0cbc2 Mon Sep 17 00:00:00 2001 From: gabemontero Date: Thu, 9 Nov 2017 11:10:12 -0500 Subject: [PATCH 12/24] add template 'app' label --- openshift/templates/nodejs-mongodb.json | 3 ++- openshift/templates/nodejs.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 6ab4a17..7d98f48 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -10,7 +10,8 @@ } }, "labels": { - "template": "nodejs-mongodb-example" + "template": "nodejs-mongodb-example", + "app": "nodejs-mongodb-example" }, "objects": [ { diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index ec262e4..2b8cdc1 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -10,7 +10,8 @@ } }, "labels": { - "template": "nodejs-example" + "template": "nodejs-example", + "app": "nodejs-example" }, "objects": [ { From c8e18b759c0deea29671ce5e92e00e21071b24b4 Mon Sep 17 00:00:00 2001 From: Jim Minter Date: Wed, 6 Dec 2017 18:59:42 -0600 Subject: [PATCH 13/24] add debug if error happens in count() --- server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.js b/server.js index 0415948..d2352be 100644 --- a/server.js +++ b/server.js @@ -67,6 +67,9 @@ app.get('/', function (req, res) { // Create a document with request IP and current time of request col.insert({ip: req.ip, date: Date.now()}); col.count(function(err, count){ + if (err) { + console.log('Error running count. Message:\n'+err); + } res.render('index.html', { pageCountMessage : count, dbInfo: dbDetails }); }); } else { From e79d273ea5ed2a211dd0e39c36b5c3379704de8d Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Fri, 5 Jan 2018 22:39:15 +0100 Subject: [PATCH 14/24] Remove ' (Persistent)' https://github.com/openshift/origin/pull/17922#pullrequestreview-86940496 --- openshift/templates/nodejs-mongodb-persistent.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index 7f2a5d8..787f513 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -4,7 +4,7 @@ "metadata": { "name": "nodejs-mongo-persistent", "annotations": { - "openshift.io/display-name": "Node.js + MongoDB (Persistent)", + "openshift.io/display-name": "Node.js + MongoDB", "description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", "tags": "quickstart,nodejs", "iconClass": "icon-nodejs", From e8d39a4936a93d1b42170b4bb282d3913312b95a Mon Sep 17 00:00:00 2001 From: Ali Ok Date: Fri, 12 Jan 2018 13:35:25 +0300 Subject: [PATCH 15/24] Fix invalid JSON in template: nodejs.json Got rid of a duplicate key --- openshift/templates/nodejs.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index d33f6a2..ea307ae 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -208,12 +208,7 @@ } }, "env": [ - ], - "resources": { - "limits": { - "memory": "${MEMORY_LIMIT}" - } - } + ] } ] } From dd9d5afa3b99d8bffab20fed0ec81b7e52de4348 Mon Sep 17 00:00:00 2001 From: Dharmit Shah Date: Tue, 6 Mar 2018 23:55:13 +0530 Subject: [PATCH 16/24] Add documentation about using minishif --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8e8223c..dc496f7 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ - [Node.js sample app on OpenShift!](#nodejs-sample-app-on-openshift) * [OpenShift Origin v3 setup](#openshift-origin-v3-setup) + [Running a virtual machine with Vagrant](#running-a-virtual-machine-with-vagrant) + + [Running a virtual machine managed by minishift](#running-a-virtual-machine-managed-by-minishift) + [Starting a Docker container](#starting-a-docker-container) + [Downloading the Binary](#downloading-the-binary) + [Running an Ansible playbook](#running-an-ansible-playbook) @@ -37,6 +38,7 @@ This example will serve a welcome page and the current hit count as stored in a There are four methods to get started with OpenShift v3: - Running a virtual machine with Vagrant + - Running a virtual machine managed by minishift - Starting a Docker container - Downloading the binary - Running an Ansible playbook @@ -45,6 +47,10 @@ There are four methods to get started with OpenShift v3: One option is to use the Vagrant all-in-one launch as described in the [OpenShift Origin All-In-One Virtual Machine](https://www.openshift.org/vm/). This option works on Mac, Windows and Linux, but requires that you install [Vagrant](https://www.vagrantup.com/downloads.html) running [VirtualBox](https://www.virtualbox.org/wiki/Downloads). +#### Running a virtual machine managed by minishift + +Another option to run virtual machine but not having to using Vagrant is to download and use the `minishift` binary as described in its [getting started](https://github.com/minishift/minishift/#getting-started) section. `minishift` can be used to spin up a VM on any of Windows, Linux or Mac with the help of supported underlying virtualization technologies like KVM, xhyve, Hyper-V, VirtualBox. + #### Starting a Docker container Another option is running the OpenShift Origin Docker container image from [Docker Hub](https://hub.docker.com/r/openshift/origin/) launch as described in the [Getting Started for Administrators](https://docs.openshift.org/latest/getting_started/administrators.html#running-in-a-docker-container). This method is supported on Fedora, CentOS, and Red Hat Enterprise Linux (RHEL) hosts only. From d416548286d9d518a1667264a7d4b861b603bcc5 Mon Sep 17 00:00:00 2001 From: Ben Parees Date: Thu, 26 Apr 2018 13:59:59 -0400 Subject: [PATCH 17/24] parameterize imagestreamtag refs in templates --- .../templates/nodejs-mongodb-persistent.json | 18 ++++++++++++++++-- openshift/templates/nodejs-mongodb.json | 18 ++++++++++++++++-- openshift/templates/nodejs.json | 9 ++++++++- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index 787f513..a9a7c35 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -104,7 +104,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "nodejs:6" + "name": "nodejs:${NODEJS_VERSION}" }, "env": [ { @@ -326,7 +326,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "mongodb:3.2" + "name": "mongodb:${MONGODB_VERSION}" } } }, @@ -448,6 +448,20 @@ "required": true, "value": "openshift" }, + { + "name": "NODEJS_VERSION", + "displayName": "Version of NodeJS Image", + "description": "Version of NodeJS image to be used (6, 8, or latest).", + "value": "8", + "required": true + }, + { + "name": "MONGODB_VERSION", + "displayName": "Version of MongoDB Image", + "description": "Version of MongoDB image to be used (3.2, 3.4, or latest).", + "value": "3.4", + "required": true + }, { "name": "MEMORY_LIMIT", "displayName": "Memory Limit", diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 0fcc540..416e82e 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -105,7 +105,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "nodejs:6" + "name": "nodejs:${NODEJS_VERSION}" }, "env": [ { @@ -310,7 +310,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "mongodb:3.2" + "name": "mongodb:${MONGODB_VERSION}" } } }, @@ -432,6 +432,20 @@ "required": true, "value": "openshift" }, + { + "name": "NODEJS_VERSION", + "displayName": "Version of NodeJS Image", + "description": "Version of NodeJS image to be used (6, 8, or latest).", + "value": "8", + "required": true + }, + { + "name": "MONGODB_VERSION", + "displayName": "Version of MongoDB Image", + "description": "Version of MongoDB image to be used (3.2, 3.4, or latest).", + "value": "3.4", + "required": true + }, { "name": "MEMORY_LIMIT", "displayName": "Memory Limit", diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index ea307ae..bfd7b6b 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -92,7 +92,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "nodejs:6" + "name": "nodejs:${NODEJS_VERSION}" }, "env": [ { @@ -231,6 +231,13 @@ "required": true, "value": "openshift" }, + { + "name": "NODEJS_VERSION", + "displayName": "Version of NodeJS Image", + "description": "Version of NodeJS image to be used (6, 8, or latest).", + "value": "8", + "required": true + }, { "name": "MEMORY_LIMIT", "displayName": "Memory Limit", From 003d0ac8d666adf38188451edf980da5fff947c5 Mon Sep 17 00:00:00 2001 From: Jan Wozniak Date: Wed, 2 May 2018 12:17:13 +0200 Subject: [PATCH 18/24] mongodb openshift template: generalize probes fixes: https://github.com/openshift/origin/issues/19379 --- openshift/templates/nodejs-mongodb-persistent.json | 4 ++-- openshift/templates/nodejs-mongodb.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index a9a7c35..9ffe375 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -239,7 +239,7 @@ "timeoutSeconds": 3, "initialDelaySeconds": 3, "httpGet": { - "path": "/pagecount", + "path": "/", "port": 8080 } }, @@ -247,7 +247,7 @@ "timeoutSeconds": 3, "initialDelaySeconds": 30, "httpGet": { - "path": "/pagecount", + "path": "/", "port": 8080 } }, diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index 416e82e..e2d70bf 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -240,7 +240,7 @@ "timeoutSeconds": 3, "initialDelaySeconds": 3, "httpGet": { - "path": "/pagecount", + "path": "/", "port": 8080 } }, @@ -248,7 +248,7 @@ "timeoutSeconds": 3, "initialDelaySeconds": 30, "httpGet": { - "path": "/pagecount", + "path": "/", "port": 8080 } }, From 0cb2d449359e48475b1d25201afd8266514a6f98 Mon Sep 17 00:00:00 2001 From: Gl4di4torRr Date: Tue, 26 Jun 2018 07:17:21 -0400 Subject: [PATCH 19/24] remove unnecessary $ from documentation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc496f7..2e67fb0 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Outlined as the [Advanced Installation](https://docs.openshift.org/latest/instal After logging in with `oc login` (default username/password: openshift), if you don't have a project setup all ready, go ahead and take care of that: $ oc new-project nodejs-echo \ - $ --display-name="nodejs" --description="Sample Node.js app" + --display-name="nodejs" --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 (thought new-project does it automatically as well), such as: @@ -179,7 +179,7 @@ Now navigate to the newly created Node.js web app at the hostname we just config You may have noticed the index page "Page view count" reads "No database configured". Let's fix that by adding a MongoDB service. We could use the second OpenShift template example (`nodejs-mongodb.json`) but for the sake of demonstration let's point `oc new-app` at a DockerHub image: $ oc new-app centos/mongodb-26-centos7 \ - $ -e MONGODB_USER=admin,MONGODB_DATABASE=mongo_db,MONGODB_PASSWORD=secret,MONGODB_ADMIN_PASSWORD=super-secret + -e MONGODB_USER=admin,MONGODB_DATABASE=mongo_db,MONGODB_PASSWORD=secret,MONGODB_ADMIN_PASSWORD=super-secret The `-e` flag sets the environment variables we want used in the configuration of our new app. From 9b0e5f153998860fd0eb010940c6cd9c9b41bd1c Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Tue, 24 Jul 2018 11:32:08 -0400 Subject: [PATCH 20/24] Rename github org references to sclorg Addresses openshift/origin##19998 --- README.md | 12 ++++++------ helm/nodejs/Chart.yaml | 4 ++-- helm/nodejs/templates/NOTES.txt | 2 +- helm/nodejs/values.yaml | 2 +- openshift/pipeline/README.md | 4 ++-- openshift/templates/nodejs-mongodb-persistent.json | 8 ++++---- openshift/templates/nodejs-mongodb.json | 8 ++++---- openshift/templates/nodejs.json | 8 ++++---- package.json | 6 +++--- views/index.html | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 2e67fb0..2979dd7 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ You can create a new OpenShift application using the web console or by running t Pointing `oc new-app` at source code kicks off a chain of events, for our example run: - $ oc new-app https://github.com/openshift/nodejs-ex -l name=myapp + $ oc new-app https://github.com/sclorg/nodejs-ex -l name=myapp The tool will inspect the source code, locate an appropriate image on DockerHub, create an ImageStream for that image, and then create the right build configuration, deployment configuration and service definition. @@ -95,9 +95,9 @@ The tool will inspect the source code, locate an appropriate image on DockerHub, #### Create a new app from a template (method 2) -We can also [create new apps using OpenShift template files](https://docs.openshift.com/enterprise/3.0/dev_guide/new_app.html#specifying-a-template). Clone the demo app source code from [GitHub repo](https://github.com/openshift/nodejs-ex) (fork if you like). +We can also [create new apps using OpenShift template files](https://docs.openshift.com/enterprise/3.0/dev_guide/new_app.html#specifying-a-template). Clone the demo app source code from [GitHub repo](https://github.com/sclorg/nodejs-ex) (fork if you like). - $ git clone https://github.com/openshift/nodejs-ex + $ git clone https://github.com/sclorg/nodejs-ex Looking at the repo, you'll notice three files in the openshift/template directory: @@ -133,7 +133,7 @@ Which should return something like: svc/nodejs-ex - 172.30.108.183:8080 dc/nodejs-ex deploys istag/nodejs-ex:latest <- - bc/nodejs-ex builds https://github.com/openshift/nodejs-ex with openshift/nodejs:0.10 + bc/nodejs-ex builds https://github.com/sclorg/nodejs-ex with openshift/nodejs:0.10 build #1 running for 7 seconds deployment #1 waiting on image or update @@ -193,7 +193,7 @@ Running `oc status` or checking the web console will reveal the address of the n http://10.2.2.2 to pod port 8080-tcp (svc/nodejs-ex) dc/nodejs-ex deploys istag/nodejs-ex:latest <- - bc/nodejs-ex builds https://github.com/openshift/nodejs-ex with openshift/nodejs:0.10 + bc/nodejs-ex builds https://github.com/sclorg/nodejs-ex with openshift/nodejs:0.10 deployment #1 deployed 14 minutes ago - 1 pod Note that the url for our new Mongo instance, for our example, is `172.30.0.112:27017`, yours will likely differ. @@ -216,7 +216,7 @@ Then check `oc status` to see that an updated deployment has been kicked off: http://10.2.2.2 to pod port 8080-tcp (svc/nodejs-ex) dc/nodejs-ex deploys istag/nodejs-ex:latest <- - bc/nodejs-ex builds https://github.com/openshift/nodejs-ex with openshift/nodejs:0.10 + bc/nodejs-ex builds https://github.com/sclorg/nodejs-ex with openshift/nodejs:0.10 deployment #2 deployed about a minute ago - 1 pod deployment #1 deployed 2 hours ago diff --git a/helm/nodejs/Chart.yaml b/helm/nodejs/Chart.yaml index 18c8d40..ef91e80 100755 --- a/helm/nodejs/Chart.yaml +++ b/helm/nodejs/Chart.yaml @@ -1,9 +1,9 @@ name: nodejs version: 0.1 -description: An example Node.js application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md. +description: An example Node.js application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md. keywords: - quickstart - nodejs home: https://access.redhat.com sources: -- https://github.com/openshift/nodejs-ex +- https://github.com/sclorg/nodejs-ex diff --git a/helm/nodejs/templates/NOTES.txt b/helm/nodejs/templates/NOTES.txt index 94c70dd..69cffbf 100644 --- a/helm/nodejs/templates/NOTES.txt +++ b/helm/nodejs/templates/NOTES.txt @@ -1,3 +1,3 @@ The following service(s) have been created in your project: {{ .Values.name }}. -For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md. +For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md. diff --git a/helm/nodejs/values.yaml b/helm/nodejs/values.yaml index 2a2509c..0eb7792 100644 --- a/helm/nodejs/values.yaml +++ b/helm/nodejs/values.yaml @@ -5,7 +5,7 @@ namespace: openshift # Memory Limit: Maximum amount of memory the container can use. memory_limit: 512Mi # Git Repository URL: The URL of the repository with your application source code. -source_repository_url: https://github.com/openshift/nodejs-ex.git +source_repository_url: https://github.com/sclorg/nodejs-ex.git # Git Reference: Set this to a branch name, tag or other ref of your repository if you are not using the default branch. source_repository_ref: # Context Directory: Set this to the relative path to your project if it is not in the root of your repository. diff --git a/openshift/pipeline/README.md b/openshift/pipeline/README.md index bc5e366..45f8f6b 100644 --- a/openshift/pipeline/README.md +++ b/openshift/pipeline/README.md @@ -5,10 +5,10 @@ To do this, run: ```bash # create the nodejs example as usual -oc new-app https://github.com/openshift/nodejs-ex +oc new-app https://github.com/sclorg/nodejs-ex # now create the pipeline build controller from the openshift/pipeline # subdirectory -oc new-app https://github.com/openshift/nodejs-ex \ +oc new-app https://github.com/sclorg/nodejs-ex \ --context-dir=openshift/pipeline --name nodejs-ex-pipeline ``` diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index 9ffe375..20f6bba 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -5,17 +5,17 @@ "name": "nodejs-mongo-persistent", "annotations": { "openshift.io/display-name": "Node.js + MongoDB", - "description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", + "description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.", "tags": "quickstart,nodejs", "iconClass": "icon-nodejs", "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration.", "openshift.io/provider-display-name": "Red Hat, Inc.", - "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", + "openshift.io/documentation-url": "https://github.com/sclorg/nodejs-ex", "openshift.io/support-url": "https://access.redhat.com", "template.openshift.io/bindable": "false" } }, - "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", + "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.", "labels": { "template": "nodejs-mongo-persistent" }, @@ -488,7 +488,7 @@ "displayName": "Git Repository URL", "description": "The URL of the repository with your application source code.", "required": true, - "value": "https://github.com/openshift/nodejs-ex.git" + "value": "https://github.com/sclorg/nodejs-ex.git" }, { "name": "SOURCE_REPOSITORY_REF", diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index e2d70bf..f15fab6 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -5,17 +5,17 @@ "name": "nodejs-mongodb-example", "annotations": { "openshift.io/display-name": "Node.js + MongoDB (Ephemeral)", - "description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.", + "description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.", "tags": "quickstart,nodejs", "iconClass": "icon-nodejs", "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration. The database is stored in non-persistent storage, so this configuration should be used for experimental purposes only.", "openshift.io/provider-display-name": "Red Hat, Inc.", - "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", + "openshift.io/documentation-url": "https://github.com/sclorg/nodejs-ex", "openshift.io/support-url": "https://access.redhat.com", "template.openshift.io/bindable": "false" } }, - "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", + "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.", "labels": { "template": "nodejs-mongodb-example", "app": "nodejs-mongodb-example" @@ -465,7 +465,7 @@ "displayName": "Git Repository URL", "description": "The URL of the repository with your application source code.", "required": true, - "value": "https://github.com/openshift/nodejs-ex.git" + "value": "https://github.com/sclorg/nodejs-ex.git" }, { "name": "SOURCE_REPOSITORY_REF", diff --git a/openshift/templates/nodejs.json b/openshift/templates/nodejs.json index bfd7b6b..a94be15 100644 --- a/openshift/templates/nodejs.json +++ b/openshift/templates/nodejs.json @@ -5,17 +5,17 @@ "name": "nodejs-example", "annotations": { "openshift.io/display-name": "Node.js", - "description": "An example Node.js application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", + "description": "An example Node.js application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.", "tags": "quickstart,nodejs", "iconClass": "icon-nodejs", "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration and application deployment configuration. It does not include a database.", "openshift.io/provider-display-name": "Red Hat, Inc.", - "openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex", + "openshift.io/documentation-url": "https://github.com/sclorg/nodejs-ex", "openshift.io/support-url": "https://access.redhat.com", "template.openshift.io/bindable": "false" } }, - "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.", + "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.", "labels": { "template": "nodejs-example", "app": "nodejs-example" @@ -250,7 +250,7 @@ "displayName": "Git Repository URL", "description": "The URL of the repository with your application source code.", "required": true, - "value": "https://github.com/openshift/nodejs-ex.git" + "value": "https://github.com/sclorg/nodejs-ex.git" }, { "name": "SOURCE_REPOSITORY_REF", diff --git a/package.json b/package.json index d802fd6..c318863 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,12 @@ }, "repository": { "type": "git", - "url": "http://github.com/openshift/nodejs-ex.git" + "url": "http://github.com/sclorg/nodejs-ex.git" }, "author": "Steve Speicher ", "license": "CC-BY-1.0", "bugs": { - "url": "http://github.com/openshift/nodejs-ex/issues" + "url": "http://github.com/sclorg/nodejs-ex/issues" }, - "homepage": "http://github.com/openshift/nodejs-ex" + "homepage": "http://github.com/sclorg/nodejs-ex" } diff --git a/views/index.html b/views/index.html index aea7910..e8d2680 100644 --- a/views/index.html +++ b/views/index.html @@ -228,7 +228,7 @@ pre {

Deploying code changes

- The source code for this application is available to be forked from the OpenShift GitHub repository. + The source code for this application is available to be forked from the OpenShift GitHub repository. You can configure a webhook in your repository to make OpenShift automatically start a build whenever you push your code:

From 58e352aa6924d0e1aa7e5e7b737feb5344aa3769 Mon Sep 17 00:00:00 2001 From: rubenhulzebos <41952975+rubenhulzebos@users.noreply.github.com> Date: Thu, 2 Aug 2018 09:00:41 +0200 Subject: [PATCH 21/24] Update index.html Added Github webhook settings description. --- views/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views/index.html b/views/index.html index e8d2680..892bb25 100644 --- a/views/index.html +++ b/views/index.html @@ -239,7 +239,8 @@ pre {
  • Click the Configuration tab
  • Click the "Copy to clipboard" icon to the right of the "GitHub webhook URL" field
  • Navigate to your repository on GitHub and click on repository settings > webhooks > Add webhook
  • -
  • Paste your webhook URL provided by OpenShift
  • +
  • Paste your webhook URL provided by OpenShift in the "Payload URL" field
  • +
  • Change the "Content type" to 'application/json'
  • Leave the defaults for the remaining fields — that's it!
  • After you save your webhook, if you refresh your settings page you can see the status of the ping that Github sent to OpenShift to verify it can reach the server.

    From 5f15c1edb098e80f0de21f807eb1402c4fe78d17 Mon Sep 17 00:00:00 2001 From: sspeiche Date: Sun, 19 Aug 2018 10:43:25 -0400 Subject: [PATCH 22/24] Add support for binding style env vars --- server.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/server.js b/server.js index d2352be..746838c 100644 --- a/server.js +++ b/server.js @@ -13,13 +13,31 @@ var port = process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 8080, mongoURL = process.env.OPENSHIFT_MONGODB_DB_URL || process.env.MONGO_URL, mongoURLLabel = ""; -if (mongoURL == null && process.env.DATABASE_SERVICE_NAME) { - var mongoServiceName = process.env.DATABASE_SERVICE_NAME.toUpperCase(), - mongoHost = process.env[mongoServiceName + '_SERVICE_HOST'], - mongoPort = process.env[mongoServiceName + '_SERVICE_PORT'], - mongoDatabase = process.env[mongoServiceName + '_DATABASE'], - mongoPassword = process.env[mongoServiceName + '_PASSWORD'] - mongoUser = process.env[mongoServiceName + '_USER']; +if (mongoURL == null) { + var mongoHost, mongoPort, mongoDatabase, mongoPassword, mongoUser; + // If using plane old env vars via service discovery + if (process.env.DATABASE_SERVICE_NAME) { + var mongoServiceName = process.env.DATABASE_SERVICE_NAME.toUpperCase(); + mongoHost = process.env[mongoServiceName + '_SERVICE_HOST']; + mongoPort = process.env[mongoServiceName + '_SERVICE_PORT']; + mongoDatabase = process.env[mongoServiceName + '_DATABASE']; + mongoPassword = process.env[mongoServiceName + '_PASSWORD']; + mongoUser = process.env[mongoServiceName + '_USER']; + + // If using env vars from secret from service binding + } else if (process.env.database_name) { + mongoDatabase = process.env.database_name; + mongoPassword = process.env.password; + mongoUser = process.env.username; + var mongoUriParts = process.env.uri && process.env.uri.split("//"); + if (mongoUriParts.length == 2) { + mongoUriParts = mongoUriParts[1].split(":"); + if (mongoUriParts && mongoUriParts.length == 2) { + mongoHost = mongoUriParts[0]; + mongoPort = mongoUriParts[1]; + } + } + } if (mongoHost && mongoPort && mongoDatabase) { mongoURLLabel = mongoURL = 'mongodb://'; @@ -29,7 +47,6 @@ if (mongoURL == null && process.env.DATABASE_SERVICE_NAME) { // Provide UI label that excludes user id and pw mongoURLLabel += mongoHost + ':' + mongoPort + '/' + mongoDatabase; mongoURL += mongoHost + ':' + mongoPort + '/' + mongoDatabase; - } } var db = null, From e56c06e04aa84ecf363ea50eaff94ad0d0dc87d4 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 Aug 2018 22:16:37 -0400 Subject: [PATCH 23/24] Edit templates to only include imagestreams that support both x86 and ppc64le --- openshift/templates/nodejs-mongodb-persistent.json | 4 ++-- openshift/templates/nodejs-mongodb.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openshift/templates/nodejs-mongodb-persistent.json b/openshift/templates/nodejs-mongodb-persistent.json index 20f6bba..0183fcf 100644 --- a/openshift/templates/nodejs-mongodb-persistent.json +++ b/openshift/templates/nodejs-mongodb-persistent.json @@ -458,8 +458,8 @@ { "name": "MONGODB_VERSION", "displayName": "Version of MongoDB Image", - "description": "Version of MongoDB image to be used (3.2, 3.4, or latest).", - "value": "3.4", + "description": "Version of MongoDB image to be used (3.6 or latest).", + "value": "3.6", "required": true }, { diff --git a/openshift/templates/nodejs-mongodb.json b/openshift/templates/nodejs-mongodb.json index f15fab6..f92186f 100644 --- a/openshift/templates/nodejs-mongodb.json +++ b/openshift/templates/nodejs-mongodb.json @@ -442,8 +442,8 @@ { "name": "MONGODB_VERSION", "displayName": "Version of MongoDB Image", - "description": "Version of MongoDB image to be used (3.2, 3.4, or latest).", - "value": "3.4", + "description": "Version of MongoDB image to be used (3.6 or latest).", + "value": "3.6", "required": true }, { From 38584bb52afff34cb0261e154b785e327df40512 Mon Sep 17 00:00:00 2001 From: liangxia Date: Tue, 16 Oct 2018 20:49:41 +0800 Subject: [PATCH 24/24] Update url to reflect OKD rebranding --- README.md | 8 ++++---- views/index.html | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2979dd7..4924454 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ There are four methods to get started with OpenShift v3: #### Running a virtual machine with Vagrant -One option is to use the Vagrant all-in-one launch as described in the [OpenShift Origin All-In-One Virtual Machine](https://www.openshift.org/vm/). This option works on Mac, Windows and Linux, but requires that you install [Vagrant](https://www.vagrantup.com/downloads.html) running [VirtualBox](https://www.virtualbox.org/wiki/Downloads). +One option is to use the Vagrant all-in-one launch as described in the [OpenShift Origin All-In-One Virtual Machine](https://www.okd.io/vm/). This option works on Mac, Windows and Linux, but requires that you install [Vagrant](https://www.vagrantup.com/downloads.html) running [VirtualBox](https://www.virtualbox.org/wiki/Downloads). #### Running a virtual machine managed by minishift @@ -53,15 +53,15 @@ Another option to run virtual machine but not having to using Vagrant is to down #### Starting a Docker container -Another option is running the OpenShift Origin Docker container image from [Docker Hub](https://hub.docker.com/r/openshift/origin/) launch as described in the [Getting Started for Administrators](https://docs.openshift.org/latest/getting_started/administrators.html#running-in-a-docker-container). This method is supported on Fedora, CentOS, and Red Hat Enterprise Linux (RHEL) hosts only. +Another option is running the OpenShift Origin Docker container image from [Docker Hub](https://hub.docker.com/r/openshift/origin/) launch as described in the [Getting Started for Administrators](https://docs.okd.io/latest/getting_started/administrators.html#running-in-a-docker-container). This method is supported on Fedora, CentOS, and Red Hat Enterprise Linux (RHEL) hosts only. #### Downloading the Binary -Red Hat periodically publishes OpenShift Origin Server binaries for Linux, which you can download on the OpenShift Origin GitHub [Release](https://github.com/openshift/origin/releases) page. Instructions on how to install and launch the Openshift Origin Server from binary are described in [Getting Started for Administrators](https://docs.openshift.org/latest/getting_started/administrators.html#downloading-the-binary). +Red Hat periodically publishes OpenShift Origin Server binaries for Linux, which you can download on the OpenShift Origin GitHub [Release](https://github.com/openshift/origin/releases) page. Instructions on how to install and launch the Openshift Origin Server from binary are described in [Getting Started for Administrators](https://docs.okd.io/latest/getting_started/administrators.html#downloading-the-binary). #### Running an Ansible playbook -Outlined as the [Advanced Installation](https://docs.openshift.org/latest/install_config/install/advanced_install.html) method for poduction environments, OpenShift Origin is also installable via Ansible playbook made avaialble on the GitHub [openshift-ansible](https://github.com/openshift/openshift-ansible) repo. +Outlined as the [Advanced Installation](https://docs.okd.io/latest/install_config/install/advanced_install.html) method for poduction environments, OpenShift Origin is also installable via Ansible playbook made avaialble on the GitHub [openshift-ansible](https://github.com/openshift/openshift-ansible) repo. ### Creating a project diff --git a/views/index.html b/views/index.html index 892bb25..169685f 100644 --- a/views/index.html +++ b/views/index.html @@ -224,7 +224,7 @@ pre {

    How to use this example application

    -

    For instructions on how to use this application with OpenShift, start by reading the Developer Guide.

    +

    For instructions on how to use this application with OpenShift, start by reading the Developer Guide.

    Deploying code changes

    @@ -266,20 +266,20 @@ $ git push

    Managing your application

    -

    Documentation on how to manage your application from the Web Console or Command Line is available at the Developer Guide.

    +

    Documentation on how to manage your application from the Web Console or Command Line is available at the Developer Guide.

    Web Console

    You can use the Web Console to view the state of your application components and launch new builds.

    Command Line

    -

    With the OpenShift command line interface (CLI), you can create applications and manage projects from a terminal.

    +

    With the OpenShift command line interface (CLI), you can create applications and manage projects from a terminal.

    Development Resources