Giter VIP home page Giter VIP logo

nodejs-ex's Introduction

Node.js CI Coverage Status

Example CRUD Application

Getting Started

Running Locally

First, install the dependencies

npm install

A Postgres DB is needed, so if you are using Docker, then you can start a postgres db easily.

docker run --name os-postgres-db -e POSTGRESQL_USER=luke -e POSTGRESQL_PASSWORD=secret -e POSTGRESQL_DATABASE=my_data -d -p 5432:5432 centos/postgresql-10-centos7

In this example, the db user is luke, the password is secret and the database is my_data

You can then start the application like this:

DB_USERNAME=luke DB_PASSWORD=secret ./bin/www

Then go to http://localhost:8080

Other options:

  • npm run dev same as npm start but with pretty output log.
  • npm run dev:debug shows debug information.

Running on Openshift

First, make sure you have an instance of Openshift setup and are logged in using oc login.

Then create a new project using the oc commands

oc new-project fun-node-fun

For this example, you will also need a postgres db running on your Openshift cluster.

oc new-app -e POSTGRESQL_USER=luke -ePOSTGRESQL_PASSWORD=secret -ePOSTGRESQL_DATABASE=my_data centos/postgresql-10-centos7 --name=my-database

Then run npm run openshift to deploy your app

Run the following command to show the newly exposed route that you can navigate:

oc get route nodejs-rest-http-crud
NAME                    HOST/PORT                                        PATH   SERVICES                PORT   TERMINATION   WILDCARD
nodejs-rest-http-crud   nodejs-rest-http-crud-opentel.apps-crc.testing          nodejs-rest-http-crud   8080                 None

Running on Openshift with traces enabled

nodejs-ex's People

Contributors

bettiolo avatar bparees avatar brennv avatar coreydaley avatar dharmit avatar dinhxuanvu avatar emmanuelgit avatar ewolinetz avatar gabemontero avatar guangxuli avatar hhorak avatar jhadvig avatar jupierce avatar lholmquist avatar liangxia avatar luciddreamz avatar mfojtik avatar mnagy avatar mordicool avatar phracek avatar pi-victor avatar pvalena avatar rettori avatar rhcarvalho avatar rubenhulzebos avatar ryanj avatar sallyom avatar smarterclayton avatar sspeiche avatar yselkowitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejs-ex's Issues

process.env.DATABASE_SERVICE_NAME is undefined

I dont understand if i have to set the value for all the env variables :
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'];

And if i have to which value is for each one of these env variables.Please help.

Replace "nodejs-ex" by "nodejs-exemple" in README file

(should be tagged with the "kind/documentation" label)

In then README file, the string "nodejs-ex" must be replaced by "nodejs-exemple".

For instance, in the "Build the app" section of this file:

  • the expected output of os status command: at least 3 occurrences
  • 1 occurrence in the "start-build" command: oc start-build nodejs-ex --follow must be replaced by oc start-build nodejs-example --follow

Prometheus metrics endpoint

Hi,

In our group (https://aerogear.org/ and http://feedhenry.org/), we're currently implementing Prometheus metrics endpoints for our applications that run on OpenShift.

We're using Prometheus' auto-discovery method to find out the services to monitor. When the service has a special annotation on it, it will be marked as metrics target by Prometheus and then the metrics endpoint will be requested regularly.

Do you think this kind of metrics would be a nice addition to this sample application?

I modified this sample application to add metrics to it: https://github.com/aliok/node-app-with-prometheus-metrics
If you like, I can clean it up and send a PR.
What to provide as metrics is something we can discuss.
Currently, there is only some random metrics value is provided in that app.

  • If you don't like this idea and want to keep this example as simple as it is, we can perhaps create a fork of this application in OpenShift Github org with metrics.
  • Or, we can move my sample app to OpenShift Github org after some clean up: https://github.com/aliok/node-app-with-prometheus-metrics
  • If you didn't like any of those, I can just write a blog post about it :)

build fails indeterministically on openshift 3.0.2

No sure if this belongs to STI builder or this application. It only occurs for this application

The behaviour

  • First build is successful
    -Successive builds fail in deterministically with same failure. some fail repeatedly other are succesfully.

I don't understand this as the build always the same. irregardless if builds occurred before hand.

Update: The nodejs-ex is build by stepping through the new-app process from the webconsole in ose

[root@master-ose ~]# oc logs nodejs-ex-5-build
I1103 07:05:50.475738 1 sti.go:74] The value of ALLOWED_UIDS is [1-]
I1103 07:05:50.500131 1 docker.go:211] Image registry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0 available locally
I1103 07:05:50.500184 1 sti.go:96] Creating a new S2I builder with build config: "Builder Name:\t\tNode.js 0.10\nBuilder Image:\t\tregistry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0\nSource:\t\t\thttps://github.com/openshift/nodejs-ex\nSource Ref:\t\tmaster\nOutput Image Tag:\t172.30.31.42:5000/demo/nodejs-ex:latest\nEnvironment:\t\tOPENSHIFT_BUILD_NAME=nodejs-ex-5,OPENSHIFT_BUILD_NAMESPACE=demo,OPENSHIFT_BUILD_SOURCE=https://github.com/openshift/nodejs-ex,OPENSHIFT_BUILD_REFERENCE=master\nIncremental Build:\tdisabled\nRemove Old Build:\tdisabled\nForce Pull:\t\tdisabled\nQuiet:\t\t\tdisabled\nLayered Build:\t\tdisabled\nDocker Endpoint:\tunix:///var/run/docker.sock\n"
I1103 07:05:50.503270 1 docker.go:211] Image registry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0 available locally
I1103 07:05:50.509187 1 sti.go:124] Preparing to build 172.30.31.42:5000/demo/nodejs-ex:latest
I1103 07:05:50.530909 1 clone.go:30] Cloning sources and all GIT submodules into "/tmp/sti549162237/upload/src"
Already on 'master'
I1103 07:05:52.649009 1 clone.go:43] Checked out "master"
I1103 07:05:52.660495 1 docker.go:211] Image registry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0 available locally
I1103 07:05:52.660512 1 docker.go:317] Image contains io.openshift.s2i.scripts-url set to 'image:///usr/local/sti'
I1103 07:05:52.660528 1 download.go:57] Using image internal scripts from: image:///usr/local/sti/assemble
I1103 07:05:52.660535 1 download.go:57] Using image internal scripts from: image:///usr/local/sti/run
I1103 07:05:52.663826 1 docker.go:211] Image registry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0 available locally
I1103 07:05:52.663838 1 docker.go:317] Image contains io.openshift.s2i.scripts-url set to 'image:///usr/local/sti'
I1103 07:05:52.663850 1 download.go:57] Using image internal scripts from: image:///usr/local/sti/save-artifacts
I1103 07:05:52.663857 1 sti.go:199] Using assemble from image:///usr/local/sti
I1103 07:05:52.663864 1 sti.go:199] Using run from image:///usr/local/sti
I1103 07:05:52.663867 1 sti.go:199] Using save-artifacts from image:///usr/local/sti
I1103 07:05:52.663886 1 sti.go:132] Clean build will be performed
I1103 07:05:52.663890 1 sti.go:135] Performing source build from https://github.com/openshift/nodejs-ex
I1103 07:05:52.663893 1 sti.go:145] Running S2I script in 172.30.31.42:5000/demo/nodejs-ex:latest
I1103 07:05:52.663899 1 sti.go:345] Using image name registry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0
I1103 07:05:52.663905 1 sti.go:349] No .sti/environment provided (no environment file found in application sources)
I1103 07:05:52.668226 1 docker.go:317] Image contains io.openshift.s2i.scripts-url set to 'image:///usr/local/sti'
I1103 07:05:52.668241 1 docker.go:370] Base directory for STI scripts is '/usr/local/sti'. Untarring destination is '/tmp'.
I1103 07:05:52.668248 1 docker.go:497] Creating container using config: {Hostname: Domainname: User: Memory:0 MemorySwap:0 CPUShares:0 CPUSet: AttachStdin:false AttachStdout:true AttachStderr:false PortSpecs:[] ExposedPorts:map[] Tty:false OpenStdin:true StdinOnce:true Env:[OPENSHIFT_BUILD_NAME=nodejs-ex-5 OPENSHIFT_BUILD_NAMESPACE=demo OPENSHIFT_BUILD_SOURCE=https://github.com/openshift/nodejs-ex OPENSHIFT_BUILD_REFERENCE=master] Cmd:[/bin/sh -c tar -C /tmp -xf - && /usr/local/sti/assemble] DNS:[] Image:registry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0 Volumes:map[] VolumesFrom: WorkingDir: MacAddress: Entrypoint:[] NetworkDisabled:false SecurityOpts:[] OnBuild:[] Mounts:[] Labels:map[]}
I1103 07:05:53.045616 1 docker.go:508] Attaching to container
I1103 07:05:53.046242 1 docker.go:514] Starting container
I1103 07:05:53.289665 1 docker.go:448] Waiting for container
I1103 07:05:53.351494 1 sti.go:407] ---> Installing application source
I1103 07:05:53.361945 1 sti.go:407] ---> Building your Node application from source
E1103 07:05:53.604255 1 util.go:85] npm info it worked if it ends with ok
E1103 07:05:53.604377 1 util.go:85] npm info using [email protected]
E1103 07:05:53.604403 1 util.go:85] npm info using [email protected]
E1103 07:05:53.688222 1 util.go:85] npm info preinstall [email protected]
E1103 07:05:53.697534 1 util.go:85] npm ERR! Error: Attempt to unlock ejs@, which hasn't been locked
E1103 07:05:53.697571 1 util.go:85] npm ERR! at unlock (/opt/rh/nodejs010/root/usr/lib/node_modules/npm/lib/utils/locker.js:44:11)
E1103 07:05:53.697761 1 util.go:85] npm ERR! at cb (/opt/rh/nodejs010/root/usr/lib/node_modules/npm/lib/cache/add-named.js:32:5)
E1103 07:05:53.697786 1 util.go:85] npm ERR! at /opt/rh/nodejs010/root/usr/lib/node_modules/npm/lib/cache/add-named.js:41:20
E1103 07:05:53.697791 1 util.go:85] npm ERR! at /opt/rh/nodejs010/root/usr/lib/node_modules/npm/lib/utils/locker.js:30:7
E1103 07:05:53.697796 1 util.go:85] npm ERR! at cb (/opt/rh/nodejs010/root/usr/lib/node_modules/lockfile/lockfile.js:149:38)
E1103 07:05:53.697805 1 util.go:85] npm ERR! at /opt/rh/nodejs010/root/usr/lib/node_modules/lockfile/lockfile.js:177:38
E1103 07:05:53.698060 1 util.go:85] npm ERR! at Object.oncomplete (fs.js:108:15)
E1103 07:05:53.698075 1 util.go:85] npm ERR! If you need help, you may report this *entire
log,
E1103 07:05:53.698092 1 util.go:85] npm ERR! including the npm and node versions, at:
E1103 07:05:53.698105 1 util.go:85] npm ERR! http://github.com/npm/npm/issues
E1103 07:05:53.698109 1 util.go:85]
E1103 07:05:53.698112 1 util.go:85] npm ERR! System Linux 3.10.0-229.14.1.el7.x86_64
E1103 07:05:53.698196 1 util.go:85] npm ERR! command "node" "/opt/rh/nodejs010/root/usr/bin/npm" "install" "-d"
E1103 07:05:53.698203 1 util.go:85] npm ERR! cwd /opt/app-root/src
E1103 07:05:53.698250 1 util.go:85] npm ERR! node -v v0.10.35
E1103 07:05:53.698430 1 util.go:85] npm ERR! npm -v 1.4.28
E1103 07:05:53.713447 1 util.go:85] npm info trying registry request attempt 1 at 07:05:53
E1103 07:05:53.713820 1 util.go:85] npm http GET https://registry.npmjs.org/express
E1103 07:05:53.731611 1 util.go:85] npm info trying registry request attempt 1 at 07:05:53
E1103 07:05:53.734940 1 util.go:85] npm http GET https://registry.npmjs.org/mongodb
E1103 07:05:54.147510 1 util.go:85] npm http 200 https://registry.npmjs.org/express
E1103 07:05:54.205382 1 util.go:85] npm info retry fetch attempt 1 at 07:05:54
E1103 07:05:54.206209 1 util.go:85] npm http GET https://registry.npmjs.org/express/-/express-4.13.3.tgz
E1103 07:05:54.342950 1 util.go:85] npm http 200 https://registry.npmjs.org/mongodb
E1103 07:05:54.384705 1 util.go:85] npm http 200 https://registry.npmjs.org/express/-/express-4.13.3.tgz
E1103 07:05:54.391850 1 util.go:85] npm info retry fetch attempt 1 at 07:05:54
E1103 07:05:54.392231 1 util.go:85] npm http GET https://registry.npmjs.org/mongodb/-/mongodb-2.0.47.tgz
E1103 07:05:54.563384 1 util.go:85] npm http 200 https://registry.npmjs.org/mongodb/-/mongodb-2.0.47.tgz
E1103 07:05:54.852918 1 util.go:85] npm ERR!
E1103 07:05:54.852958 1 util.go:85] npm ERR! Additional logging details can be found in:
E1103 07:05:54.853209 1 util.go:85] npm ERR! /opt/app-root/src/npm-debug.log
E1103 07:05:54.853401 1 util.go:85] npm ERR! not ok code 0
I1103 07:05:55.125285 1 docker.go:450] Container wait returns with 1 and
I1103 07:05:55.125315 1 docker.go:457] Container exited
I1103 07:05:55.134577 1 cleanup.go:23] Removing temporary directory /tmp/sti549162237
I1103 07:05:55.134591 1 fs.go:99] Removing directory '/tmp/sti549162237'
F1103 07:05:55.135842 1 builder.go:54] Build error: non-zero (13) exit code from registry.access.redhat.com/openshift3/nodejs-010-rhel7:v3.0.2.0

