Skip to content

Commit 39b2d87

Browse files
authored
Merge branch 'main' into deep-cody-docs
2 parents b307a9a + b2f2f2e commit 39b2d87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4753
-2332
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sourcegraph Docs
22

3-
<!-- Working branch for Nov 25th 2024 Release -->
3+
<!-- Working branch for Dec 2024 Release -->
44

55
Welcome to the Sourcegraph documentation! We're excited to have you contribute to our docs. We've recently rearchitectured our docs tech stack — powered by Next.js, TailwindCSS and deployed on Vercel. This guide will walk you through the process of contributing to our documentation using the new tech stack.
66

baseai/memory/docs/index.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
import { MemoryI } from '@baseai/core';
2-
import path from 'path';
32

43
const memoryDocs = (): MemoryI => ({
54
name: 'docs',
65
description: 'Docs folder of sourcegraph docs repository as an auto-synced memory',
7-
config: {
8-
useGitRepo: true,
9-
dirToTrack: path.posix.join('.', 'docs'),
10-
extToTrack: [".md", ".mdx"]
11-
}
6+
git: {
7+
enabled: true,
8+
include: ['**/*'],
9+
gitignore: true,
10+
deployedAt: '',
11+
embeddedAt: '',
12+
},
13+
documents: {
14+
meta: doc => {
15+
const url = `https://sourcegraph.com/docs/${doc.path}`;
16+
return {
17+
url,
18+
name: doc.name,
19+
};
20+
},
21+
},
1222
});
1323

1424
export default memoryDocs;

docs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const config = {
2-
DOCS_LATEST_VERSION: '5.10'
2+
DOCS_LATEST_VERSION: '5.11'
33
};
44

55
module.exports = config;

docs/admin/audit_log.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Here's a word-by-word breakout to demonstrate how the captured entry aligns with
5151

5252
### What is audited?
5353

