<commit_before>= NodeJS
{product-author}
{product-version}
:data-uri:
:icons:
:experimental:
:toc: macro
:toc-title:

toc::[]

== Overview
Our OpenShift https://github.com/openshift/sti-nodejs/tree/master/0.10[NodeJS] image repository contains the sources and Dockerfiles for building various versions of NodeJS platform images. The resulting images can be run either by Docker or using https://github.com/openshift/source-to-image[STI].

== Versions
Current supported versions of NodeJS:

* https://github.com/openshift/sti-nodejs/tree/master/0.10[0.10]

== Base Images

* RHEL-7
* CentOS-7

[NOTE]
====
RHEL-7 image is not available as trusted build in https://index.docker.io[Docker Index]. In order to perform build or test action on a RHEL-7 based NodaJS image, you need to run the build on properly subscribed RHEL-7 machine.
====

== Installation
To build NodeJS image, choose between CentOS7 or RHEL7 base image:

=== RHEL-7 base image

----
$ git clone https://github.com/openshift/sti-nodejs.git
$ cd sti-nodejs
$ make build TARGET=rhel7 VERSION=0.10
----

=== CentOS-7 base image

----
$ git clone https://github.com/openshift/sti-nodejs.git
$ cd sti-nodejs
$ make build VERSION=0.10
----

[NOTE]
====
By omitting the `VERSION` parameter, the build/test action will be performed on all the supported versions of NodeJS. Since we are now supporting only version `0.10`, you can omit this parameter
====

== Usage
Building simple https://github.com/ryanj/node-echo[nodejs-echo-app] NodeJS application, using standalone https://github.com/openshift/source-to-image[STI] and running the resulting image by http://docker.io[Docker]

=== RHEL-7 base image

----
$ sti build https://github.com/ryanj/node-echo.git openshift/nodejs-010-rhel7 nodejs-echo-app
$ docker run -p 3000:3000 nodejs-echo-app
----

=== CentOS-7 base image

----
$ sti build https://github.com/ryanj/node-echo.git openshift/nodejs-010-centos7 nodejs-echo-app
$ docker run -p 3000:3000 nodejs-echo-app
----

To access and test if the application is running run:
----
$ curl 127.0.0.1:3000
----

== Test
OpenShift https://github.com/openshift/sti-nodejs/tree/master/0.10[STI-NodeJS] repository also provides STI test framework, which launches test to check functionality of a simple nodejs application built on top of sti-nodejs image.

=== RHEL-7 base image

----
$ cd sti-nodejs
$ make test TARGET=rhel7 VERSION=0.10
----

=== CentOS-7 base image

----
$ cd sti-nodejs
$ make test VERSION=0.10
----

[NOTE]
====
By omitting the `VERSION` parameter, the build/test action will be performed on all the supported versions of NodeJS. Since we are now supporting only version `0.10`, you can omit this parameter
====

== Repository organization

* `/nodejs-version/`
** `Dockerfile` - CentOS7 based Dockerfile.
** `Dockerfile.rhel7` - RHEL7 based Dockerfile.
** `.sti/bin/` - This folder contains scripts that are run by https://github.com/openshift/source-to-image[STI]:
*** `assemble` - Is used to install the sources into location from where the application  will be run and prepare the application for deployment (eg. installing modules using npm, etc..).
*** `run` - This script is responsible for running the application, by using the application web server.
*** `save-artifacts` - In order to do an *incremental build* (iow. re-use the build artifacts from an already built image in a new image), this script is responsible for archiving those. In this image, this script will archive all dependent modules.
** `nodejs/` - This folder contains file with commonly used modules.
** `test/` - This folder is containing STI test framework with simple node.js echo server.
*** `test-app/` - Simple node.js echo server for used for testing purposes in the STI test framework.
*** `run` - Script that runs the STI test framework.
* `hack/` - Folder contains scripts which are responsible for build and test actions performed by the `Makefile`.
* `Makefile` - Make utility for simplifying image build and test actions.

== Environment variables

* *APP_ROOT* - This variable specifies a relative location to your application inside the
    application GIT repository. In case your application is located in a
    sub-folder, you can set this variable to a *./myapplication*.

* *STI_SCRIPTS_URL* - This variable specifies the location of directory, where *assemble*, *run* and
    *save-artifacts* scripts are downloaded/copied from. By default the scripts
    in this repository will be used, but users can provide an alternative
    location and run their own scripts.
					- Default https://raw.githubusercontent.com/openshift/sti-nodejs/master/0.10/.sti/bin[<nodejs-version>/.sti/bin]<commit_msg>edits to the nodejs topic<commit_after>= NodeJS
{product-author}
{product-version}
:data-uri:
:icons:
:experimental:
:toc: macro
:toc-title:

toc::[]