Build fails behind proxy

I'm running OS 1.3 and this build fails behind a authenticated proxy due to an "unescaped character".

Proxy works fine with all other examples. What's wrong here?

npm ERR! Request path contains unescaped characters.
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/opt/rh/rh-nodejs4/root/usr/bin/node" "/opt/rh/rh-nodejs4/root/usr/bin/npm" "install"
npm ERR! node v4.4.2
npm ERR! npm  v2.15.1

openshift pipeline issue

I am currently learning Openshift Pipeline and have one question concerning your code. With Readme.md under the folder pipeline

# now create the pipeline build controller from the openshift/pipeline
# subdirectory
oc new-app https://github.com/sclorg/nodejs-ex \
  --context-dir=openshift/pipeline --name nodejs-ex-pipeline

According to the Openshift Pipeline documentation, one jenkinsPipelineStrategy strategy has to be specified in a certain BuildConfig in order to use pipeline, but I can find it within your project.

Can someone shed the light on how jenkinsPipelineStrategy is enabled with your project?

MongoClient DeprecationWarning

When running the code I am getting that message.

(node:2986) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

The majority of reported issues seems to be mongo related.
How about working with another storage provider?

Jenkins build failed

Container platform

OCP 4

Version

No response

OS version of the container image

Fedora

Bugzilla, Jira

No response

Description

OpenShift Build nodeapp-1/nodejs-sample-pipeline-1
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
โ€˜nodejs-0r836โ€™ is offline
Agent nodejs-0r836 is provisioned from template nodejs
---
apiVersion: "v1"
kind: "Pod"
metadata:
  labels:
    jenkins: "slave"
    jenkins/label-digest: "9690950bf78d69049eb916154c609783fd2ed40d"
    jenkins/label: "nodejs"
  name: "nodejs-0r836"
spec:
  containers:
  - args:
    - "********"
    - "nodejs-0r836"
    env:
    - name: "JENKINS_SECRET"
      value: "********"
    - name: "JENKINS_TUNNEL"
      value: "172.30.189.36:50000"
    - name: "JENKINS_AGENT_NAME"
      value: "nodejs-0r836"
    - name: "JENKINS_NAME"
      value: "nodejs-0r836"
    - name: "JENKINS_AGENT_WORKDIR"
      value: "/tmp"
    - name: "JENKINS_URL"
      value: "http://172.30.217.93:80/"
    image: "image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-nodejs:latest"
    imagePullPolicy: "Always"
    name: "jnlp"
    resources:
      limits: {}
      requests: {}
    tty: false
    volumeMounts:
    - mountPath: "/tmp"
      name: "workspace-volume"
      readOnly: false
    workingDir: "/tmp"
  nodeSelector:
    kubernetes.io/os: "linux"
  restartPolicy: "Never"
  serviceAccountName: "jenkins"
  volumes:
  - emptyDir:
      medium: ""
    name: "workspace-volume"

Running on nodejs-0r836 in /tmp/workspace/nodeapp-1/nodeapp-1-nodejs-sample-pipeline
[Pipeline] {
[Pipeline] timeout
Timeout set to expire in 20 min
[Pipeline] {
[Pipeline] stage
[Pipeline] { (preamble)
[Pipeline] script
[Pipeline] {
[Pipeline] echo

[Pipeline] _OcContextInit
[Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] echo
Using project: nodeapp-1
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (cleanup)
[Pipeline] script
[Pipeline] {
[Pipeline] _OcContextInit
[Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (create)
[Pipeline] script
[Pipeline] {
[Pipeline] _OcContextInit
[Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (build)
Stage "build" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy)
Stage "deploy" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (tag)
Stage "tag" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is 'w' with an int value of 119
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
warning: Cannot check if git requires authentication.
^
	at groovy.json.internal.JsonParserCharArray.decodeValueInternal(JsonParserCharArray.java:206)
	at groovy.json.internal.JsonParserCharArray.decodeValue(JsonParserCharArray.java:157)
	at groovy.json.internal.JsonParserCharArray.decodeFromChars(JsonParserCharArray.java:46)
	at groovy.json.internal.JsonParserCharArray.parse(JsonParserCharArray.java:384)
	at groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:112)
	at groovy.json.JsonSlurper.parseText(JsonSlurper.java:205)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
	at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
	at com.openshift.jenkins.plugins.OpenShiftDSL.serializableMap(OpenShiftDSL.groovy:541)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
	at com.openshift.jenkins.plugins.OpenShiftDSL.newAppAction(OpenShiftDSL.groovy:930)
	at com.openshift.jenkins.plugins.OpenShiftDSL.newApp(OpenShiftDSL.groovy:949)
	at WorkflowScript.run(WorkflowScript:43)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(OpenShiftDSL.groovy:407)
	at com.openshift.jenkins.plugins.OpenShiftDSL$Context.run(OpenShiftDSL.groovy:134)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(OpenShiftDSL.groovy:406)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(OpenShiftDSL.groovy)
	at WorkflowScript.run(WorkflowScript:42)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:378)
	at com.openshift.jenkins.plugins.OpenShiftDSL$Context.run(OpenShiftDSL.groovy:134)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:377)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:395)
	at com.openshift.jenkins.plugins.OpenShiftDSL.node(OpenShiftDSL.groovy:1823)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:382)
	at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy)
	at WorkflowScript.run(WorkflowScript:41)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:90)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:116)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:85)
	at jdk.internal.reflect.GeneratedMethodAccessor148.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:75)
	at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:65)
	at jdk.internal.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:158)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:152)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:136)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:275)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:152)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:187)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:420)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:95)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:330)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:294)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
	at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Finished: FAILURE

