Skip to content

Commit

Permalink
Updated example
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksii Tsvietnov committed Mar 3, 2017
1 parent 0d3346e commit efc87cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 25 additions & 2 deletions examples/service-discovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,31 @@ docker build -t trc-test-sd .

## Test

Press `<Ctrl+C>` to exit
To test this example you need an IP of a working ZooKeeper cluster.
The 'virtual app' can be interrupted by pressing `<Ctrl+C>`.

The command line will look like

```bash
$ docker run --rm -it -e ZKURL="srv1[:port1][,srv2[:port2]...]" trc-test-sd
```
For example:

```bash
$ docker run --rm -it -e RC_VERBOSE=true -e ZKURL="srv1[:port1][,srv2[:port2]...]" trc-test-sd
$ docker run --rm -it -e ZKURL=192.168.1.173 trc-test-sd 2017-03-03 16:49:06 trc [main/1]: The wait policy: wait_any
2017-03-03 16:49:06 trc [main/1]: Launching on the boot: /etc/trc.d/boot.sd-reg
2017-03-03 16:49:06 trc [main/1]: 2a3556e6f646 has been registered at 192.168.1.173
2017-03-03 16:49:06 trc [sync/29]: Launching on the foreground: /etc/trc.d/sync.app
I am alive! Press <Ctrl+C> to exit...
I am alive! Press <Ctrl+C> to exit...
I am alive! Press <Ctrl+C> to exit...
^C2017-03-03 16:49:08 trc [sync/29]: Exiting on the foreground (exitcode=130): /etc/trc.d/sync.app
2017-03-03 16:49:09 trc [main/1]: Trying to terminate sub-processes...
2017-03-03 16:49:09 trc [halt/44]: Running the shutdown script: /etc/trc.d/halt.sd-unreg
2017-03-03 16:49:09 trc [halt/44]: 2a3556e6f646 has been unregistered at 192.168.1.173
2017-03-03 16:49:09 trc [main/1]: Exiting from the shutdown script (exitcode=0): /etc/trc.d/halt.sd-unreg
2017-03-03 16:49:09 trc [main/1]: Exited.

$ echo $?
0
```
2 changes: 1 addition & 1 deletion examples/service-discovery/trc.d/halt.sd-unreg
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ then
log "$(hostname) has been unregistered at ${ZKURL}"
fi

# finish with 0 exit status
# Ignoring exit status 130 (after pressing Ctrl+C) by finishing with status 0
exit 0

0 comments on commit efc87cd

Please sign in to comment.