File tree Expand file tree Collapse file tree 4 files changed +78
-1
lines changed Expand file tree Collapse file tree 4 files changed +78
-1
lines changed Original file line number Diff line number Diff line change
1
+ Install as Windows Service
2
+ ==========================
3
+
4
+ Prerequisites
5
+ -------------
6
+
7
+ Before you start, ensure that the following are installed on the Windows server:
8
+
9
+ * mongodb
10
+ * nodejs
11
+
12
+ Installation
13
+ ------------
14
+
15
+ Build a production version of Command Post
16
+
17
+ ```
18
+ npm install
19
+ grunt production
20
+ rm -r node_modules
21
+ npm install --production
22
+ ```
23
+
24
+ Install CommandPost as service
25
+
26
+ ```
27
+ npm install -g node-windows
28
+ node scripts\install-windows-service.js
29
+ ```
30
+
31
+ This will setup a windows service called ` CommandPost ` which will listen on
32
+ port 80 in development mode. To change port or mode, edit the ` install-windows-service.js `
Original file line number Diff line number Diff line change @@ -112,7 +112,8 @@ Install
112
112
6 . ` npm install -g grunt-cli `
113
113
7 . ` grunt `
114
114
115
- For installation on Windows see the [ iisnode readme] ( docs/iisnode/readme.md ) .
115
+ For installation on Windows see the [ iisnode readme] ( docs/iisnode/readme.md )
116
+ or [ node-windows] ( docs/node-windows.md ) .
116
117
117
118
Configuration
118
119
-------------
Original file line number Diff line number Diff line change
1
+ var Service = require ( 'node-windows' ) . Service ;
2
+
3
+ var svc = new Service ( {
4
+ name : 'CommandPost' ,
5
+ description : 'Command Post HTTP Server' ,
6
+ script : require ( 'path' ) . join ( __dirname , '../app.js' ) ,
7
+ env : [
8
+ { name : 'NODE_ENV' , value : 'production' } ,
9
+ { name : 'PORT' , value : 80 }
10
+ ]
11
+ } ) ;
12
+
13
+ svc . on ( 'install' , function ( ) {
14
+ console . log ( 'Staring CommandPost service...' ) ;
15
+ svc . start ( ) ;
16
+ } ) ;
17
+
18
+ svc . on ( 'start' , function ( ) {
19
+ console . log ( 'Ready' ) ;
20
+ } ) ;
21
+
22
+ svc . on ( 'error' , function ( err ) {
23
+ console . log ( 'Error:' , err ) ;
24
+ } ) ;
25
+
26
+ console . log ( 'Installing CommandPost service...' ) ;
27
+ svc . install ( ) ;
Original file line number Diff line number Diff line change
1
+ var Service = require ( 'node-windows' ) . Service ;
2
+
3
+ var svc = new Service ( {
4
+ name : 'CommandPost' ,
5
+ script : require ( 'path' ) . join ( __dirname , '../app.js' )
6
+ } ) ;
7
+
8
+ svc . on ( 'uninstall' , function ( ) {
9
+ console . log ( 'Uninstall complete' ) ;
10
+ } ) ;
11
+
12
+ svc . on ( 'error' , function ( err ) {
13
+ console . log ( 'Error:' , err ) ;
14
+ } ) ;
15
+
16
+ console . log ( 'Uninstalling CommandPost service...' ) ;
17
+ svc . uninstall ( ) ;
You can’t perform that action at this time.
0 commit comments