mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:12:02 +00:00
Rename lsif-server to precise-code-intel (#9376)
This commit is contained in:
parent
7468e5a910
commit
bf8119e8d1
@ -103,6 +103,6 @@ node_modules/
|
||||
/packages/sourcegraph-extension-api/dist
|
||||
|
||||
# Precise code intel
|
||||
./cmd/lsif-server/node_modules
|
||||
./cmd/lsif-server/out
|
||||
./cmd/lsif-server/test-data
|
||||
./cmd/precise-code-intel/node_modules
|
||||
./cmd/precise-code-intel/out
|
||||
./cmd/precise-code-intel/test-data
|
||||
|
||||
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -250,7 +250,7 @@ Dockerfile @sourcegraph/distribution
|
||||
/cmd/frontend/db/discussion* @slimsag
|
||||
|
||||
# LSIF
|
||||
/cmd/lsif-server/ @sourcegraph/code-intel
|
||||
/cmd/precise-code-intel/ @sourcegraph/code-intel
|
||||
/internal/lsif @sourcegraph/code-intel
|
||||
/enterprise/internal/codeintel @sourcegraph/code-intel
|
||||
/cmd/frontend/graphqlbackend/codeintel.go @sourcegraph/code-intel
|
||||
|
||||
6
.github/workflows/lsif.yml
vendored
6
.github/workflows/lsif.yml
vendored
@ -38,15 +38,15 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Install dependencies
|
||||
run: yarn --cwd cmd/lsif-server
|
||||
run: yarn --cwd cmd/precise-code-intel
|
||||
- name: Generate LSIF data
|
||||
uses: sourcegraph/lsif-node-action@master
|
||||
with:
|
||||
project_root: cmd/lsif-server
|
||||
project_root: cmd/precise-code-intel
|
||||
- name: Upload LSIF data
|
||||
uses: sourcegraph/lsif-upload-action@master
|
||||
with:
|
||||
root: cmd/lsif-server
|
||||
root: cmd/precise-code-intel
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
lsif-shared:
|
||||
|
||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -64,7 +64,7 @@
|
||||
"changeProcessCWD": true,
|
||||
},
|
||||
{
|
||||
"directory": "cmd/lsif-server",
|
||||
"directory": "cmd/precise-code-intel",
|
||||
"changeProcessCWD": true,
|
||||
},
|
||||
],
|
||||
|
||||
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@ -53,7 +53,7 @@
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "eslint",
|
||||
"path": "cmd/lsif-server/",
|
||||
"path": "cmd/precise-code-intel/",
|
||||
"problemMatcher": ["$eslint-stylish"],
|
||||
},
|
||||
{
|
||||
|
||||
@ -22,7 +22,7 @@ module.exports = api => {
|
||||
],
|
||||
plugins: [
|
||||
'babel-plugin-lodash',
|
||||
// Required to support typeoerm decorators in ./cmd/lsif-server
|
||||
// Required to support typeorm decorators in ./cmd/precise-code-intel
|
||||
['@babel/plugin-proposal-decorators', { legacy: true }],
|
||||
// Node 12 (released 2019 Apr 23) supports these natively, but there seem to be issues when used with TypeScript.
|
||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
# keep this in sync with docker-images/prometheus/Dockerfile
|
||||
FROM prom/prometheus:v2.15.2@sha256:35c52c0c2b76433bbfc44a5a7abc294c2f032ed80250be02b441db5dd91b203a AS prometheus
|
||||
|
||||
FROM alpine:3.10@sha256:e4355b66995c96b4b468159fc5c7e3540fcef961189ca13fee877798649f531a AS pci-builder
|
||||
FROM alpine:3.10@sha256:e4355b66995c96b4b468159fc5c7e3540fcef961189ca13fee877798649f531a AS precise-code-intel-builder
|
||||
|
||||
RUN apk add --no-cache nodejs-current=12.4.0-r0 nodejs-npm=10.19.0-r0
|
||||
RUN npm install -g yarn@1.17.3
|
||||
|
||||
COPY lsif-server/package.json lsif-server/yarn.lock lsif-server/tsconfig.json /pci/
|
||||
RUN yarn --cwd /pci
|
||||
COPY lsif-server/src /pci/src
|
||||
RUN yarn --cwd /pci run build
|
||||
COPY precise-code-intel/package.json precise-code-intel/yarn.lock precise-code-intel/tsconfig.json /precise-code-intel/
|
||||
RUN yarn --cwd /precise-code-intel
|
||||
COPY precise-code-intel/src /precise-code-intel/src
|
||||
RUN yarn --cwd /precise-code-intel run build
|
||||
|
||||
FROM sourcegraph/alpine:3.10@sha256:4d05cd5669726fc38823e92320659a6d1ef7879e62268adec5df658a0bacf65c
|
||||
|
||||
@ -41,12 +41,12 @@ RUN mkdir -p $PROMETHEUS_CONFIGURATION_DIR && chown -R sourcegraph:sourcegraph $
|
||||
RUN mkdir -p /lsif-storage && chown -R sourcegraph:sourcegraph /lsif-storage
|
||||
USER sourcegraph
|
||||
|
||||
COPY --from=pci-builder /pci /pci
|
||||
COPY ./lsif-server/lsif-server /usr/local/bin/lsif-server
|
||||
COPY --from=precise-code-intel-builder /precise-code-intel /precise-code-intel
|
||||
COPY ./precise-code-intel/precise-code-intel /usr/local/bin/precise-code-intel
|
||||
COPY --from=prometheus /bin/prometheus /bin/prometheus
|
||||
COPY ./lsif-server/prometheus.yml $PROMETHEUS_CONFIGURATION_DIR/prometheus.yml
|
||||
COPY ./precise-code-intel/prometheus.yml $PROMETHEUS_CONFIGURATION_DIR/prometheus.yml
|
||||
|
||||
# http api server, bundle manager server, (first) worker metrics server, prometheus
|
||||
EXPOSE 3186 3187 3188 9090
|
||||
ENV GO111MODULES=on LANG=en_US.utf8 LOG_LEVEL=debug
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/lsif-server"]
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/precise-code-intel"]
|
||||
@ -23,7 +23,7 @@ This project is split into three parts, all currently written in TypeScript. The
|
||||
|
||||
## Entrypoint
|
||||
|
||||
The docker image for this part of the application wraps a server, a bundle manager, and a worker in a [goreman](https://github.com/mattn/goreman) supervisor. By default, there will be one API process and one worker process. The number of replicas per process can be tuned with the environment variables `LSIF_NUM_APIS` (zero or one), `LSIF_NUM_BUNDLE_MANAGERS` (zero or one), and `LSIF_NUM_WORKERS` (zero or more).
|
||||
The docker image for this part of the application wraps a server, a bundle manager, and a worker in a [goreman](https://github.com/mattn/goreman) supervisor. By default, there will be one API process and one worker process. The number of replicas per process can be tuned with the environment variables `PRECISE_CODE_INTEL_NUM_APIS` (zero or more), `PRECISE_CODE_INTEL_NUM_BUNDLE_MANAGERS` (zero or one), and `PRECISE_CODE_INTEL_NUM_WORKERS` (zero or more).
|
||||
|
||||
### Prometheus metrics
|
||||
|
||||
@ -15,16 +15,16 @@ export GOARCH=amd64
|
||||
export GOOS=linux
|
||||
export CGO_ENABLED=0
|
||||
|
||||
cp -a ./cmd/lsif-server "$OUTPUT"
|
||||
cp -a ./cmd/precise-code-intel "$OUTPUT"
|
||||
|
||||
echo "--- go build"
|
||||
go build \
|
||||
-trimpath \
|
||||
-ldflags "-X github.com/sourcegraph/sourcegraph/internal/version.version=$VERSION" \
|
||||
-o "$OUTPUT/lsif-server" github.com/sourcegraph/sourcegraph/cmd/lsif-server
|
||||
-o "$OUTPUT/precise-code-intel" github.com/sourcegraph/sourcegraph/cmd/precise-code-intel
|
||||
|
||||
echo "--- docker build"
|
||||
docker build -f cmd/lsif-server/Dockerfile -t "$IMAGE" "$OUTPUT" \
|
||||
docker build -f cmd/precise-code-intel/Dockerfile -t "$IMAGE" "$OUTPUT" \
|
||||
--progress=plain \
|
||||
--build-arg COMMIT_SHA \
|
||||
--build-arg DATE \
|
||||
@ -14,9 +14,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
apis = env.Get("LSIF_NUM_APIS", "1", "the number of API instances to run (defaults to one)")
|
||||
bundleManagers = env.Get("LSIF_NUM_BUNDLE_MANAGERS", "1", "the number of bundle manager instances to run (defaults to one)")
|
||||
workers = env.Get("LSIF_NUM_WORKERS", "1", "the number of worker instances to run (defaults to one)")
|
||||
apis = env.Get("PRECISE_CODE_INTEL_NUM_APIS", "1", "the number of API instances to run (defaults to one)")
|
||||
bundleManagers = env.Get("PRECISE_CODE_INTEL_NUM_BUNDLE_MANAGERS", "1", "the number of bundle manager instances to run (defaults to one)")
|
||||
workers = env.Get("PRECISE_CODE_INTEL_NUM_WORKERS", "1", "the number of worker instances to run (defaults to one)")
|
||||
|
||||
// Set in docker image
|
||||
prometheusStorageDir = os.Getenv("PROMETHEUS_STORAGE_DIR")
|
||||
@ -31,18 +31,18 @@ const (
|
||||
|
||||
func main() {
|
||||
numAPIs, err := strconv.ParseInt(apis, 10, 64)
|
||||
if err != nil || numAPIs < 0 || numAPIs > 1 {
|
||||
log.Fatalf("Invalid int %q for LSIF_NUM_APIS: %s", apis, err)
|
||||
if err != nil || numAPIs < 0 {
|
||||
log.Fatalf("Invalid int %q for PRECISE_CODE_INTEL_NUM_APIS: %s", apis, err)
|
||||
}
|
||||
|
||||
numBundleManagers, err := strconv.ParseInt(bundleManagers, 10, 64)
|
||||
if err != nil || numBundleManagers < 0 || numBundleManagers > 1 {
|
||||
log.Fatalf("Invalid int %q for LSIF_NUM_BUNDLE_MANAGERS: %s", bundleManagers, err)
|
||||
log.Fatalf("Invalid int %q for PRECISE_CODE_INTEL_NUM_BUNDLE_MANAGERS: %s", bundleManagers, err)
|
||||
}
|
||||
|
||||
numWorkers, err := strconv.ParseInt(workers, 10, 64)
|
||||
if err != nil || numWorkers < 0 {
|
||||
log.Fatalf("Invalid int %q for LSIF_NUM_WORKERS: %s", workers, err)
|
||||
log.Fatalf("Invalid int %q for PRECISE_CODE_INTEL_NUM_WORKERS: %s", workers, err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(
|
||||
@ -69,17 +69,17 @@ func makeProcfile(numAPIs, numBundleManagers, numWorkers int64) string {
|
||||
}
|
||||
|
||||
if numAPIs > 0 {
|
||||
addProcess("pci-api-server", "node /pci/out/api-server/api.js")
|
||||
addProcess("api-server", "node /precise-code-intel/out/api-server/api.js")
|
||||
}
|
||||
|
||||
if numBundleManagers > 0 {
|
||||
addProcess("pci-bundle-manager", "node /pci/out/bundle-manager/manager.js")
|
||||
addProcess("bundle-manager", "node /precise-code-intel/out/bundle-manager/manager.js")
|
||||
}
|
||||
|
||||
for i := 0; i < int(numWorkers); i++ {
|
||||
addProcess(
|
||||
fmt.Sprintf("pci-worker-%d", i),
|
||||
fmt.Sprintf("env METRICS_PORT=%d node /pci/out/worker/worker.js", workerPort+i),
|
||||
fmt.Sprintf("worker-%d", i),
|
||||
fmt.Sprintf("env METRICS_PORT=%d node /precise-code-intel/out/worker/worker.js", workerPort+i),
|
||||
)
|
||||
}
|
||||
|
||||
@ -103,15 +103,15 @@ func makePrometheusTargets(numAPIs, numBundleManagers, numWorkers int64) string
|
||||
}
|
||||
|
||||
if numAPIs > 0 {
|
||||
addTarget("pci-api-server", apiPort)
|
||||
addTarget("api-server", apiPort)
|
||||
}
|
||||
|
||||
if numBundleManagers > 0 {
|
||||
addTarget("pci-bundle-manager", bundleManagerPort)
|
||||
addTarget("bundle-manager", bundleManagerPort)
|
||||
}
|
||||
|
||||
for i := 0; i < int(numWorkers); i++ {
|
||||
addTarget("pci-worker", workerPort+i)
|
||||
addTarget("worker", workerPort+i)
|
||||
}
|
||||
|
||||
return strings.Join(content, "\n") + "\n"
|
||||
@ -167,7 +167,7 @@ export class Database {
|
||||
//
|
||||
|
||||
private async request<T>(method: string, searchParams: URLSearchParams, ctx: TracingContext): Promise<T> {
|
||||
const url = new URL(`/dbs/${this.dumpId}/${method}`, settings.LSIF_BUNDLE_MANAGER_URL)
|
||||
const url = new URL(`/dbs/${this.dumpId}/${method}`, settings.PRECISE_CODE_INTEL_BUNDLE_MANAGER_URL)
|
||||
url.search = searchParams.toString()
|
||||
const resp = await got.get(url.href)
|
||||
return parseJSON(resp.body)
|
||||
@ -120,7 +120,9 @@ export function createLsifRouter(
|
||||
await logAndTraceCall(ctx, 'Uploading payload to bundle manager', () =>
|
||||
pipeline(
|
||||
fs.createReadStream(filename),
|
||||
got.stream.post(new URL(`/uploads/${uploadId}`, settings.LSIF_BUNDLE_MANAGER_URL).href)
|
||||
got.stream.post(
|
||||
new URL(`/uploads/${uploadId}`, settings.PRECISE_CODE_INTEL_BUNDLE_MANAGER_URL).href
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ -4,7 +4,8 @@ import { readEnvInt } from '../shared/settings'
|
||||
export const HTTP_PORT = readEnvInt('HTTP_PORT', 3186)
|
||||
|
||||
/** HTTP address for internal LSIF bundle manager server. */
|
||||
export const LSIF_BUNDLE_MANAGER_URL = process.env.LSIF_BUNDLE_MANAGER_URL || 'http://localhost:3187'
|
||||
export const PRECISE_CODE_INTEL_BUNDLE_MANAGER_URL =
|
||||
process.env.PRECISE_CODE_INTEL_BUNDLE_MANAGER_URL || 'http://localhost:3187'
|
||||
|
||||
/** Where on the file system to temporarily store LSIF uploads. This need not be a persistent volume. */
|
||||
export const STORAGE_ROOT = process.env.LSIF_STORAGE_ROOT || 'lsif-storage'
|
||||
@ -3,8 +3,9 @@ import { readEnvInt } from '../shared/settings'
|
||||
/** Which port to run the bundle manager API on. Defaults to 3187. */
|
||||
export const HTTP_PORT = readEnvInt('HTTP_PORT', 3187)
|
||||
|
||||
/** HTTP address for internal LSIF HTTP API. */
|
||||
export const LSIF_API_SERVER_URL = process.env.LSIF_API_SERVER_URL || 'http://localhost:3186'
|
||||
/** HTTP address for internal precise code intel API. */
|
||||
export const PRECISE_CODE_INTEL_API_SERVER_URL =
|
||||
process.env.PRECISE_CODE_INTEL_API_SERVER_URL || 'http://localhost:3186'
|
||||
|
||||
/** Where on the file system to store LSIF files. This should be a persistent volume. */
|
||||
export const STORAGE_ROOT = process.env.LSIF_STORAGE_ROOT || 'lsif-storage'
|
||||
@ -189,7 +189,7 @@ async function makeServerRequest<T, R>(route: string, payload?: T): Promise<R> {
|
||||
async (): Promise<R> =>
|
||||
parseJSON(
|
||||
(
|
||||
await got.post(new URL(route, settings.LSIF_API_SERVER_URL).href, {
|
||||
await got.post(new URL(route, settings.PRECISE_CODE_INTEL_API_SERVER_URL).href, {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user