Reproducer

kind: "BuildConfig"
apiVersion: "build.openshift.io/v1"
metadata:
  name: "nodejs-sample-pipeline"
spec:
  strategy:
    type: JenkinsPipeline
    jenkinsPipelineStrategy:
      jenkinsfile: |-
        def templatePath = 'https://raw.githubusercontent.com/openshift/nodejs-ex/master/openshift/templates/nodejs-mongodb.json'
        def templateName = 'nodejs-mongodb-example'
        pipeline {
          agent {
            node {
              label 'nodejs'
            }
          }
          options {
            timeout(time: 20, unit: 'MINUTES')
          }
          stages {
            stage('preamble') {
                steps {
                    script {
                        openshift.withCluster() {
                            openshift.withProject() {
                                echo "Using project: ${openshift.project()}"
                            }
                        }
                    }
                }
            }
            stage('cleanup') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          openshift.selector("all", [ template : templateName ]).delete() 
                          if (openshift.selector("secrets", templateName).exists()) { 
                            openshift.selector("secrets", templateName).delete()
                          }
                        }
                    }
                }
              }
            }
            stage('create') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          openshift.newApp(templatePath) 
                        }
                    }
                }
              }
            }
            stage('build') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          def builds = openshift.selector("bc", templateName).related('builds')
                          timeout(5) { 
                            builds.untilEach(1) {
                              return (it.object().status.phase == "Complete")
                            }
                          }
                        }
                    }
                }
              }
            }
            stage('deploy') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          def rm = openshift.selector("dc", templateName).rollout()
                          timeout(5) { 
                            openshift.selector("dc", templateName).related('pods').untilEach(1) {
                              return (it.object().status.phase == "Running")
                            }
                          }
                        }
                    }
                }
              }
            }
            stage('tag') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          openshift.tag("${templateName}:latest", "${templateName}-staging:latest") 
                        }
                    }
                }
              }
            }
          }
        }

MongoDB config

I'm likely missing something, but after following the README, my index page reads "Page view count: No database configured". Should there be an additional step that takes advantage of template/nodejs-mongodb.json?

This was my hacky work-around:

oc new-app centos/mongodb-26-centos7 -e MONGODB_USER=admin,MONGODB_DATABASE=mongo_db,MONGODB_PASSWORD=secret,MONGODB_ADMIN_PASSWORD=super-secret

Followed by:

oc new-app https://github.com/openshift/nodejs-ex -l name=myapp -e MONGO_URL=mongodb://admin:[email protected]:27017/mongo_db

the route is not accepting traffic yet because it has not been admitted by a router

Backgroud:
1.I have seen the video[1],and try it on my Ubuntu 14,it seems that build successfully
Problems:
1.But after i want to visit the URL,it shows that i can not visit it,the in the "Browse->Routes",i find that there is waring showing "the route is not accepting traffic yet because it has not been admitted by a router"
2.Why?How can i fix it?Becasue I use the Ubuntu?

[1]https://access.redhat.com/videos/1606273

Build does not proceed, waits for ever

OS: Ubuntu 16.04
Installed 'oc' and did oc cluster up
Connected to the Web Console
In my-project, created an app ("an-app") using 'https://github.com/openshift/nodejs-ex.git' (actually just clicked try-it button that fills this in).
It started build 1 that did not do anything (just the spinning icon). Canceled after 40 min. Tried again. Same fate for build 2.

Builds
an-app Build #2 is pending created 4 minutes ago
Build #1 was cancelled created an hour ago

Not sure if any other config is required!

failed to build after push

I0704 01:27:38.482414 1 builder.go:57] Master version "v3.2.1.3-1-gcbaf600", Builder version "v3.2.1.3-1-gcbaf600"
I0704 01:27:38.486774 1 builder.go:145] Running build with cgroup limits: api.CGroupLimits{MemoryLimitBytes:536870912, CPUShares:61, CPUPeriod:100000, CPUQuota:100000, MemorySwap:536870912}
I0704 01:27:38.492152 1 sti.go:206] The value of ALLOWED_UIDS is [1-]
I0704 01:27:38.492177 1 sti.go:214] The value of DROP_CAPS is [KILL,MKNOD,SETGID,SETUID,SYS_CHROOT]
I0704 01:27:38.496811 1 docker.go:355] Using locally available image "registry.access.redhat.com/openshift3/nodejs-010-rhel7:latest"
I0704 01:27:38.499234 1 sti.go:233] Creating a new S2I builder with build config: "Builder Name:\t\t\tNode.js 0.10\nBuilder Image:\t\t\tregistry.access.redhat.com/openshift3/nodejs-010-rhel7:latest\nSource:\t\t\t\tfile:///tmp/s2i-build879299895/upload/src#679224040c80fd1c8cb821fd1176b185ccfd4875\nOutput Image Tag:\t\tsunorth/node-sunorth-6:0f85c344\nEnvironment:\t\t\tOPENSHIFT_BUILD_NAME=node-sunorth-6,OPENSHIFT_BUILD_NAMESPACE=sunorth,OPENSHIFT_BUILD_SOURCE=https://github.com/openshift/nodejs-ex.git,OPENSHIFT_BUILD_REFERENCE=master,OPENSHIFT_BUILD_COMMIT=679224040c80fd1c8cb821fd1176b185ccfd4875\nIncremental Build:\t\tdisabled\nRemove Old Build:\t\tdisabled\nBuilder Pull Policy:\t\tif-not-present\nPrevious Image Pull Policy:\talways\nQuiet:\t\t\t\tdisabled\nLayered Build:\t\t\tdisabled\nWorkdir:\t\t\t/tmp/s2i-build879299895\nDocker NetworkMode:\t\tcontainer:1c4e05efb479587443098cb37b02d1558c13a0bfb64cef10937290b5099ff44f\nDocker Endpoint:\t\tunix:///var/run/docker.sock\n"
I0704 01:27:38.501772 1 docker.go:355] Using locally available image "registry.access.redhat.com/openshift3/nodejs-010-rhel7:latest"
I0704 01:27:38.510749 1 docker.go:355] Using locally available image "registry.access.redhat.com/openshift3/nodejs-010-rhel7:latest"
I0704 01:27:38.510778 1 docker.go:475] Image contains io.openshift.s2i.scripts-url set to 'image:///usr/libexec/s2i'
I0704 01:27:38.510819 1 sti.go:140] Preparing to build sunorth/node-sunorth-6:0f85c344
I0704 01:27:38.514347 1 source.go:197] Downloading "https://github.com/openshift/nodejs-ex.git" ...
I0704 01:27:38.813728 1 source.go:208] Cloning source from https://github.com/openshift/nodejs-ex.git
I0704 01:27:39.138032 1 cleanup.go:23] Removing temporary directory /tmp/s2i-build879299895
I0704 01:27:39.138075 1 fs.go:156] Removing directory '/tmp/s2i-build879299895'
F0704 01:27:39.139964 1 builder.go:204] Error: build error: fatal: reference is not a tree: 6792240

Build of nodejs-mongo-persistent fails, no idea how to fix it

I am following https://github.com/openshift/nodejs-ex/blob/master/README.md as indicated in the "Getting started" guide - and I have hit an issue where a build is failing, I think I can see what the issue is (clearly I made a mistake somewhere), but I have no idea how to fix it.

I cloned the repo to dneary/nodejs-ex, and when I try to build nodejs-mongo-persistent, the build fails with the following error:

`Status

Status:
Failed to fetch the input source.
Started:
5 hours ago โ€“ Nov 6, 2017 11:52:04 AM
Duration:
2 minutes, 39 seconds
Triggered By:
Manual build

Configuration created from nodejs-mongo-persistent

Build Strategy:
Source
Builder Image:
registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:0860a4ccdc062f5ab05ec872298557f02f79c94b75820ded9a16211d8ab390ce
Source Type:
Git
Source Repo:
https://github.com/dnearynodejs-ex.git
Output Image:
dneary-example/nodejs-mongo-persistent:latest
Push Secret:
builder-dockercfg-723t4
`
Notice the "Source repo" setting, missing a / between dneary and nodejs-ex.git - this is clearly the issue, probably introduced by not putting a trailing slash spomewhere it was needed in the getting started with OpenShift v3 docs, but now I don't know where this is set or how to fix it.

It would be nice to have "common issues" or a "guide to an OpenShift v3 app" which helps me identify and wipe/restart or identify and fix config issues like this in the Getting Started docs.

Thanks!

Template fails to deploy to OpenShift

Hi,

