- README.md
- docker-compose.yml
- worker/package.json
- worker/src/utils.js
- worker/src/sampleNodeProcess.js
-
Terminal A:
- Install dependencies:
docker-compose run worker npm install
- Run the sample nodejs process:
docker-compose run worker node src/sampleNodeProcess
- Install dependencies:
-
Terminal B:
- Find the name of the docker container which is runnign the process:
$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 90ed79aa7ac5 node:7 "node src/sampleNo..." 8 seconds ago Up 6 seconds worker_run_12
- Send an interrupt to the appropriate container name:
docker stop worker_run_12
-
Terminal A
- You should see that the process exited gracefully:
trapSignals ... server started {"name":"sp-json-logger","hostname":"...","pid":1,"level":40,"application":"","program":"","language":"","log":{"message":"server stopped by SIGTERM"},"msg":"","time":"...","v":0} [WTF Node?] open handles: - File descriptors: (note: stdio always exists) - fd 1 (tty) (stdio) - fd 2 (tty) (stdio) - Servers: - <unknown address> - Listeners: - request: (anonymous) @ /apps/src/lib/trapSignals.js:8