Skip to content

Commit

Permalink
dropping DEV_MODE support, releasing 4.4.3-lts
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanj committed Apr 20, 2016
1 parent 294dc8b commit 17ec605
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 89 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Versions

* `0.10.44` `0.10`
* `0.12.13` `0.12`
* `4.4.2` `4.4` `4` `lts`
* `4.4.3` `4.4` `4` `lts`
* `5.10.1` `5.10` `5` `stable` `latest`

Usage
Expand Down Expand Up @@ -86,7 +86,7 @@ Users can choose between testing a Node.JS test application based on a RHEL or C

```
$ cd sti-nodejs
$ make test VERSION=5.10.1
$ make test VERSIONS="0.10.44 0.12.13 4.4.3 5.10.1"
```

Repository organization
Expand Down
5 changes: 2 additions & 3 deletions hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
# image, if the tests pass.
# VERSIONS - a list of possible versions, can be provided instead of VERSION

VERSION=${1-$VERSION}
VERSIONS=${2-$VERSIONS}
OS=${3-$OS}
OS=${1-$OS}
VERSION=${2-$VERSION}

DOCKERFILE="Dockerfile"
NAMESPACE="ryanj/"
Expand Down
10 changes: 5 additions & 5 deletions hack/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ else
endif

script_env = \
SKIP_SQUASH=$(SKIP_SQUASH) \
VERSIONS="$(VERSIONS)" \
OS=$(OS) \
BASE_IMAGE_NAME=$(BASE_IMAGE_NAME) \
VERSION=$(VERSION)
SKIP_SQUASH="$(SKIP_SQUASH)" \
VERSIONS="$(VERSIONS)" \
OS="$(OS)" \
BASE_IMAGE_NAME="$(BASE_IMAGE_NAME)" \
VERSION="$(VERSION)"

.PHONY: build
build:
Expand Down
10 changes: 5 additions & 5 deletions image-streams.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
},
"from": {
"kind": "ImageStreamTag",
"name": "4.4.2"
"name": "4.4.3"
}
},
{
Expand All @@ -93,7 +93,7 @@
},
"from": {
"kind": "ImageStreamTag",
"name": "4.4.2"
"name": "4.4.3"
}
},
{
Expand All @@ -107,11 +107,11 @@
},
"from": {
"kind": "ImageStreamTag",
"name": "4.4.2"
"name": "4.4.3"
}
},
{
"name": "4.4.2",
"name": "4.4.3",
"annotations": {
"description": "Build and run NodeJS applications",
"iconClass": "icon-nodejs",
Expand All @@ -121,7 +121,7 @@
},
"from": {
"kind": "DockerImage",
"name": "ryanj/centos7-s2i-nodejs:4.4.2"
"name": "ryanj/centos7-s2i-nodejs:4.4.3"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion nodejs.org/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN set -ex && \
curl -o SHASUMS256.txt.asc -sSL https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt.asc && \
gpg --batch -d SHASUMS256.txt.asc | grep " node-v${NODE_VERSION}-linux-x64.tar.gz\$" | sha256sum -c - && \
tar -zxf node-v${NODE_VERSION}-linux-x64.tar.gz -C /usr/local --strip-components=1 && \
npm install -g npm@${NPM_VERSION} nodemon && \
npm install -g npm@${NPM_VERSION} && \
find /usr/local/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf; \
rm -rf ~/node-v${NODE_VERSION}-linux-x64.tar.gz ~/SHASUMS256.txt.asc /tmp/node-v${NODE_VERSION} ~/.npm ~/.node-gyp ~/.gnupg \
/usr/share/man /tmp/* /usr/local/lib/node_modules/npm/man /usr/local/lib/node_modules/npm/doc /usr/local/lib/node_modules/npm/html
Expand Down
66 changes: 0 additions & 66 deletions nodejs.org/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,37 +88,6 @@ Example: DATABASE_USER=sampleUser

Setting the HTTP_PROXY or HTTPS_PROXY environment variable will set the appropriate npm proxy configuration during assembly.

Development Mode
---------------------
This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`.
Development mode supports two features:
* Hot Deploy
* Debugging

The debug port can be speicifed with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`.

A simple example command for running the docker container in production mode is:
```
docker run --env DEV_MODE=true my-image-id
```

To run the container in development mode with a debug port of 5454, run:
```
$ docker run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id
```

To run the container in production mode, run:
```
$ docker run --env DEV_MODE=false my-image-id
```

By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`.

Hot deploy
--------------------

As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application.

### Using Docker's exec

To change your source code in a running container, use Docker's [exec](http://docker.io) command:
Expand All @@ -131,38 +100,3 @@ After you [Docker exec](http://docker.io) into the running container, your curre
### Using OpenShift's rsync

If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod.

#### Warning:

The default behaviour of the sti-nodejs docker image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute.

Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately:

```json
{
"name": "node-echo",
"version": "0.0.1",
"description": "node-echo",
"main": "example.js", <--- main attribute
"dependencies": {
},
"devDependencies": {
"nodemon": "*"
},
"engine": {
"node": "*",
"npm": "*"
},
"scripts": {
"dev": "nodemon --ignore node_modules/ server.js",
"start": "node server.js" <-- start script
},
"keywords": [
"Echo"
],
"license": "",
}
```

#### Note:
`oc rsync` is only available in versions 3.1+ of OpenShift.
9 changes: 2 additions & 7 deletions nodejs.org/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

set -e

# Runs the nodejs application server. If the container is run in development mode,
# hot deploy and debugging are enabled.
# Runs the nodejs application server.
run_node() {
if [ "$DEV_MODE" == true ]; then
exec nodemon --debug="$DEBUG_PORT"
else
exec npm start -d
fi
exec npm start -d
}

# If the official dockerhub node image is used, skip the SCL setup below
Expand Down

0 comments on commit 17ec605

Please sign in to comment.