-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
170 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
node_modules | ||
npm-debug.log | ||
*.log | ||
coverage/* | ||
.nyc_output | ||
.idea/ | ||
**/*.iml | ||
dbfiles/* | ||
supervisor/*.db |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# demo easy start | ||
|
||
## resource-lock.supervisord.ini | ||
three clients that lock resource for the 5 second each, so the next able to lock the resource after the previous release it | ||
|
||
- to start: | ||
```shell | ||
$ supervisord -c ./resource-lock.supervisord.ini | ||
``` | ||
|
||
## allot.supervisord.ini | ||
leaderless queue work | ||
|
||
- to start: | ||
```shell | ||
$ supervisord -c ./allot.supervisord.ini | ||
|
||
|
||
``` |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
[supervisord] | ||
logfile=./supervisord.log ; (main log file;default $CWD/supervisord.log) | ||
loglevel=info ; (log level;default info; others: debug,warn,trace) | ||
pidfile=./supervisord.pid ; (supervisord pidfile;default supervisord.pid) | ||
nodaemon=true ; (start in foreground if true;default false) | ||
|
||
[program:sync-1] | ||
command=./prefix-log.sh node ../allot/sync.js | ||
environment=WAMP_PORT=9021 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=1 | ||
|
||
[program:sync-2] | ||
command=./prefix-log.sh node ../allot/sync.js | ||
environment=WAMP_PORT=9022 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=1 | ||
|
||
[program:sync-3] | ||
command=./prefix-log.sh node ../allot/sync.js | ||
environment=WAMP_PORT=9023 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=1 | ||
|
||
[program:entry-1] | ||
command=./prefix-log.sh node ../allot/entry.js | ||
environment=WAMP_PORT=9031,MQTT_PORT=1881 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=2 | ||
|
||
[program:entry-2] | ||
command=./prefix-log.sh node ../allot/entry.js | ||
environment=WAMP_PORT=9032,MQTT_PORT=1882 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=2 | ||
|
||
[program:entry-3] | ||
command=./prefix-log.sh node ../allot/entry.js | ||
environment=WAMP_PORT=9033,MQTT_PORT=1883 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=2 | ||
|
||
[program:ndb-1] | ||
command=./prefix-log.sh node ../allot/ndb.js | ||
environment=DB_FILE=./x1.db | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=3 | ||
|
||
[program:ndb-2] | ||
command=./prefix-log.sh node ../allot/ndb.js | ||
environment=DB_FILE=./x2.db | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=3 | ||
|
||
[program:ndb-3] | ||
command=./prefix-log.sh node ../allot/ndb.js | ||
environment=DB_FILE=./x3.db | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=3 |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
# setup fd-3 to point to the original stdout | ||
exec 3>&1 | ||
# setup fd-4 to point to the original stderr | ||
exec 4>&2 | ||
|
||
# get the prefix from SUPERVISOR_PROCESS_NAME environement variable | ||
printf -v PREFIX "%-10.10s" ${SUPERVISOR_PROCESS_NAME} | ||
|
||
# reassign stdout and stderr to a preprocessed and redirected to the original stdout/stderr (3 and 4) we have create eralier | ||
exec 1> >( perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&3) | ||
exec 2> >( perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&4) | ||
|
||
# from here on everthing that outputs to stdout/stderr will be go through the perl script | ||
|
||
exec "$@" |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[supervisord] | ||
logfile=./supervisord.log ; (main log file;default $CWD/supervisord.log) | ||
loglevel=info ; (log level;default info; others: debug,warn,trace) | ||
pidfile=./supervisord.pid ; (supervisord pidfile;default supervisord.pid) | ||
nodaemon=true ; (start in foreground if true;default false) | ||
|
||
[program:router] | ||
command=./prefix-log.sh node ../bin/basic.js | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=1 | ||
|
||
[program:resource1] | ||
command=./prefix-log.sh node ../democli/resource-lock.js | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=2 | ||
|
||
[program:resource2] | ||
command=./prefix-log.sh node ../democli/resource-lock.js | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=2 | ||
|
||
[program:resource3] | ||
command=./prefix-log.sh node ../democli/resource-lock.js | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=2 |