Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Refactored so configuration not required, app conf by name, repo refe…
…rence
- Loading branch information
1 parent
e7d9699
commit 1f60dac
Showing
8 changed files
with
121 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,9 +1,6 @@ | |||
{ | { | ||
"nodejs3": { | "My Cool Node One-Liner": { | ||
"state": "run", | "start": [ "--eval", "setTimeout(false, 10000)" ], | ||
"name": "LinkedIn", | "launchBrowser": "http://localhost:1111" | ||
"watchFiles": [ "example.js" ], | |||
"start": "/Users/foxyboy/Desktop/airfox/node/linkedin/example/example.js", | |||
"folder": "/Users/foxyboy/Desktop/airfox/node/linkedin/example" | |||
} | } | ||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,55 +1,66 @@ | |||
# Node God | # Node God | ||
Launches node applications, restarts them on crash or file updates, produces a shared log. | Launches node applications, restarts them on crash or file updates, produces a shared log. | ||
|
|
||
# Required Configuration | # Run as demo | ||
Configured by JSON-files in the filesystem | |||
|
|
||
## Node God itself | ```js | ||
* nodegod.js needs to be in the folder | nodegod$ node app | ||
* $HOME |
|
||
* $HOME/apps |
|
||
* the folder were Node God's app.js resides | === 2012-06-23 13:24:21 Node God starting | ||
info - socket.io started | |||
process /home/foxyboy/Desktop/c505/node/nodegod/apps.json | |||
Application Node God on node v0.6.14 available on port 1111 in development mode | |||
127.0.0.1 | |||
``` | |||
|
|||
opens a browser window that monitors an app that exits every 10 seconds. | |||
|
|||
# Configuration Files | |||
|
|||
## nodegod.json | |||
Node God itself is configured using a json file that provides port number, a session secret and the location of other json files containing application configurations. The paths searched for nodegod.json are: | |||
* $HOME/apps | |||
* $HOME | |||
* Node God's launch folder, where app.js is located | |||
|
|
||
```js | ```js | ||
{ | { | ||
"PORT": 1111, | |||
"haraldops": { | |||
}, | |||
"appFiles": "/home/foxyboy/apps/apps.json", | "appFiles": "/home/foxyboy/apps/apps.json", | ||
"sessionSecret": "verygreat" | |||
} | } | ||
``` | ``` | ||
* PORT: optional number: the port for Node God, ovverriden by env.PORT, default 3000 | * PORT: optional number: the port for Node God, defaults to env.PORT or 1111 | ||
* appFiles: required path: where to find json file with app configurations | * appFiles: optional string or array of strings: filenames to search for app configurations. | ||
* sessionSecret: required string, secret for web session | * if strings are not fully qualified paths, the folder where nodegod.json was found or node god's app folder are searched | ||
* default: apps.json in either the noegod.json folder or nodegod's app folder | |||
* sessionSecret: optional string, has a default value | |||
* defaultFolder: a parent folder for deployed apps, default the parent folder of where nodegod's app.js is located | * defaultFolder: a parent folder for deployed apps, default the parent folder of where nodegod's app.js is located | ||
|
|
||
Note: pids are stored at $HOME/tmp or the global temp folder | Note: pids are stored in a file at $HOME/tmp or the global temp folder | ||
|
|
||
## Configuring apps | ## Configuring files for monitored apps | ||
|
|
||
```js | ```js | ||
{ | { | ||
"nodejs3": { | "Node.js #3": { | ||
"state": "run", | |||
"name": "Node.js #3", | |||
"watchFiles": [ "package.json", "app.js", "lib", "routes", "/home/foxyboy/apps/nodejs3.json" ] | "watchFiles": [ "package.json", "app.js", "lib", "routes", "/home/foxyboy/apps/nodejs3.json" ] | ||
} | } | ||
} | } | ||
``` | ``` | ||
|
|
||
* Key: the identifier (computer-friendly string) used for this app, here "nodejs3." This is the name of the default deployment folder for this app | * Key: the name of this app | ||
* state: the initial state of the app: run/stop/debug | * id: optional string: the identifier (computer-friendly string) used for this app. default is derived from the app name, for "Node.js #3" here it would be "nodejs3" | ||
* folder: optional: the folder where the app is deployed, default as described under nodegod settings | * state: optional string: the initial state of the app: run/stop/debug, default run | ||
* start: path to the JavaScript launching the app, default app.js | * folder: optional path: the folder where the app is deployed. Default is a sibling folder to nodegod, ie. the parent folder of nodegod with id appended. | ||
* name: Human readable app name, defaule is Key | * start: optional string or array of strings: parameters to the node executable, default app.js in the app's folder | ||
* watchFiles: a single entry or array of filenames and folders to watch. If any file changes the app is restarted | * watchFiles: optional string or array of Strings: filenames and folders to watch. If any file changes the app is restarted | ||
* launchBrowser: optional string: url for which a browser window is launched once | |||
|
|
||
# Features | # Features | ||
* Web frontend for managing any number of apps | * Web frontend for managing any number of apps | ||
* App lifecycle management with states and transitions for run/stop/debug | * App lifecycle management with states and transitions for run/stop/debug | ||
* App is automatically restarted unless it crashes in less than 3 seconds | * App is automatically restarted unless it crashes in less than 3 seconds | ||
* If app state is crashed, watchers are still active so the app relaunches on update | * If app state is crashed, watchers are still active so relaunch os attempted on file updates | ||
* File watchers restart the app after a 3 second delay, so that all file writes have time to complete | * File watchers restart the app after a 3 second delay, so that all file writes have time to complete | ||
* Ability to reload app configurations as files are added | * Ability to reload app configurations as files are added | ||
* If Node God crashes, it will relaunch managed apps on restart so that they become managed | * If Node God crashes, it will relaunch managed apps on restart so that they become managed |