I have an app deployed on the OpenShift (3.x?) platform for the Devpost Hackathon projects, and the other day my MongoDB pod seemed to enter a failed state. I scaled it down, then back up again to 1, as I would normally do to sort out issues with connectivity, and it didn't come up that time - just hangs on a yellow status of "Pending".

Upon looking at logs, it looks like it times out waiting for a Persistent Volume claim.

I thought I would completely blow away the project and create one fresh from this nodejs-ex template as I did originally to start with, and to my surprise, the template fails too.

It seems like it can't attach the storage when the mongodb pod is created.

Looking at the yaml for the template, it looks like it tries to mount it to /var/lib/mongodb/data but fails.

This is what I get in my events:

5:24:03 PM Warning Failed mount Unable to mount volumes for pod "mongodb-2-mal06_myprojectname(d1e4d766-8ed2-11e6-8c36-1242bf1820d9)": Could not attach EBS Disk "aws://us-east-1c/vol-c4540017": Timeout waiting for volume state
30 times in the last 6 hours
5:24:03 PM Warning Failed sync Error syncing pod, skipping: Could not attach EBS Disk "aws://us-east-1c/vol-c4540017": Timeout waiting for volume state
30 times in the last

(I cannot see any logs as the container doesn't even manage to start. Querying for logs with the oc cli fails).

Application crashes if MongoDB is down/removed

I'd expect the application to keep running and reconnect to the database when it is back up.
It should serve pages just like the example template with no database.

[vagrant@openshiftdev origin]$ oc scale rc mongodb-1 --replicas=0
[vagrant@openshiftdev origin]$ oc logs -f nodejs-frontend-1-f7rsm
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info prestart [email protected]
npm info start [email protected]

> [email protected] start /opt/openshift/src
> node server.js

Server running on 0.0.0.0:8080

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write EPIPE
    at errnoException (net.js:901:11)
    at Object.afterWrite (net.js:718:19)

npm info [email protected] Failed to exec start script
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the nodejs-ex package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls nodejs-ex
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.17.4-301.fc21.x86_64
npm ERR! command "node" "/opt/rh/nodejs010/root/usr/bin/npm" "start" "-d"
npm ERR! cwd /opt/openshift/src
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.17.4-301.fc21.x86_64
npm ERR! command "node" "/opt/rh/nodejs010/root/usr/bin/npm" "start" "-d"
npm ERR! cwd /opt/openshift/src
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /opt/openshift/src/npm-debug.log
npm ERR! not ok code 0
[vagrant@openshiftdev origin]$ oc get pod
NAME                      READY     REASON       RESTARTS   AGE
nodejs-example-1-build    0/1       ExitCode:0   0          1h
nodejs-frontend-1-f7rsm   0/1       Running      11         1h

Move templates to another database

Red Hat has stopped packaging new versions of MongoDB due to its being switched to the SSPL, and no version was ever packaged for RHEL8. The OpenShift templates use mongodb exclusively, meaning that at some point they will have to be dropped, leaving no templates left for nodejs. New templates which use any of the supported databases (MariaDB, MySQL, Redis, and PostgreSQL) are needed instead.

Adding new express routes

So I tried adding another route to the express router. It worked just fine on localhost, but when I push the code to openshift, a get to the new route returns with the "Cannot GET /...". I simpled it down to just copy-paste the existing app route /pagecount and just changed the name to app.get('page*' [..]) so that I'm sure nothing else interferes with the route. Still not getting me any results when GETting the route with postman or visiting it directly on the browser.

I'm pretty new to openshift, have I missed something? Do I maybe need to create the routes at some other place than the server.js too? Help's appretiated!

Steps To Reproduce
  1. Install the repository
  2. copy the app.get('/pagecount' [...]) and change it to app.get('/page'[..]) ((or basicly anything)
Current Result

Throws Cannot GET /page

Expected Result

Same as GET /pagecount

Link

Here's the link to my server.js

https://github.com/pazzipanda/leagueStatus/blob/master/server.js

Documentation invalid for latest MongoDB version

Hi,

The documentation uses the untagged version of MongoDB. The latest version of MongoDB does not support environment variables as key value pairs and hence the deployment fails for mongo.

Thanks.

warning: --env no longer accepts comma-separated lists of values

When running:

oc new-app centos/mongodb-26-centos7 -e MONGODB_USER=admin,MONGODB_DATABASE=mongo_db,MONGODB_PASSWORD=secret,MONGODB_ADMIN_PASSWORD=super-secret

I get this warning:

warning: --env no longer accepts comma-separated lists of values. "MONGODB_USER=admin,MONGODB_DATABASE=mongo_db,MONGODB_PASSWORD=secret,MONGODB_ADMIN_PASSWORD=super-secret" will be treated as a single key-value pair.

The fix is:

oc new-app centos/mongodb-26-centos7 -e MONGODB_USER=admin -e MONGODB_DATABASE=mongo_db -e MONGODB_PASSWORD=secret -e MONGODB_ADMIN_PASSWORD=super-secret

Peer's Certificate has expired.

When attempting to build the example openshift fails to download the from the git repository.

I0718 18:50:28.505814       1 docker.go:351] Image "openshift/nodejs-010-centos7@sha256:97506ab5d06270f7b8b674e37afe1098e0750b07620163dea14755fc46d74ba7" not available locally, pulling ...
I0718 18:51:09.549495       1 source.go:197] Downloading "https://github.com/openshift/nodejs-ex.git" ...
F0718 18:51:09.836266       1 builder.go:204] Error: build error: fatal: unable to access 'https://github.com/openshift/nodejs-ex.git/': Peer's Certificate has expired.

How to connect mongo db using mongoose

I have modified the server.js and want to use mongoose to connect to the db. I have tried to connect with that but /pagecount route is always giving an error. Removing the code in the route, the app doesn't deploy. Do you have a sample snippet to implement with mongoose ?

Add test cases and post build hook

As a guide for users looking at this example, we should add some unit tests and a build hook to run those in OpenShift.

Adding a build hook to run tests looks like this:

+        "postCommit": {
+          "script": "COMMAND-TO-RUN-TESTS"
+        }

Need to replace COMMAND-TO-RUN-TESTS with something appropriate for the tests we add.

Application is not available

I followed the instructions:
https://docs.openshift.com/online/getting_started/basic_walkthrough.html

Viewing Your Running Application
In this section, you will view your running application using a web browser.

In the web console, view the Overview page for your project to determine the web address for your application. Click the web address displayed underneath the NODEJS-MONGODB-EXAMPLE service to open your application in a new browser tab:

But the browser show:
Application is not available
The application is currently not serving requests at this endpoint. It may not have been started or is still starting.

Looking at the service it doesn't have a external IP address, just the cluster IP:

Selectors:name=nodejs-mongo-persistent
Type:ClusterIP
IP:172.30.102.196
Hostname:XXX
Session affinity:None

oc status

In project My Home project (tlaloc) on server https://api.starter-ca-central-1.openshift.com:443

svc/mongodb - 172.30.239.145:27017
  dc/mongodb deploys openshift/mongodb:3.2
    deployment #1 deployed 22 hours ago - 1 pod

https://nodejs-mongo-persistent-tlaloc.193b.starter-ca-central-1.openshiftapps.com (redirects) to pod port web (svc/nodejs-mongo-persistent)
  dc/nodejs-mongo-persistent deploys istag/nodejs-mongo-persistent:latest <-
    bc/nodejs-mongo-persistent source builds https://github.com/syl20lego/nodejs-ex on openshift/nodejs:6
    deployment #1 deployed 22 hours ago - 1 pod

View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'.

oc get all

NAME                                        REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfigs/mongodb                   1          1         1         config,image(mongodb:3.2)
deploymentconfigs/nodejs-mongo-persistent   1          1         1         config,image(nodejs-mongo-persistent:latest)

NAME                                   TYPE      FROM      LATEST
buildconfigs/nodejs-mongo-persistent   Source    Git       1

NAME                               TYPE      FROM          STATUS     STARTED        DURATION
builds/nodejs-mongo-persistent-1   Source    Git@93fc25f   Complete   22 hours ago   1m20s

NAME                                   DOCKER REPO                                                       TAGS      UPDATED
imagestreams/nodejs-mongo-persistent   docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent   latest    22 hours ago

NAME                             HOST/PORT                                                                    PATH      SERVICES                  PORT      TERMINATION     WILDCARD
routes/nodejs-mongo-persistent   nodejs-mongo-persistent-tlaloc.193b.starter-ca-central-1.openshiftapps.com             nodejs-mongo-persistent   web       edge/Redirect   None

NAME                                 READY     STATUS      RESTARTS   AGE
po/mongodb-1-npmg4                   1/1       Running     0          22h
po/nodejs-mongo-persistent-1-build   0/1       Completed   0          22h
po/nodejs-mongo-persistent-1-w4lh5   1/1       Running     0          22h

NAME                           DESIRED   CURRENT   READY     AGE
rc/mongodb-1                   1         1         1         22h
rc/nodejs-mongo-persistent-1   1         1         1         22h

NAME                          TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
svc/mongodb                   ClusterIP   172.30.239.145   <none>        27017/TCP   22h
svc/nodejs-mongo-persistent   ClusterIP   172.30.102.196   <none>        8080/TCP    22h

oc describe pods

Name:           mongodb-1-npmg4
Namespace:      tlaloc
Node:           ip-172-31-26-132.ca-central-1.compute.internal/172.31.26.132
Start Time:     Sun, 15 Apr 2018 16:10:31 -0400
Labels:         deployment=mongodb-1
                deploymentconfig=mongodb
                name=mongodb
