Skip to content

Commit

Permalink
Applying suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
pacostas committed Nov 25, 2022
1 parent f58bf6f commit a59f33d
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 33 deletions.
12 changes: 8 additions & 4 deletions 14-minimal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ Application developers can use the following environment variables to configure
Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use.

**`NODE_CMD`**
When specified (e.g.Specify `NODE_CMD="node server.js"`) the `NODE_CMD` is executed by the `init-wrapper` script, which handles reaping zombie processes and signal forwarding (SIGINT, SIGTERM) to Node.js application.
When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`.

**`INIT_WRAPPER`**
When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application.

#### Additional variables used in the full-sized image

Expand Down Expand Up @@ -318,13 +321,14 @@ Below is an example _package.json_ file with the _main_ attribute and _start_ sc

## init-wrapper

init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used for preventing below circumstances:
init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle:

- Proper signal handling and propagation, as Node.js was not designed to run as PID 1.
- Reaping zombie child processes
- Avoiding use of npm, more information on [reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application)
Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start.

A detailed explanation on how the init-wrapper script works is avalable on [this url](http://veithen.io/2014/11/16/sigterm-propagation.html).
A detailed explanation on how the init-wrapper script works is avalable in
[this url](http://veithen.io/2014/11/16/sigterm-propagation.html).

Example of using init-wrapper:

Expand Down
3 changes: 1 addition & 2 deletions 14-minimal/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ run_node() {
echo "exec $NODE_CMD"
fi
elif [ "$INIT_WRAPPER" == true ]; then

if [ -f "server.js" ]; then
start_file="server.js"
elif [ -f "index.js" ]; then
start_file="main.js"
start_file="index.js"
elif [ -f "main.js" ]; then
start_file="main.js"
else
Expand Down
12 changes: 8 additions & 4 deletions 14/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ Application developers can use the following environment variables to configure
Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use.

**`NODE_CMD`**
When specified e.g. `NODE_CMD="node server.js"` the application will start by using the command `node server.js`.
When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`.

**`INIT_WRAPPER`**
When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application.

**`HTTP_PROXY`**
Use an npm proxy during assembly
Expand Down Expand Up @@ -250,13 +253,14 @@ Below is an example _package.json_ file with the _main_ attribute and _start_ sc

## init-wrapper

init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used for preventing below circumstances:
init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle:

- Proper signal handling and propagation, as Node.js was not designed to run as PID 1.
- Reaping zombie child processes
- Avoiding use of npm, more information on [reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application)
Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start.