54-
- [Security events](./security_event_logs)
55-
- [Gitserver access](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/gitserver/internal/accesslog/accesslog.go?L100-104)
56-
- [GraphQL requests](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/internal/httpapi/graphql.go?L226-244)
54+
- **Security Events** - [A list of events](./security_event_logs) such as logins, site configuration updates, code host configuration updates (_These logs can be sent to the database for easier collection as well as to the standard output_).
55+
- **Gitserver Access** - Requests to the [`gitserver`](./deploy/scale.mdx#gitserver) component that is responsible for brokering transactions between the git repos on disk and all other Sourcegraph components.
56+
- **GraphQL Requests** - Requests To The Sourcegraph [`frontend`](./deploy/scale.mdx#frontend) component that is usually named `sourcegraph-frontend-{DYNAMICALLY CREATED ALPHANUMERIC}`
5757

5858
This list is expected to grow in the future.
5959

@@ -89,6 +89,9 @@ Audit logs are structured logs. As long as one can ingest logs, we assume one ca
8989

9090
### On Premises
9191

92+
All logs mentioned are delivered to the standard output (stdout) for each individual [component](./deploy/scale.mdx#core-components).
93+
94+
9295
There are two easy approaches to filtering the audit logs:
9396

9497
- JSON-based: look for the presence of the `Attributes.audit` node. Do not depend on the log level, as it can change based on `SRC_LOG_LEVEL`.

docs/admin/config/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ This page documents how to configure a Sourcegraph instance. For deployment conf
3333
- [Restore postgres database from snapshot](/admin/config/restore/)
3434
- [Enabling database encryption for sensitive data](/admin/config/encryption)
3535
- [Configuring Sourcegraph in private networks](/admin/config/private-network)
36+
- [Restricting outgoing connections](/admin/config/network-filtering)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Outoing Connection Filtering
2+
Sourcegraph supports outbound connection filtering. Both for regular external connections and so-called "untrusted" connections, where a regular user can provide a URL to make an outbound connection to.
3+
4+
The allow- and denylist support a comma separated list of IP ranges, hostnames and keywords. To block or allow all the internal connections use the “private” keyword, this would block all RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and RFC 4193 (FC00::/7) IP addresses. Keywords can be combined with ranges and IP addresses so it's very customizable.
5+
6+
## Trusted External Connections
7+
It’s possible for the Sourcegraph instance to deny access to external hosts by setting the environment variable `EXTERNAL_DENY_LIST` on the deployment.
8+
9+
The default denylist is set up to only block localhost and the Cloud metadata service IP address. Expanding the denylist could interfere with internal authentication providers, and they might need to be excluded from the denylist.
10+
11+
### Example Configuration
12+
13+
Adding a denylist can be done by setting the environment variable `EXTERNAL_DENY_LIST` on the deployment.
14+
15+
```
16+
EXTERNAL_DENY_LIST="private,github.com"
17+
```
18+
19+
This would deny all connections to hosts in the private network and github.com.
20+
21+
## Untrusted External Connections
22+
Codemonitors, webhooks and Cody URL context are limited to only be able to access public IP addresses by default. This behavior can be changed with the `UNTRUSTED_EXTERNAL_ALLOW_LIST` environment variable, which configures the allowlist.
23+
24+
### Example Configuration
25+
If you want Cody to use context from an internal server in addition to internet access, you can add the internal server's IP address to the allowlist:
26+
27+
```
28+
UNTRUSTED_EXTERNAL_ALLOW_LIST="external,192.168.1.53"
29+
```
30+
31+
## Implementation Details
32+
To achieve this, we use [gitea's hostmatcher](https://github.com/go-gitea/gitea/blob/v1.22.6/modules/hostmatcher/hostmatcher.go#L39). This is configured by default for the `ExternalClient`, which is used for all external requests. The common options and configuration can be found [here](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/internal/httpcli/client.go#L406C1-L423C2).

docs/admin/config/private-network.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Private network configuration
2+
23
A **private network** refers to a secure network environment segregated from the public internet, designed to facilitate internal communications and operations within an organization. This network setup restricts external access, enhancing security and control over data flow by limiting exposure to external threats and unauthorized access.
34

4-
When deploying self-hosted Sourcegraph instances in private networks with specific compliance and policy requirements, additional configuration may be required to ensure all networking features function correctly. The reasons for applying the following configuration options depend on the specific functionality of the Sourcegraph service and the unique network and infrastructure requirements of the organization.
5+
When deploying self-hosted Sourcegraph instances in private networks with specific compliance and policy requirements, additional configuration may be required to ensure all networking features function correctly. The reasons for applying the following configuration options depend on the specific functionality of the Sourcegraph service and the unique network and infrastructure requirements of the organization.
56

67
The following is a list of Sourcegraph services and how and when each initiates outbound connections to external services:
8+
79
- **executor**: Sourcegraph [Executor](../executors) batch change or precise indexing jobs may need to connect to services hosted within an organization's private network
810
- **frontend**: The frontend service communicates externally when connecting to external [auth providers](../auth), sending [telemetry data](../pings), testing code host connections, and connecting to [externally hosted](../external_services) Sourcegraph services
911
- **gitserver**: Executes git commands against externally hosted [code hosts](../external_service)
@@ -12,15 +14,17 @@ The following is a list of Sourcegraph services and how and when each initiates
1214
- **worker**: Sourcegraph [Worker](../workers) run various background jobs that may require establishing connections to services hosted within an organization's private network
1315

1416
## HTTP proxy configuration
17+
1518
All Sourcegraph services respect the conventional `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` environment variables for routing Sourcegraph client application HTTP traffic through a proxy server. The steps for configuring proxy environment variables will depend on your Sourcegraph deployment method.
1619

1720
### Kubernetes Helm
21+
1822
Add the proxy environment variables to your Sourcegraph Helm chart [override file](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/values.yaml):
1923

2024
```yaml
2125
executor|frontend|gitserver|migrator|repo-updater|worker:
2226
env:
23-
- name: HTTP_PROXY
27+
- name: HTTP_PROXY
2428
value: http://proxy.example.com:8080
2529
- name: HTTPS_PROXY
2630
value: http://proxy.example.com:8080
@@ -33,7 +37,7 @@ executor|frontend|gitserver|migrator|repo-updater|worker:
3337
## Using private CA root certificates
3438
Some organizations maintain a private Certificate Authority (CA) for issuing certificates within their private network. When Sourcegraph connects to TLS encrypted service using a self-signed certificate that it does not trust, you will observe an `x509: certificate signed by unknown authority` error message in logs.
3539

36-
In order for Sourcegraph to respect an organization's self-signed certificates, the private CA root certificate(s) will need to be appended to Sourcegraph's trusted CA root certificate list in `/etc/ssl/certs/ca-certificates.crt`.
40+
In order for Sourcegraph to respect an organization's self-signed certificates, the private CA root certificate(s) will need to be appended to Sourcegraph's trusted CA root certificate list in `/etc/ssl/certs/ca-certificates.crt`.
3741

3842
### Configuring sourcegraph-frontend to recognize private CA root certificates
3943
The following details the process for setting up the sourcegraph-frontend to acknowledge and trust a private CA root certificate for Sourcegraph instances deployed using [Helm](../deploy/kubernetes/helm). For any other Sourcegraph service that needs to trust an organization's private CA root certificate (including gitserver, repo-updater, or migrator), similar steps will need to be followed.

docs/admin/config/site_config.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ All site configuration options and their default values are shown below.
268268
// - {
269269
// "debug": true,
270270
// "sampling": "all",
271-
// "type": "jaeger",
271+
// "type": "opentelemetry", // Jaeger now uses the OpenTelemetry format, the old jaeger format is deprecated
272272
// "urlTemplate": "{{ .ExternalURL }}/-/debug/jaeger/trace/{{ .TraceID }}"
273273
// }
274274

@@ -304,9 +304,12 @@ All site configuration options and their default values are shown below.
304304
// Don't sync a user's permissions if they have synced within the last n seconds.
305305
"permissions.syncUsersBackoffSeconds": 60,
306306

307-
// The maximum number of user-centric permissions syncing jobs that can be spawned concurrently. Service restart is required to take effect for changes.
307+
// The maximum number of user-centric permissions syncing jobs that can be spawned concurrently. Server restart is required for changes to take effect.
308308
"permissions.syncUsersMaxConcurrency": 1,
309309

310+
// The maximum number of repo-centric permissions syncing jobs that can be spawned concurrently. Server restart is required for changes to take effect.
311+
"permissions.syncReposMaxConcurrency": 5,
312+
310313
"rateLimits": null,
311314

312315
// Enables redacting sensitive information from outbound requests. Important: We only respect this setting in development environments. In production, we always redact outbound requests.

0 commit comments

Comments
 (0)