$ oc describe is nodejs -n openshift
After you push the init
image to a cluster with a mirrored registry, you must mirror a supported builder image for your application with the oc
tool, overwrite the mirror registry using the environment variable, and then create your component.
Install oc
on the client operating system.
Install odo
on the client operating system.
Access to an restricted cluster with a configured internal registry or a mirror registry.
To use npm packages for Node.js dependencies and Maven packages for Java dependencies and configure a runtime environment for your application, you must mirror a respective builder image from the mirror registry.
Verify that the required images tag is not imported:
$ oc describe is nodejs -n openshift
Name: nodejs
Namespace: openshift
[...]
10
tagged from <mirror-registry>:<port>/rhoar-nodejs/nodejs-10
prefer registry pullthrough when referencing this tag
Build and run Node.js 10 applications on RHEL 7. For more information about using this builder image, including OpenShift considerations, see https://github.com/nodeshift/centos7-s2i-nodejs.
Tags: builder, nodejs, hidden
Example Repo: https://github.com/sclorg/nodejs-ex.git
! error: Import failed (NotFound): dockerimage.image.openshift.io "<mirror-registry>:<port>/rhoar-nodejs/nodejs-10:latest" not found
About an hour ago
10-SCL (latest)
tagged from <mirror-registry>:<port>/rhscl/nodejs-10-rhel7
prefer registry pullthrough when referencing this tag
Build and run Node.js 10 applications on RHEL 7. For more information about using this builder image, including OpenShift considerations, see https://github.com/nodeshift/centos7-s2i-nodejs.
Tags: builder, nodejs
Example Repo: https://github.com/sclorg/nodejs-ex.git
! error: Import failed (NotFound): dockerimage.image.openshift.io "<mirror-registry>:<port>/rhscl/nodejs-10-rhel7:latest" not found
About an hour ago
[...]
Mirror the supported image tag to the private registry:
$ oc image mirror registry.access.redhat.com/rhscl/nodejs-10-rhel7:<tag> <private_registry>/rhscl/nodejs-10-rhel7:<tag>
Import the image:
$ oc tag <mirror-registry>:<port>/rhscl/nodejs-10-rhel7:<tag> nodejs-10-rhel7:latest --scheduled
You must periodically re-import the image. The --scheduled
flag enables automatic re-import of the image.
Verify that the images with the given tag have been imported:
$ oc describe is nodejs -n openshift
Name: nodejs
[...]
10-SCL (latest)
tagged from <mirror-registry>:<port>/rhscl/nodejs-10-rhel7
prefer registry pullthrough when referencing this tag
Build and run Node.js 10 applications on RHEL 7. For more information about using this builder image, including OpenShift considerations, see https://github.com/nodeshift/centos7-s2i-nodejs.
Tags: builder, nodejs
Example Repo: https://github.com/sclorg/nodejs-ex.git
* <mirror-registry>:<port>/rhscl/nodejs-10-rhel7@sha256:d669ecbc11ac88293de50219dae8619832c6a0f5b04883b480e073590fab7c54
3 minutes ago
[...]
To download npm packages for Node.js dependencies and Maven packages for Java dependencies from a private mirror registry, you must create and configure a mirror npm or Maven registry on the cluster. You can then overwrite the mirror registry on an existing component or when you create a new component.
To overwrite the mirror registry on an existing component:
$ odo config set --env NPM_MIRROR=<npm_mirror_registry>
To overwrite the mirror registry when creating a component:
$ odo component create nodejs --env NPM_MIRROR=<npm_mirror_registry>
To create a Node.js component, download the Node.js application and push the source code to your cluster with odo
.
Change the current directory to the directory with your application:
$ cd <directory_name>
Add a component of the type Node.js to your application:
$ odo create nodejs
By default, the latest image is used. You can also explicitly specify an image version by using odo create openshift/nodejs:8 .
|
Push the initial source code to the component:
$ odo push
Your component is now deployed to OpenShift Container Platform.
Create a URL and add an entry in the local configuration file as follows:
$ odo url create --port 8080
Push the changes. This creates a URL on the cluster.
$ odo push
List the URLs to check the desired URL for the component.
$ odo url list
View your deployed application using the generated URL.
$ curl <url>