Annotations:    kubernetes.io/limit-ranger=LimitRanger plugin set: cpu request for container mongodb; cpu limit for container mongodb
                openshift.io/deployment-config.latest-version=1
                openshift.io/deployment-config.name=mongodb
                openshift.io/deployment.name=mongodb-1
                openshift.io/scc=restricted
Status:         Running
IP:             10.130.11.167
Controlled By:  ReplicationController/mongodb-1
Containers:
  mongodb:
    Container ID:   docker://34a07a08423c3641f222f7b0ab0a64506eaf00e0be6b9f7bc480a20462c5567c
    Image:          registry.access.redhat.com/rhscl/mongodb-32-rhel7@sha256:82c79f0e54d5a23f96671373510159e4fac478e2aeef4181e61f25ac38c1ae1f
    Image ID:       docker-pullable://registry.access.redhat.com/rhscl/mongodb-32-rhel7@sha256:82c79f0e54d5a23f96671373510159e4fac478e2aeef4181e61f25ac38c1ae1f
    Port:           27017/TCP
    State:          Running
      Started:      Sun, 15 Apr 2018 16:10:51 -0400
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  512Mi
    Requests:
      cpu:      50m
      memory:   256Mi
    Liveness:   tcp-socket :27017 delay=30s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [/bin/sh -i -c mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval="quit()"] delay=3s timeout=1s period=10s #success=1 #failure=3
    Environment:
      MONGODB_USER:            <set to the key 'database-user' in secret 'nodejs-mongo-persistent'>      Optional: false
      MONGODB_PASSWORD:        <set to the key 'database-password' in secret 'nodejs-mongo-persistent'>  Optional: false
      MONGODB_DATABASE:        sampledb
      MONGODB_ADMIN_PASSWORD:  <set to the key 'database-admin-password' in secret 'nodejs-mongo-persistent'>  Optional: false
    Mounts:
      /var/lib/mongodb/data from mongodb-data (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-zfl6x (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          True
  PodScheduled   True
Volumes:
  mongodb-data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  mongodb
    ReadOnly:   false
  default-token-zfl6x:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-zfl6x
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  type=compute
Tolerations:     node.kubernetes.io/memory-pressure:NoSchedule
Events:          <none>


Name:           nodejs-mongo-persistent-1-build
Namespace:      tlaloc
Node:           ip-172-31-25-193.ca-central-1.compute.internal/172.31.25.193
Start Time:     Sun, 15 Apr 2018 16:08:57 -0400
Labels:         openshift.io/build.name=nodejs-mongo-persistent-1
Annotations:    kubernetes.io/limit-ranger=LimitRanger plugin set: cpu, memory request for container sti-build; cpu, memory limit for container sti-build; cpu, memory request for init container git-clone; cpu, memory...
                openshift.io/build.name=nodejs-mongo-persistent-1
                openshift.io/scc=privileged
Status:         Succeeded
IP:             10.130.27.27
Controlled By:  Build/nodejs-mongo-persistent-1
Init Containers:
  git-clone:
    Container ID:  docker://09db3607816fe66058400c18165f7d0ea0627e86f1a3ec5abef0a9f38d85bf49
    Image:         registry.reg-aws.openshift.com:443/openshift3/ose-sti-builder:v3.9.14
    Image ID:      docker-pullable://registry.reg-aws.openshift.com:443/openshift3/ose-sti-builder@sha256:e8ca49689b4ddf2775bf65c63e9b5c764731c3feca1e246942ff8cc68074e37f
    Port:          <none>
    Command:
      openshift-git-clone
    Args:
      --loglevel=0
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Sun, 15 Apr 2018 16:09:01 -0400
      Finished:     Sun, 15 Apr 2018 16:09:07 -0400
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  512Mi
    Requests:
      cpu:     50m
      memory:  256Mi
    Environment:
      BUILD:  {"kind":"Build","apiVersion":"v1","metadata":{"name":"nodejs-mongo-persistent-1","namespace":"tlaloc","selfLink":"/apis/build.openshift.io/v1/namespaces/tlaloc/builds/nodejs-mongo-persistent-1","uid":"d47d2052-40e8-11e8-98a3-02ec8e61afcf","resourceVersion":"517479372","creationTimestamp":"2018-04-15T20:08:57Z","labels":{"app":"nodejs-mongo-persistent","buildconfig":"nodejs-mongo-persistent","openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.start-policy":"Serial","template":"nodejs-mongo-persistent"},"annotations":{"openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"nodejs-mongo-persistent","uid":"d4695615-40e8-11e8-a010-02d8407159d1","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/syl20lego/nodejs-ex"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:739c2663e323dc717f5d1e5f29f2301a3be608c1cf2a19842178b2c6d3de0231"},"env":[{"name":"NPM_MIRROR"}],"forcePull":true}},"output":{"to":{"kind":"DockerImage","name":"docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent:latest"},"pushSecret":{"name":"builder-dockercfg-mx2tp"}},"resources":{},"postCommit":{"script":"npm test"},"nodeSelector":null,"triggeredBy":[{"message":"Image change","imageChangeBuild":{"imageID":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:739c2663e323dc717f5d1e5f29f2301a3be608c1cf2a19842178b2c6d3de0231","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"nodejs:6"}}}]},"status":{"phase":"New","outputDockerImageReference":"docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent:latest","config":{"kind":"BuildConfig","namespace":"tlaloc","name":"nodejs-mongo-persistent"},"output":{}}}

      SOURCE_REPOSITORY:  https://github.com/syl20lego/nodejs-ex
      SOURCE_URI:         https://github.com/syl20lego/nodejs-ex
      ORIGIN_VERSION:     v3.9.14
      ALLOWED_UIDS:       1-
      DROP_CAPS:          KILL,MKNOD,SETGID,SETUID
    Mounts:
      /tmp/build from buildworkdir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from builder-token-n88rq (ro)
  manage-dockerfile:
    Container ID:  docker://6b880a4b629f45140dc512871fc76638172018855fbdfd6b36dcd385706f9232
    Image:         registry.reg-aws.openshift.com:443/openshift3/ose-sti-builder:v3.9.14
    Image ID:      docker-pullable://registry.reg-aws.openshift.com:443/openshift3/ose-sti-builder@sha256:e8ca49689b4ddf2775bf65c63e9b5c764731c3feca1e246942ff8cc68074e37f
    Port:          <none>
    Command:
      openshift-manage-dockerfile
    Args:
      --loglevel=0
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Sun, 15 Apr 2018 16:09:08 -0400
      Finished:     Sun, 15 Apr 2018 16:09:09 -0400
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  512Mi
    Requests:
      cpu:     50m
      memory:  256Mi
    Environment:
      BUILD:  {"kind":"Build","apiVersion":"v1","metadata":{"name":"nodejs-mongo-persistent-1","namespace":"tlaloc","selfLink":"/apis/build.openshift.io/v1/namespaces/tlaloc/builds/nodejs-mongo-persistent-1","uid":"d47d2052-40e8-11e8-98a3-02ec8e61afcf","resourceVersion":"517479372","creationTimestamp":"2018-04-15T20:08:57Z","labels":{"app":"nodejs-mongo-persistent","buildconfig":"nodejs-mongo-persistent","openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.start-policy":"Serial","template":"nodejs-mongo-persistent"},"annotations":{"openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"nodejs-mongo-persistent","uid":"d4695615-40e8-11e8-a010-02d8407159d1","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/syl20lego/nodejs-ex"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:739c2663e323dc717f5d1e5f29f2301a3be608c1cf2a19842178b2c6d3de0231"},"env":[{"name":"NPM_MIRROR"}],"forcePull":true}},"output":{"to":{"kind":"DockerImage","name":"docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent:latest"},"pushSecret":{"name":"builder-dockercfg-mx2tp"}},"resources":{},"postCommit":{"script":"npm test"},"nodeSelector":null,"triggeredBy":[{"message":"Image change","imageChangeBuild":{"imageID":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:739c2663e323dc717f5d1e5f29f2301a3be608c1cf2a19842178b2c6d3de0231","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"nodejs:6"}}}]},"status":{"phase":"New","outputDockerImageReference":"docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent:latest","config":{"kind":"BuildConfig","namespace":"tlaloc","name":"nodejs-mongo-persistent"},"output":{}}}

      SOURCE_REPOSITORY:  https://github.com/syl20lego/nodejs-ex
      SOURCE_URI:         https://github.com/syl20lego/nodejs-ex
      ORIGIN_VERSION:     v3.9.14
      ALLOWED_UIDS:       1-
      DROP_CAPS:          KILL,MKNOD,SETGID,SETUID
    Mounts:
      /tmp/build from buildworkdir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from builder-token-n88rq (ro)
