-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault-application-config.js
More file actions
261 lines (212 loc) · 6.92 KB
/
default-application-config.js
File metadata and controls
261 lines (212 loc) · 6.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
// default-application-config.js
const os = require("os");
module.exports = {
/*
* Name of this application. Used when referring to
* this application via the command line.
*/
'name': 'default',
/*
* Whether this is an 'application' or a 'logger'.
*/
'type': 'application',
/*
* Whether this applicaton should be started using node.js' cluster
* mode or as a standalone node process.
*
* 'cluster': Use node.js' cluster mode
* 'fork': Use child_process.fork()
*/
'mode': 'cluster',
/*
* Defaults to configuration file directory if 'null'.
* Other paths are relative to this.
*/
'base-path': null,
/*
* Working directory for this application.
* Relative to base-path.
*/
'cwd': './',
/*
* Entry point of this application.
* Relative to base-path.
*/
'run': './server.js',
/*
* Array of arguments to pass to the application.
*/
'args': [],
/*
* Array of arguments to pass to node.js when
* starting a new process of this application.
*
* Example: ['--harmony']
*/
'node-args': [],
/*
* Environment variables to pass to the application.
*
* By default this contains environment variables with
* which the config was parsed.
*
* Since configuration is parsed with the appropriate
* npm_package_config_* environment variables of the
* node package the configuration file resides in,
* there is no need for weird hacks such as running
* final-pm through npm.
*/
'env': process.env,
/*
* Defines when FinalPM should consider a process to
* be ready and thus move it to the 'running' generation.
*
* Valid values are 'listen', 'message', 'instant'.
*
* 'listen': FinalPM waits for the cluster 'listen'
* event, which is emitted when the application
* begins to listen on a socket.
* Only available in cluster mode.
*
* 'message': FinalPM will ignore the cluster 'listen'
* event and instead wait for the process to
* send a 'ready' message with IPC,
* i.e. process.send('ready')
*
* 'instant': Process is immediately considered ready.
*/
'ready-on': 'listen',
/*
* Defines how FinalPM should ask a process to stop gracefully.
*
* Valid values are 'SIGINT', 'SIGTERM', 'disconnect', and 'message'.
* For loggers it is recommended to set this to 'message'.
*
* On Windows platforms sending 'SIGINT' is unsupported and
* FinalPM will default to 'message' instead.
*
* 'SIGINT': FinalPM will send the SIGINT signal.
* 'SIGTERM': FinalPM will send the SIGTERM signal.
* 'disconnect': FinalPM will use child.disconnect()
* 'message': FinalPM will send a 'stop' message.
*/
'stop-signal': os.platform() === "win32" ? "message" : "SIGINT",
/*
* Defines how FinalPM should kill a process.
*
* Processes which have been sent the kill signal, but which
* haven't terminated yet, are considered "Zombie" processes.
*
* Valid values are 'SIGTERM' and 'SIGKILL'.
*
* 'SIGTERM': FinalPM will send the SIGTERM signal.
* 'SIGKILL': FinalPM will send the SIGKILL signal.
*/
'kill-signal': 'SIGKILL',
/*
* How many instances / processes FinalPM will
* launch for this application.
*/
'instances': 1,
/*
* How many instances of this application should at most
* be allowed to run at the same time. At least 'instances' + 1.
*
* If this limit is reached, FinalPM will delay starting
* new processes until an old one has stopped. This
* can thus be used to implement staggered restarts.
*
* '0' for no limit.
*/
'max-instances': 0,
/*
* Whether FinalPM should consider each process
* of this application to be functionally identical.
*
* This controls how old processes are replaced.
*
* 'false': FinalPM will assume instances of this
* application are fundamentally the same
* and always replace the oldest processes
* in the 'running' generation when new processes
* became ready.
*
* 'true': FinalPM will add FINAL_PM_INSTANCE_NUMBER=N
* to the environment of each process, as well as
* always replace processes of this application with
* ones having the same FINAL_PM_INSTANCE_NUMBER.
* This is useful, for example, if you want to perform
* certain jobs only on specific instances of
* this application.
*/
'unique-instances': true,
/*
* When true, a new process will be started whenever a
* running one of this application exited abnormally
* in the 'running' generation.
*/
'restart-crashing': true,
/*
* Same as above, except for processes which haven't yet
* indicated they are ready, i.e. they crashed in the
* 'new' generation.
*/
'restart-new-crashing': true,
/*
* Time to wait before starting a new process after one crashed.
*/
'restart-crashing-delay': 1000,
/*
* Logger application to use.
*
* 'file-logger' is a simple logger shipping with FinalPM.
*
* Refer to final-pm --help-all for how to implement your own logger.
*/
'logger': 'file-logger',
/*
* Arguments to pass to the logger process.
*/
'logger-args': ['log.txt'],
/*
* How many past log bytes to buffer in RAM. Mainly used
* to show past log lines when using 'final-pm log', but
* also when a logger isn't yet ready (or crashed and
* has to be restarted).
*
* This value is per-application-logger combination.
*/
'max-buffered-log-bytes': 256 * 1024,
/*
* How long in milliseconds to keep logs in RAM after the
* last process of an application has terminated and
* they have been flushed to the logger process.
*
* Once this timeout has expired 'final-pm log' won't return
* any logs for your application anymore.
*/
'log-retention-timeout': 1000 * 60 * 60 * 24,
/*
* Buffer at most this many bytes per log line, before
* truncating any additional characters.
*/
'max-log-line-length': 1024 * 5,
/*
* How much time in milliseconds a process has to terminate
* after being sent SIGINT.
*
* If a timeout occurs the process is terminated with SIGKILL.
*
* 'null' for no timeout (wait forever).
*/
'stop-timeout': null,
/*
* How much time in milliseconds a process has to become ready.
*
* If a timeout occurs the process is terminated with SIGKILL
* and assumed to have crashed.
*
* 'null' for no timeout (wait forever).
*/
'start-timeout': null
};