A detailed explanation on how the init-wrapper script works is avalable on [this url](http://veithen.io/2014/11/16/sigterm-propagation.html).
A detailed explanation on how the init-wrapper script works is avalable in
[this url](http://veithen.io/2014/11/16/sigterm-propagation.html).

Example of using init-wrapper:

Expand Down
3 changes: 1 addition & 2 deletions 14/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ run_node() {
echo "exec $NODE_CMD"
fi
elif [ "$INIT_WRAPPER" == true ]; then

if [ -f "server.js" ]; then
start_file="server.js"
elif [ -f "index.js" ]; then
start_file="main.js"
start_file="index.js"
elif [ -f "main.js" ]; then
start_file="main.js"
else
Expand Down
12 changes: 8 additions & 4 deletions 16-minimal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ Application developers can use the following environment variables to configure
Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use.

**`NODE_CMD`**
When specified (e.g.Specify `NODE_CMD="node server.js"`) the `NODE_CMD` is executed by the `init-wrapper` script, which handles reaping zombie processes and signal forwarding (SIGINT, SIGTERM) to Node.js application.
When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`.

**`INIT_WRAPPER`**
When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application.


#### Additional variables used in the full-sized image
Expand Down Expand Up @@ -319,13 +322,14 @@ Below is an example _package.json_ file with the _main_ attribute and _start_ sc

## init-wrapper

init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used for preventing below circumstances:
init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle:

- Proper signal handling and propagation, as Node.js was not designed to run as PID 1.
- Reaping zombie child processes
- Avoiding use of npm, more information on [reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application)
Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start.

A detailed explanation on how the init-wrapper script works is avalable on [this url](http://veithen.io/2014/11/16/sigterm-propagation.html).
A detailed explanation on how the init-wrapper script works is avalable in
[this url](http://veithen.io/2014/11/16/sigterm-propagation.html).

Example of using init-wrapper:

Expand Down
3 changes: 1 addition & 2 deletions 16-minimal/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ run_node() {
echo "exec $NODE_CMD"
fi
elif [ "$INIT_WRAPPER" == true ]; then

if [ -f "server.js" ]; then
start_file="server.js"
elif [ -f "index.js" ]; then
start_file="main.js"
start_file="index.js"
elif [ -f "main.js" ]; then
start_file="main.js"
else
Expand Down
12 changes: 8 additions & 4 deletions 16/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ Application developers can use the following environment variables to configure
Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use.

**`NODE_CMD`**
When specified (e.g.Specify `NODE_CMD="node server.js"`) the `NODE_CMD` is executed by the `init-wrapper` script, which handles reaping zombie processes and signal forwarding (SIGINT, SIGTERM) to Node.js application.
When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`.

**`INIT_WRAPPER`**
When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application.

**`HTTP_PROXY`**
Use an npm proxy during assembly
Expand Down Expand Up @@ -246,13 +249,14 @@ Below is an example _package.json_ file with the _main_ attribute and _start_ sc

## init-wrapper

init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used for preventing below circumstances:
init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle:

- Proper signal handling and propagation, as Node.js was not designed to run as PID 1.
- Reaping zombie child processes
- Avoiding use of npm, more information on [reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application)
Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start.

A detailed explanation on how the init-wrapper script works is avalable on [this url](http://veithen.io/2014/11/16/sigterm-propagation.html).
A detailed explanation on how the init-wrapper script works is avalable in
[this url](http://veithen.io/2014/11/16/sigterm-propagation.html).

Example of using init-wrapper:

Expand Down
3 changes: 1 addition & 2 deletions 16/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ run_node() {
echo "exec $NODE_CMD"
fi
elif [ "$INIT_WRAPPER" == true ]; then

if [ -f "server.js" ]; then
start_file="server.js"
elif [ -f "index.js" ]; then
start_file="main.js"
start_file="index.js"
elif [ -f "main.js" ]; then
start_file="main.js"
else
Expand Down
12 changes: 8 additions & 4 deletions 18-minimal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ Application developers can use the following environment variables to configure
Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use.

**`NODE_CMD`**
When specified (e.g.Specify `NODE_CMD="node server.js"`) the `NODE_CMD` is executed by the `init-wrapper` script, which handles reaping zombie processes and signal forwarding (SIGINT, SIGTERM) to Node.js application.
When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`.

**`INIT_WRAPPER`**
When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application.

#### Additional variables used in the full-sized image

Expand Down Expand Up @@ -318,13 +321,14 @@ Below is an example _package.json_ file with the _main_ attribute and _start_ sc

## init-wrapper

init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used for preventing below circumstances:
init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle:

- Proper signal handling and propagation, as Node.js was not designed to run as PID 1.
- Reaping zombie child processes
- Avoiding use of npm, more information on [reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application)
Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start.

A detailed explanation on how the init-wrapper script works is avalable on [this url](http://veithen.io/2014/11/16/sigterm-propagation.html).
A detailed explanation on how the init-wrapper script works is avalable in
[this url](http://veithen.io/2014/11/16/sigterm-propagation.html).

Example of using init-wrapper:

Expand Down
3 changes: 1 addition & 2 deletions 18-minimal/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ run_node() {
echo "exec $NODE_CMD"
fi
elif [ "$INIT_WRAPPER" == true ]; then

if [ -f "server.js" ]; then
start_file="server.js"
elif [ -f "index.js" ]; then
start_file="main.js"
start_file="index.js"
elif [ -f "main.js" ]; then
start_file="main.js"
else
Expand Down
5 changes: 4 additions & 1 deletion 18/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ Application developers can use the following environment variables to configure
Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use.

**`NODE_CMD`**
When specified (e.g.Specify `NODE_CMD="node server.js"`) the `NODE_CMD` is executed by the `init-wrapper` script, which handles reaping zombie processes and signal forwarding (SIGINT, SIGTERM) to Node.js application.
When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`.

**`INIT_WRAPPER`**
When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application.

**`HTTP_PROXY`**
Use an npm proxy during assembly
Expand Down
3 changes: 1 addition & 2 deletions 18/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ run_node() {
echo "exec $NODE_CMD"
fi
elif [ "$INIT_WRAPPER" == true ]; then

if [ -f "server.js" ]; then
start_file="server.js"
elif [ -f "index.js" ]; then
start_file="main.js"
start_file="index.js"
elif [ -f "main.js" ]; then
start_file="main.js"
else
Expand Down

0 comments on commit a59f33d

Please sign in to comment.