Open dongshimou opened 1 year ago
I have the same issue with the single container deployment.
docker run --publish 7080:7080 --publish 127.0.0.1:3370:3370 --ulimit nofile=10000:10000 --rm --name sourcegraph --volume ~/.sourcegraph/config:/etc/sourcegraph --volume ~/.sourcegraph/data:/var/opt/sourcegraph -d sourcegraph/server:5.0.2
https://$host/github.com/django/django/-/blob/setup.py
05:41:11 frontend | t=2023-04-27T05:41:11+0000 lvl=eror msg="syntax highlighting failed (this is a bug, please report it)" filepath=setup.py filetype=python repo_name=github.com/django/django revision=7d0e56620882c207998a41ac07ec5da572045b31 snippet="\"import os\\nimport site\\nimport sys\\nfrom distutils.sysconfig import get_python_lib\\n\"…" error="http://127.0.0.1:9238: unknown error=\"python is not a valid filetype for treesitter\" code=\"\""
I spot-checked a few file types in the UI:
This string appears in the following two places:
It seems to be all the languages mentioned in #47571. @olafurpg or @tjdevries -- are there any tools so we can debug this on our end?
When I hop into the container and run /usr/local/bin/syntax_highlighter --help
, it starts a server instead of dumping help BUT it also helpfully dumps out the languages that are loaded:
bash-5.1# /usr/local/bin/syntax_highlighter --help
...
## Supported file extensions:
...
- Python (`py`, `py3`, `pyw`, `pyi`, `pyx`, `pyx.in`, `pxd`, `pxd.in`, `pxi`, `pxi.in`, `rpy`, `cpy`, `SConstruct`, `Sconstruct`, `sconstruct`, `SConscript`, `pyst`, `pyst-include`, `gyp`, `gypi`, `Snakefile`, `vpy`, `wscript`, `bazel`, `bzl`)
...
🛰 Routes:
>> (syntect) POST / application/json
>> (lsif) POST /lsif application/json
>> (scip) POST /scip application/json
...
Thank you for reporting! The root issue is that the single container deployment option is using an outdated version of our syntax-highlighter service
Notice that the build is from December 2022. The fix is to send a PR similar to this one here https://github.com/sourcegraph/sourcegraph/pull/42486 to bump the version. I've asked internally for help to somehow automate this version upgrade to prevent it from regressing again in the future.
@olafurpg big thank-you for the info! I have submitted a patch to bump it in #51223.
@dongshimou as a workaround, I just patched the container myself:
Docker image that overrides the /usr/local/bin/syntax_highlighter
binary with a newer one (Sourcegraph-Syntax-Patch.Dockerfile
):
FROM sourcegraph/server:5.0.2
COPY --from=docker.io/sourcegraph/syntax-highlighter:215692_2023-04-27_5.0-fb61a539c3a1 /syntax_highlighter /usr/local/bin/
Build it:
docker build -f Sourcegraph-Syntax-Patch.Dockerfile -t hfern/sourcegraph/server:5.0.2-syntax .
Then use that image in your docker deployment instead of the usual sourcegraph/server one:
docker run --publish 7080:7080 --publish 127.0.0.1:3370:3370 --ulimit nofile=10000:10000 --rm --name sourcegraph --volume ~/.sourcegraph/config:/etc/sourcegraph --volume ~/.sourcegraph/data:/var/opt/sourcegraph -d hfern/sourcegraph/server:5.0.2
This resolved my issue:
So far I have no issues running this.
Steps to reproduce:
1.clone a repo. 2.docker logs
Expected behavior:
Actual behavior:
If you would like immediate help on this, please email support@sourcegraph.com (you can still create the issue, but there are no SLAs on issues like there are for support requests).