Containers:
  sti-build:
    Container ID:  docker://28c75f8c3a8e5f49b4c5cc24069ce077569927ae093a895752fd7cebbb918869
    Image:         registry.reg-aws.openshift.com:443/openshift3/ose-sti-builder:v3.9.14
    Image ID:      docker-pullable://registry.reg-aws.openshift.com:443/openshift3/ose-sti-builder@sha256:e8ca49689b4ddf2775bf65c63e9b5c764731c3feca1e246942ff8cc68074e37f
    Port:          <none>
    Command:
      openshift-sti-build
    Args:
      --loglevel=0
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Sun, 15 Apr 2018 16:09:11 -0400
      Finished:     Sun, 15 Apr 2018 16:10:17 -0400
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  512Mi
    Requests:
      cpu:     50m
      memory:  256Mi
    Environment:
      BUILD:  {"kind":"Build","apiVersion":"v1","metadata":{"name":"nodejs-mongo-persistent-1","namespace":"tlaloc","selfLink":"/apis/build.openshift.io/v1/namespaces/tlaloc/builds/nodejs-mongo-persistent-1","uid":"d47d2052-40e8-11e8-98a3-02ec8e61afcf","resourceVersion":"517479372","creationTimestamp":"2018-04-15T20:08:57Z","labels":{"app":"nodejs-mongo-persistent","buildconfig":"nodejs-mongo-persistent","openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.start-policy":"Serial","template":"nodejs-mongo-persistent"},"annotations":{"openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"nodejs-mongo-persistent","uid":"d4695615-40e8-11e8-a010-02d8407159d1","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/syl20lego/nodejs-ex"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:739c2663e323dc717f5d1e5f29f2301a3be608c1cf2a19842178b2c6d3de0231"},"env":[{"name":"NPM_MIRROR"}],"forcePull":true}},"output":{"to":{"kind":"DockerImage","name":"docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent:latest"},"pushSecret":{"name":"builder-dockercfg-mx2tp"}},"resources":{},"postCommit":{"script":"npm test"},"nodeSelector":null,"triggeredBy":[{"message":"Image change","imageChangeBuild":{"imageID":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:739c2663e323dc717f5d1e5f29f2301a3be608c1cf2a19842178b2c6d3de0231","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"nodejs:6"}}}]},"status":{"phase":"New","outputDockerImageReference":"docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent:latest","config":{"kind":"BuildConfig","namespace":"tlaloc","name":"nodejs-mongo-persistent"},"output":{}}}

      SOURCE_REPOSITORY:    https://github.com/syl20lego/nodejs-ex
      SOURCE_URI:           https://github.com/syl20lego/nodejs-ex
      ORIGIN_VERSION:       v3.9.14
      ALLOWED_UIDS:         1-
      DROP_CAPS:            KILL,MKNOD,SETGID,SETUID
      PUSH_DOCKERCFG_PATH:  /var/run/secrets/openshift.io/push
    Mounts:
      /tmp/build from buildworkdir (rw)
      /var/run/crio/crio.sock from crio-socket (rw)
      /var/run/docker.sock from docker-socket (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from builder-token-n88rq (ro)
      /var/run/secrets/openshift.io/push from builder-dockercfg-mx2tp-push (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          False
  PodScheduled   True
Volumes:
  buildworkdir:
    Type:    EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
  docker-socket:
    Type:          HostPath (bare host directory volume)
    Path:          /var/run/docker.sock
    HostPathType:
  crio-socket:
    Type:          HostPath (bare host directory volume)
    Path:          /var/run/crio/crio.sock
    HostPathType:
  builder-dockercfg-mx2tp-push:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  builder-dockercfg-mx2tp
    Optional:    false
  builder-token-n88rq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  builder-token-n88rq
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  type=compute
Tolerations:     node.kubernetes.io/memory-pressure:NoSchedule
Events:          <none>


Name:           nodejs-mongo-persistent-1-w4lh5
Namespace:      tlaloc
Node:           ip-172-31-20-146.ca-central-1.compute.internal/172.31.20.146
Start Time:     Sun, 15 Apr 2018 16:10:22 -0400
Labels:         deployment=nodejs-mongo-persistent-1
                deploymentconfig=nodejs-mongo-persistent
                name=nodejs-mongo-persistent
Annotations:    kubernetes.io/limit-ranger=LimitRanger plugin set: cpu request for container nodejs-mongo-persistent; cpu limit for container nodejs-mongo-persistent
                openshift.io/deployment-config.latest-version=1
                openshift.io/deployment-config.name=nodejs-mongo-persistent
                openshift.io/deployment.name=nodejs-mongo-persistent-1
                openshift.io/scc=restricted
Status:         Running
IP:             10.129.21.51
Controlled By:  ReplicationController/nodejs-mongo-persistent-1
Containers:
  nodejs-mongo-persistent:
    Container ID:   docker://f82c710c8279557b8a63c88c7fba1b41be656a2003461e46c04925fa88c17e25
    Image:          docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent@sha256:5c47c133650aaa0d1600bd967018dbd5de82753d9f0d23eddbc85b267c663cfa
    Image ID:       docker-pullable://docker-registry.default.svc:5000/tlaloc/nodejs-mongo-persistent@sha256:5c47c133650aaa0d1600bd967018dbd5de82753d9f0d23eddbc85b267c663cfa
    Port:           8080/TCP
    State:          Running
      Started:      Sun, 15 Apr 2018 16:10:28 -0400
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  512Mi
    Requests:
      cpu:      50m
      memory:   256Mi
    Liveness:   http-get http://:8080/pagecount delay=30s timeout=3s period=10s #success=1 #failure=3
    Readiness:  http-get http://:8080/pagecount delay=3s timeout=3s period=10s #success=1 #failure=3
    Environment:
      DATABASE_SERVICE_NAME:   mongodb
      MONGODB_USER:            <set to the key 'database-user' in secret 'nodejs-mongo-persistent'>      Optional: false
      MONGODB_PASSWORD:        <set to the key 'database-password' in secret 'nodejs-mongo-persistent'>  Optional: false
      MONGODB_DATABASE:        sampledb
      MONGODB_ADMIN_PASSWORD:  <set to the key 'database-admin-password' in secret 'nodejs-mongo-persistent'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-zfl6x (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          True
  PodScheduled   True
Volumes:
  default-token-zfl6x:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-zfl6x
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  type=compute
Tolerations:     node.kubernetes.io/memory-pressure:NoSchedule
Events:          <none>

Application not available, waits for ever: Recreate deployment is running

I've installed the default catalog: Node.js + MongoDB (Persistent) via web Web Console.

Error if I open the route url
Application is not available

And the WebConsole shows on the Node Pod
Recreate deployment is running

I got this log for the build:
Pushing image 172.30.254.23:5000/husk/nodejs-mongo-persistent:latest ...
Pushed 5/6 layers, 84% complete
Pushed 6/6 layers, 100% complete
Push successful

oc status

In project husk on server https://api.starter-us-west-2.openshift.com:443

svc/mongodb - 172.30.144.37:27017
  dc/mongodb deploys openshift/mongodb:3.2 
    deployment #1 deployed 3 minutes ago - 1 pod

http://nodejs-mongo-persistent-husk.7e14.starter-us-west-2.openshiftapps.com (svc/nodejs-mongo-persistent)
  dc/nodejs-mongo-persistent deploys istag/nodejs-mongo-persistent:latest <-
    bc/nodejs-mongo-persistent source builds https://github.com/openshift/nodejs-ex.git on openshift/nodejs:6 
    deployment #1 running for 2 minutes - 0/1 pods growing to 1

Errors:
  * route/nodejs-mongo-persistent is routing traffic to svc/nodejs-mongo-persistent, but either the administrator has not installed a router or the router is not selecting this route.

oc describe pods

Name:			mongodb-1-qpnp1
Namespace:		husk
Security Policy:	restricted
Node:			ip-172-31-54-218.us-west-2.compute.internal/172.31.54.218
Start Time:		Sat, 07 Oct 2017 10:22:03 +0200
Labels:			deployment=mongodb-1
			deploymentconfig=mongodb
			name=mongodb
Annotations:		kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicationController","namespace":"husk","name":"mongodb-1","uid":"9006eee7-ab38-11e7-a41e-0ab8769191d3",...
			kubernetes.io/limit-ranger=LimitRanger plugin set: cpu request for container mongodb; cpu limit for container mongodb
			openshift.io/deployment-config.latest-version=1
			openshift.io/deployment-config.name=mongodb
			openshift.io/deployment.name=mongodb-1
			openshift.io/scc=restricted
Status:			Running
IP:			10.129.19.162
Controllers:		ReplicationController/mongodb-1
Containers:
  mongodb:
    Container ID:	docker://c3711071b32f5c1fd970450675bcb53b4192352667d30c28cc2a1483a4ddef22
    Image:		registry.access.redhat.com/rhscl/mongodb-32-rhel7@sha256:9d577425aa4dfe939cd0262fe6674001a6a5250799a623d667c35b79cf114de0
    Image ID:		docker-pullable://registry.access.redhat.com/rhscl/mongodb-32-rhel7@sha256:9d577425aa4dfe939cd0262fe6674001a6a5250799a623d667c35b79cf114de0
    Port:		27017/TCP
    State:		Running
      Started:		Sat, 07 Oct 2017 10:22:36 +0200
    Ready:		True
    Restart Count:	0
    Limits:
      cpu:	2
      memory:	1Gi
    Requests:
      cpu:	100m
      memory:	512Mi
    Liveness:	tcp-socket :27017 delay=30s timeout=1s period=10s #success=1 #failure=3
    Readiness:	exec [/bin/sh -i -c mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval="quit()"] delay=3s timeout=1s period=10s #success=1 #failure=3
    Environment:
      MONGODB_USER:		<set to the key 'database-user' in secret 'nodejs-mongo-persistent'>		Optional: false
      MONGODB_PASSWORD:		<set to the key 'database-password' in secret 'nodejs-mongo-persistent'>	Optional: false
      MONGODB_DATABASE:		sampledb
      MONGODB_ADMIN_PASSWORD:	<set to the key 'database-admin-password' in secret 'nodejs-mongo-persistent'>	Optional: false
    Mounts:
      /var/lib/mongodb/data from mongodb-data (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-ttxr1 (ro)
Conditions:
  Type		Status
  Initialized 	True 
  Ready 	True 
  PodScheduled 	True 
Volumes:
  mongodb-data:
    Type:	PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:	mongodb
    ReadOnly:	false
  default-token-ttxr1:
    Type:	Secret (a volume populated by a Secret)
    SecretName:	default-token-ttxr1
    Optional:	false
QoS Class:	Burstable
Node-Selectors:	type=compute
Tolerations:	<none>
Events:
  FirstSeen	LastSeen	Count	From							SubObjectPath			Type	Reason		Message
  ---------	--------	-----	----							-------------			--------	------		-------
  5m		5m		1	default-scheduler									NormaScheduled	Successfully assigned mongodb-1-qpnp1 to ip-172-31-54-218.us-west-2.compute.internal
  4m		4m		1	kubelet, ip-172-31-54-218.us-west-2.compute.internal	spec.containers{mongodb}	NormaPulling		pulling image "registry.access.redhat.com/rhscl/mongodb-32-rhel7@sha256:9d577425aa4dfe939cd0262fe6674001a6a5250799a623d667c35b79cf114de0"
  4m		4m		1	kubelet, ip-172-31-54-218.us-west-2.compute.internal	spec.containers{mongodb}	NormaPulled		Successfully pulled image "registry.access.redhat.com/rhscl/mongodb-32-rhel7@sha256:9d577425aa4dfe939cd0262fe6674001a6a5250799a623d667c35b79cf114de0"
  4m		4m		1	kubelet, ip-172-31-54-218.us-west-2.compute.internal	spec.containers{mongodb}	NormaCreated		Created container
  4m		4m		1	kubelet, ip-172-31-54-218.us-west-2.compute.internal	spec.containers{mongodb}	NormaStarted		Started container


Name:			nodejs-mongo-persistent-1-build
Namespace:		husk
Security Policy:	privileged
Node:			ip-172-31-63-231.us-west-2.compute.internal/172.31.63.231
Start Time:		Sat, 07 Oct 2017 10:21:47 +0200
Labels:			openshift.io/build.name=nodejs-mongo-persistent-1
Annotations:		kubernetes.io/limit-ranger=LimitRanger plugin set: cpu, memory request for container sti-build; cpu, memory limit for container sti-build
			openshift.io/build.name=nodejs-mongo-persistent-1
			openshift.io/scc=privileged
Status:			Succeeded
IP:			10.129.25.122
Controllers:		<none>
Containers:
  sti-build:
    Container ID:	docker://1243ab3f375bce22e30f0932f25d476303e5f011c64c2d3429a22ec126d7d118
    Image:		registry.ops.openshift.com/openshift3/ose-sti-builder:v3.6.173.0.5
    Image ID:		docker-pullable://registry.ops.openshift.com/openshift3/ose-sti-builder@sha256:36c039209e3a732c459d3fd7c85d8ca1a516a0e3341056581a4a9e893e7a0306
    Port:		
    Args:
      --loglevel=0
    State:		Terminated
      Reason:		Completed
      Exit Code:	0
      Started:		Sat, 07 Oct 2017 10:22:05 +0200
      Finished:		Sat, 07 Oct 2017 10:22:48 +0200
    Ready:		False
    Restart Count:	0
    Limits:
      cpu:	1
      memory:	512Mi
    Requests:
      cpu:	50m
      memory:	256Mi
    Environment:
      BUILD:	{"kind":"Build","apiVersion":"v1","metadata":{"name":"nodejs-mongo-persistent-1","namespace":"husk","selfLink":"/apis/build.openshift.io/v1/namespaces/husk/builds/nodejs-mongo-persistent-1","uid":"8fec8b85-ab38-11e7-a41e-0ab8769191d3","resourceVersion":"1486242443","creationTimestamp":"2017-10-07T08:21:47Z","labels":{"app":"nodejs-mongo-persistent","buildconfig":"nodejs-mongo-persistent","openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.start-policy":"Serial","template":"nodejs-mongo-persistent"},"annotations":{"openshift.io/build-config.name":"nodejs-mongo-persistent","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"nodejs-mongo-persistent","uid":"8fdedbd0-ab38-11e7-8a41-0a2a2b777307","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/openshift/nodejs-ex.git"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:b0b80d7bb0a1d69ef513a063c5fb3b074b02f699fd5437051233932dae7c864a"},"env":[{"name":"NPM_MIRROR"}],"forcePull":true}},"output":{"to":{"kind":"DockerImage","name":"172.30.254.23:5000/husk/nodejs-mongo-persistent:latest"},"pushSecret":{"name":"builder-dockercfg-gfs81"}},"resources":{},"postCommit":{"script":"npm test"},"nodeSelector":null,"triggeredBy":[{"message":"Image change","imageChangeBuild":{"imageID":"registry.access.redhat.com/rhscl/nodejs-6-rhel7@sha256:b0b80d7bb0a1d69ef513a063c5fb3b074b02f699fd5437051233932dae7c864a","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"nodejs:6"}}}]},"status":{"phase":"New","outputDockerImageReference":"172.30.254.23:5000/husk/nodejs-mongo-persistent:latest","config":{"kind":"BuildConfig","namespace":"husk","name":"nodejs-mongo-persistent"},"output":{}}}

      SOURCE_REPOSITORY:	https://github.com/openshift/nodejs-ex.git
      SOURCE_URI:		https://github.com/openshift/nodejs-ex.git
      ORIGIN_VERSION:		v3.6.173.0.5
      ALLOWED_UIDS:		1-
      DROP_CAPS:		KILL,MKNOD,SETGID,SETUID,SYS_CHROOT
      PUSH_DOCKERCFG_PATH:	/var/run/secrets/openshift.io/push
    Mounts:
      /var/run/docker.sock from docker-socket (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from builder-token-pdjqf (ro)
      /var/run/secrets/openshift.io/push from builder-dockercfg-gfs81-push (ro)
Conditions:
  Type		Status
  Initialized 	True 
  Ready 	False 
  PodScheduled 	True 
Volumes:
  docker-socket:
    Type:	HostPath (bare host directory volume)
    Path:	/var/run/docker.sock
  builder-dockercfg-gfs81-push:
    Type:	Secret (a volume populated by a Secret)
    SecretName:	builder-dockercfg-gfs81
    Optional:	false
  builder-token-pdjqf:
    Type:	Secret (a volume populated by a Secret)
    SecretName:	builder-token-pdjqf
    Optional:	false
QoS Class:	Burstable
Node-Selectors:	type=compute
Tolerations:	<none>
Events:
  FirstSeen	LastSeen	Count	From							SubObjectPath			Type	Reason		Message
  ---------	--------	-----	----							-------------			--------	------		-------
  5m		5m		1	default-scheduler									NormaScheduled	Successfully assigned nodejs-mongo-persistent-1-build to ip-172-31-63-231.us-west-2.compute.internal
  5m		5m		1	kubelet, ip-172-31-63-231.us-west-2.compute.internal	spec.containers{sti-build}	NormaPulling		pulling image "registry.ops.openshift.com/openshift3/ose-sti-builder:v3.6.173.0.5"
  5m		5m		1	kubelet, ip-172-31-63-231.us-west-2.compute.internal	spec.containers{sti-build}	NormaPulled		Successfully pulled image "registry.ops.openshift.com/openshift3/ose-sti-builder:v3.6.173.0.5"
  5m		5m		1	kubelet, ip-172-31-63-231.us-west-2.compute.internal	spec.containers{sti-build}	NormaCreated		Created container
  5m		5m		1	kubelet, ip-172-31-63-231.us-west-2.compute.internal	spec.containers{sti-build}	NormaStarted		Started container
  2m		2m		1	kubelet, ip-172-31-63-231.us-west-2.compute.internal					Warning		FailedMount	Unable to mount volumes for pod "nodejs-mongo-persistent-1-build_husk(8ff1bea6-ab38-11e7-a41e-0ab8769191d3)": timeout expired waiting for volumes to attach/mount for pod "husk"/"nodejs-mongo-persistent-1-build". list of unattached/unmounted volumes=[docker-socket builder-dockercfg-gfs81-push builder-token-pdjqf]
  2m		2m		1	kubelet, ip-172-31-63-231.us-west-2.compute.internal					Warning		FailedSync	Error syncing pod


Name:			nodejs-mongo-persistent-1-deploy
Namespace:		husk
Security Policy:	restricted
Node:			ip-172-31-50-162.us-west-2.compute.internal/172.31.50.162
Start Time:		Sat, 07 Oct 2017 10:22:48 +0200
Labels:			openshift.io/deployer-pod-for.name=nodejs-mongo-persistent-1
Annotations:		kubernetes.io/limit-ranger=LimitRanger plugin set: cpu, memory request for container deployment; cpu, memory limit for container deployment
			openshift.io/deployment.name=nodejs-mongo-persistent-1
			openshift.io/scc=restricted
Status:			Running
IP:			10.130.127.202
Controllers:		<none>
Containers:
  deployment:
    Container ID:	docker://f50e6b9764122223c15c8c05f94a677c32d307157755f23703a5f086d59bba01
    Image:		registry.ops.openshift.com/openshift3/ose-deployer:v3.6.173.0.5
    Image ID:		docker-pullable://registry.ops.openshift.com/openshift3/ose-deployer@sha256:b2f160d0edf98fe161cb27ee694e5995f543dd631306573d735ac9eb1807244c
    Port:		
    State:		Running
      Started:		Sat, 07 Oct 2017 10:23:48 +0200
    Ready:		True
    Restart Count:	0
    Limits:
      cpu:	1
      memory:	512Mi
    Requests:
      cpu:	50m
      memory:	256Mi
    Environment:
      KUBERNETES_MASTER:	https://ip-172-31-50-164.us-west-2.compute.internal
      OPENSHIFT_MASTER:		https://ip-172-31-50-164.us-west-2.compute.internal
      BEARER_TOKEN_FILE:	/var/run/secrets/kubernetes.io/serviceaccount/token
      OPENSHIFT_CA_DATA:	-----BEGIN CERTIFICATE-----
MIIC6jCCAdKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBtvcGVu
c2hpZnQtc2lnbmVyQDE0OTMzMzU1ODIwHhcNMTcwNDI3MjMyNjIyWhcNMjIwNDI2
MjMyNjIzWjAmMSQwIgYDVQQDDBtvcGVuc2hpZnQtc2lnbmVyQDE0OTMzMzU1ODIw
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPUg0F78yfoFVJp20knL1j
uhLqh/MTu81CJXabjVHBte5bf4iPx6Y03FWbihFIkqO0LqSOVGafKhZPGRKPcQ4I
snz+SF05WTZVFCFh/sv1Zq2u8ZVdmaSIswlG7iws4TAyTSQoZQreWBb5URg5hV3o
k+KE23oSOEC5sxsIgvEsFp4S0JvUxj0yspjkuCQu6k11N3OkPnYd3r8TYYA0FqzO
rTFAf9PihMXnDo3mZUKKFS1pQnDgYXxcLV9WPpKOUqMr2ejU0g7S78zPXUfHMOnx
9pVxOAOUl62HZGgnPJ3NQchKfhe621Doi0quUPm4S2zKbIFvjx2mX+lmBtes1KbX
AgMBAAGjIzAhMA4GA1UdDwEB/wQEAwICpDAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
SIb3DQEBCwUAA4IBAQBWkKw3HobKxLsWmZpabJiHWUyxbvihsCICjuqTnewNNWao
IJOofFV02Lc1BVaSBgiPeGLHh6KtDmX37YfHrNDaC8GOIzyTIsFFBRVUz599mt3d
GmE8P3NkebWWc24crUlBR8aW9JQxcANnXRNszb0uKYIRw0ew8rpTfEZTHJRNFdUZ
MMq3a6EytlaZET8nGMHd8mUBrtZtNGY960+ZzkAn4oQwEbNQpdu5f48pbOcRWi59
M3QcgEqKs/AezFClo18O1L2ECR9JAOEu/nScaZQIcYcYkCPJEOjUuqjXwuHuT8kG
ehiZQzwqOJHbJOFlp4wkRxg8h72wISmaNuvhBsEO
-----END CERTIFICATE-----

      OPENSHIFT_DEPLOYMENT_NAME:	nodejs-mongo-persistent-1
      OPENSHIFT_DEPLOYMENT_NAMESPACE:	husk
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from deployer-token-t7hkp (ro)
Conditions:
  Type		Status
  Initialized 	True 
  Ready 	True 
  PodScheduled 	True 
Volumes:
  deployer-token-t7hkp:
    Type:	Secret (a volume populated by a Secret)
    SecretName:	deployer-token-t7hkp
    Optional:	false
QoS Class:	Burstable
Node-Selectors:	type=compute
Tolerations:	<none>
Events:
  FirstSeen	LastSeen	Count	From							SubObjectPath			Type	Reason		Message
  ---------	--------	-----	----							-------------			--------	------		-------
  4m		4m		1	default-scheduler									NormaScheduled	Successfully assigned nodejs-mongo-persistent-1-deploy to ip-172-31-50-162.us-west-2.compute.internal
  4m		4m		1	kubelet, ip-172-31-50-162.us-west-2.compute.internal	spec.containers{deployment}	NormaPulling		pulling image "registry.ops.openshift.com/openshift3/ose-deployer:v3.6.173.0.5"
  3m		3m		1	kubelet, ip-172-31-50-162.us-west-2.compute.internal	spec.containers{deployment}	NormaPulled		Successfully pulled image "registry.ops.openshift.com/openshift3/ose-deployer:v3.6.173.0.5"
  3m		3m		1	kubelet, ip-172-31-50-162.us-west-2.compute.internal	spec.containers{deployment}	NormaCreated		Created container
  3m		3m		1	kubelet, ip-172-31-50-162.us-west-2.compute.internal	spec.containers{deployment}	NormaStarted		Started container

Access log to stdout

The application should output its access log to stdout, so that oc logs show the logs.

nodejs-ex app does not work with nodejs v10

s2i build https://github.com/sclorg/nodejs-ex.git centos/nodejs-10-centos7 testimgnode
Your branch is up to date with 'origin/master'.
---> Installing application source ...
---> Installing all dependencies
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! invalid distance too far back
npm notice created a lockfile as package-lock.json. You should commit this file.
added 117 packages from 342 contributors in 16.2s
npm ERR! Callback called more than once.

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app-root/src/.npm/_logs/2019-02-15T06_42_11_908Z-debug.log
Build failed
ERROR: An error occurred: non-zero (13) exit code from centos/nodejs-10-centos7

How to use an image nodejs: 8?

In RedHat Container Catalog there is the image:

registry.access.redhat.com/rhscl-beta/nodejs-8-rhel7

how can I use it in the repository example?

Produces a 404 for path-based routing but works for host-based routing

When I deploy this application to Origin, if I use host based routing, the application runs fine. Here is an example Origin route definition that works:

apiVersion: v1
kind: Route
metadata:
  name: nodejs-ex
  namespace: test
  selfLink: /oapi/v1/namespaces/test/routes/nodejs-ex
  uid: aba40cb4-c6ba-11e5-8245-525400659b2e
  resourceVersion: '3418'
  creationTimestamp: '2016-01-29T19:01:15Z'
  labels:
    app: nodejs-ex
spec:
  host: nodejs-ex.origin.local
  to:
    kind: Service
    name: nodejs-ex
  port:
    targetPort: 8080
status: {  }

But if I do path based routing, it fails. Here is an example Origin route definition that does not work:

apiVersion: v1
kind: Route
metadata:
  name: nodejs-ex
  namespace: test
  selfLink: /oapi/v1/namespaces/test/routes/nodejs-ex
  uid: 65190bae-c6bb-11e5-8245-525400659b2e
  resourceVersion: '3511'
  creationTimestamp: '2016-01-29T19:06:26Z'
  labels:
    app: nodejs-ex
spec:
  host: origin.local
  path: /nodejs-ex
  to:
    kind: Service
    name: nodejs-ex
  port:
    targetPort: 8080
status: {  }

There are no errors printed to the pod logs and the only pertinent error I see in the browser is the Cannot GET /nodejs-ex (or 404) from Express. I realize this is likely due to the Express mountpath needing to be set. (If that is the case, it would be great if this could be configurable via an environment variable so you can throw the setting in your pod definition.)

In all honesty, I would had expected a client request to /nodejs-ex to be seen as a request to / at the container/pod level but that's more of an Origin issue...or an expectation issue.

Feel free to punt on this. I just figured that since I ran into it I would report it. For local development, I like doing path based routing so that I only have to update /etc/hosts once and that's how I ran into this.

Deploying nodejs-ex into OpenShift 4.4 does not work

Commands used for deploying image:

$ oc process -f https://raw.githubusercontent.com/sclorg/nodejs-ex/master/openshift/templates/nodejs.json | oc apply -f -

service "nodejs-example" created
route.route.openshift.io "nodejs-example" created
imagestream.image.openshift.io "nodejs-example" created
buildconfig.build.openshift.io "nodejs-example" created
deploymentconfig.apps.openshift.io "nodejs-example" created

OCP status:

$ oc status
In project default on server https://api.ocp4.ocp.local:6443

svc/kubernetes - 172.30.0.1:443 -> 6443

http://nodejs-example-default.apps.ocp4.ocp.local (svc/nodejs-example)
  dc/nodejs-example deploys istag/nodejs-example:latest <-
    bc/nodejs-example source builds https://github.com/sclorg/nodejs-ex.git on openshift/nodejs:8
      not built yet
    deployment #1 waiting on image or update

2 warnings identified, use 'oc status -v' to see details.

starting build:

$ oc start-build nodejs-example --follow
The ImageStreamTag "nodejs:8" is invalid: from: Error resolving ImageStreamTag nodejs:8 in namespace openshift: unable to find latest tagged image

@hhorak @pkubatrh CC

cannot pull images from docker registry

W0629 20:26:40.909717 16192 dockerimagelookup.go:220] Docker registry lookup failed: Get https://registry-1.docker.io/v2/: http: error connecting to proxy
https://127.0.0.1:8087: dial tcp 127.0.0.1:8087: getsockopt: connection refused
error: no tags found on matching image stream: "openshift/nodejs"

The image stream "openshift/nodejs" exists, but it has no tags.

Use --allow-missing-imagestream-tags to use this image stream

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.