-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add python multiple processes article #44
base: master
Are you sure you want to change the base?
Conversation
|
||
### Phusion base image | ||
|
||
The simplest way to get started is to use [phusion-baseimage](https://github.com/phusion/baseimage-docker "https://github.com/phusion/baseimage-docker") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing period.
#### app1.sh | ||
This is the runit script for our first app. We send the output to STDOUT so that the Docker logs can handle it. Without <a href="https://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a> (`#!/bin/sh`), the following error will occur: `runsv app1: fatal: unable to start ./run: exec format error` | ||
|
||
Again, we send the output to STDOUT so that the Docker logs can handle it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Colon?
``` | ||
|
||
#### app2.sh | ||
App2 runit script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing colon.
exec python /app2.py >> /dev/stdout 2>&1 | ||
``` | ||
|
||
#### Note for windows users: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an aside?
tags: | ||
- docker | ||
- python | ||
excerpt: Although Docker best practices recommend running one application per container, you may need to run a multiprocess app or create a standalone multi-app Docker image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit this down.
|
||
### 2. Signal handling | ||
|
||
By default, PID1 ignores the interrupt `SIGINT` and the termination signal `SIGTERM`. In response to the `docker stop` command (which sends `SIGTERM` to your container's PID1), you must relay `SIGTERM` to all your running processes to terminate them cleanly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Editor Comment:
The second sentence is unclear. Please review my changes to make sure the meaning has been preserved. In particular:
"...PID1 must relay this signal..."
Which signal?
|
||
If you do not need process supervision, you can use [tini](https://github.com/krallin/tini "https://github.com/krallin/tini") as a lightweight init process. Tini also handles signals. | ||
|
||
[S6](http://skarnet.org/software/s6/ "http://skarnet.org/software/s6/") is a complete solution: a minimal process supervisor that also acts as an init process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Editor Comment:
"...a minimal process supervisor..."
What does "minimal" mean in this context?
#### app1.sh | ||
This is the runit script for our first app. We send the output to STDOUT so that the Docker logs can handle it. Without <a href="https://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a> (`#!/bin/sh`), the following error will occur: `runsv app1: fatal: unable to start ./run: exec format error` | ||
|
||
Again, we send the output to STDOUT so that the Docker logs can handle it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Editor Comment:
"We send the output to STDOUT so that the Docker logs can handle it."
What is "it"?
Editor Comment: