Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Ensure WORKERS is respected in syntect server image as env var #59018

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions docker-images/syntax-highlighter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,22 @@ oci_image(
name = "image",
base = "@wolfi_syntax_highlighter_base",
entrypoint = [
"/usr/local/bin/http-server-stabilizer",
"-listen=:9238",
"-prometheus-app-name=syntax_highlighter",
# The more workers, the more resilient syntect_server is to getting stuck on
# bad grammar/file combinations. If it happens with four workers, only 1/4th of
# requests will be affected for a short period of time. Each worker can require
# at peak around 1.1 GiB of memory.
"-workers=4",
"--",
"env",
"ROCKET_PORT={{.Port}}", # {{.Port}} is a templated variable used by http-server-stabilizer
"/syntect_server",
"/bin/sh",
"-c",
" ".join([
"/usr/local/bin/http-server-stabilizer",
"-listen=:9238",
"-prometheus-app-name=syntax_highlighter",
# The more workers, the more resilient syntect_server is to getting stuck on
# bad grammar/file combinations. If it happens with four workers, only 1/4th of
# requests will be affected for a short period of time. Each worker can require
# at peak around 1.1 GiB of memory.
"-workers=$WORKERS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is WORKERS guaranteed to be set? If not, should we have a default value here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking this as part of the review:

~/work/sourcegraph  dax/update_syntect_server $ docker load --input=bazel-bin/docker-images/syntax-highlighter/image_tarball/tarball.tar
69635e4afa19: Loading layer [==================================================>]  23.22MB/23.22MB
9eb57e8e2f08: Loading layer [==================================================>]  14.48MB/14.48MB
Loaded image: syntect-server:candidate
~/work/sourcegraph  dax/update_syntect_server $ ba
~/work/sourcegraph  dax/update_syntect_server $ docker run --rm --entrypoint=/bin/sh -it syntect-server:candidate
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
/ # env
WORKERS=4

"--",
"env",
"ROCKET_PORT={{.Port}}", # {{.Port}} is a templated variable used by http-server-stabilizer
"/syntect_server",
]),
],
env = {
"ROCKET_ENV": "production",
Expand Down