-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Ensure nginx worker processes respects docker limits #11769
Conversation
✅ Deploy Preview for frigate-docs canceled.
|
I tested by starting the devcontainer, then checking the contents of You can limit the cpus in services:
devcontainer:
deploy:
resources:
limits:
cpus: '2' |
@NickM-27 made the changes, also tested them. BTW I just noticed this:
How about we avoid calling |
I think it might be preferable to leave it as is. Changes were made so users shouldn't need to bind mount this file anymore, but in any case probably best to catch any error that occurs so it doesn't stop frigate from starting. |
It would be very unexpected to have errors happening at that command though. I have these changes ready: function set_worker_processes() {
if mountpoint -q /usr/local/nginx/conf/nginx.conf; then
echo "[INFO] NGINX configuration is mounted. Skipping worker_processes calculation..." >&2
return
fi
# Capture number of assigned CPUs to calculate worker processes
local cpus
cpus=$(get_cpus)
if [[ "${cpus}" -gt 4 ]]; then
cpus=4
fi
echo "[INFO] Setting NGINX worker_processes to ${cpus}..." >&2
sed -i "s/worker_processes auto;/worker_processes ${cpus};/" /usr/local/nginx/conf/nginx.conf
} Let me know in case you change your mind. |
Refs #10969 (comment)