== Overview
The OpenShift https://github.com/openshift/sti-nodejs/tree/master/0.10[NodeJS] image repository contains the sources and Dockerfiles for building various versions of NodeJS platform images. The resulting images can be run either by Docker or using https://github.com/openshift/source-to-image[STI].

== Versions
Currently, OpenShift only supports version https://github.com/openshift/sti-nodejs/tree/master/0.10[0.10] of NodeJS.

== Base Images

* RHEL-7
* CentOS-7

[NOTE]
====
RHEL-7 image is not available as trusted build in https://index.docker.io[Docker Index]. In order to perform build or test action on a RHEL-7 based NodeJS image, you need to run the build on properly subscribed RHEL-7 machine.
====

== Installation
To build NodeJS image, select either a RHEL7 or CentOS7 base image:

=== RHEL-7 base image

----
$ git clone https://github.com/openshift/sti-nodejs.git
$ cd sti-nodejs
$ make build TARGET=rhel7 VERSION=0.10
----

=== CentOS-7 base image

----
$ git clone https://github.com/openshift/sti-nodejs.git
$ cd sti-nodejs
$ make build VERSION=0.10
----

[NOTE]
====
If you omit the `VERSION` parameter, the build/test action is performed on all supported versions of NodeJS. Since version `0.10` is the only version supported, you can omit this parameter.
====

== Usage
To build a simple https://github.com/ryanj/node-echo[nodejs-echo-app] NodeJS application, use a standalone https://github.com/openshift/source-to-image[STI] and run the resulting image using http://docker.io[Docker].

=== RHEL-7 base image

----
$ sti build https://github.com/ryanj/node-echo.git openshift/nodejs-010-rhel7 nodejs-echo-app
$ docker run -p 3000:3000 nodejs-echo-app
----

=== CentOS-7 base image

----
$ sti build https://github.com/ryanj/node-echo.git openshift/nodejs-010-centos7 nodejs-echo-app
$ docker run -p 3000:3000 nodejs-echo-app
----

To access and test if the application is running:
----
$ curl 127.0.0.1:3000
----

== Test
The OpenShift https://github.com/openshift/sti-nodejs/tree/master/0.10[STI-NodeJS] repository also provides the STI test framework, which tests the functionality of a simple NodeJS application built on top of an STI-NodeJS image.

=== RHEL-7 base image

----
$ cd sti-nodejs
$ make test TARGET=rhel7 VERSION=0.10
----

=== CentOS-7 base image

----
$ cd sti-nodejs
$ make test VERSION=0.10
----

[NOTE]
====
If you omit the `VERSION` parameter, the build/test action is performed on all supported versions of NodeJS. Since version `0.10` is the only version supported, you can omit this parameter.
====

== Repository Organization

.Repository organization
[cols=".^2,.^2,8",options="header"]
|===

|Location |File |Description

|`/nodejs-version/`
|`Dockerfile`
|CentOS7-based Dockerfile.

|`/nodejs-version/`
|`Dockerfile.rhel7`
|RHEL7 based Dockerfile.

|`/nodejs-version/.sti/bin/`
|
|This folder contains scripts that are run by https://github.com/openshift/source-to-image[STI].

|`/nodejs-version/.sti/bin/`
|`assemble`
|Installs the sources into the location from which the application will be run, and prepares the application for deployment; for example, installing modules using npm.

|`/nodejs-version/.sti/bin/`
|`run`
|This script is responsible for using the application web server to run the application.

|`/nodejs-version/.sti/bin/`
|`save-artifacts`
|This script archives all dependent modules in this image in order to perform an incremental build. An incremental build reuses the build artifacts from a previously-built image to create a new image.

|`nodejs-version/nodejs/`
|
|This folder contains files with commonly used modules.

|`nodejs-version/test/`
|
|This folder contains STI test framework with a simple node.js echo server.

|`nodejs-version/test/`
|`test-app/`
|Simple node.js echo server used for testing within the STI test framework.

|`nodejs-version/test/`
|`run`
|Script that runs the STI test framework.

|===

== Environment variables

* *APP_ROOT* - This variable specifies a relative location to your application inside the
    application GIT repository. In case your application is located in a
    sub-folder, you can set this variable to a *./myapplication*.

* *STI_SCRIPTS_URL* - This variable specifies the location of directory, where *assemble*, *run* and
    *save-artifacts* scripts are downloaded/copied from. By default the scripts
    in this repository will be used, but users can provide an alternative
    location and run their own scripts.
					- Default https://raw.githubusercontent.com/openshift/sti-nodejs/master/0.10/.sti/bin[<nodejs-version>/.sti/bin]
{'fraction_non_alphanumeric': 0.11819148936170212, 'fraction_numerical': 0.018404255319148938, 'mean_word_length': 3.9505002632964716, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 26, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5086876', 'n_tokens_mistral': 3043, 'n_tokens_neox': 2851, 'n_words': 1052}