Skip to content

Commit 68091e7

Browse files
authored
Merge branch 'main' into auto-edits-docs
2 parents b2acdd3 + b3890e9 commit 68091e7

File tree

10 files changed

+239
-41
lines changed

10 files changed

+239
-41
lines changed

docs/admin/deploy/docker-single-container/index.mdx

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,34 @@ SELECT * FROM users;
138138

139139
## Upgrade
140140

141+
### Postgresql 16
141142
> Warning: The 5.11 release updates the database container images from Postgres 12 to Postgres 16. Customers are advised to have a database backup before upgrading! See our [postgres 12 end of life](https://sourcegraph.com/docs/admin/postgres12_end_of_life_notice#postgres-12-end-of-life) notice!
143+
144+
From sourcegraph version 5.11 onwards, the Sourcegraph single container Docker image uses Postgresql 16. Upgrading from Postgresql 12 to Postgresql 16 is a manual process, that is similar to the one outlined below for multi-version upgrades, but migrator has been merged into the container, allowing for a simpler upgrade.
145+
146+
> NOTE: It is highly recommended to **take an up-to-date snapshot of your databases** prior to starting a multi-version upgrade. The upgrade process aggressively mutates the shape and contents of your database, and undiscovered errors in the migration process or unexpected environmental differences may cause an unusable instance or data loss.
142147
>
143-
> Single-container *does not* support auto migration to postgres 16. If you are planning to upgrade to 5.11.0 and beyond on single-container, you will need to dump the postgres databases and restore them after the upgrade.
144-
> In this event, we highly recommend you migrate to a production supported deployment method, or switch to our cloud offering.
148+
> We recommend performing the entire upgrade procedure on an idle clone of the production instance and switch traffic over on success, if possible. This may be low-effort for installations with a canary environment or a blue/green deployment strategy.
149+
>
150+
> **If you do not feel confident running this process solo**, contact customer support team to help guide you thorough the process.
151+
152+
**Before performing a multi-version upgrade**:
153+
154+
- Read our [update policy](/admin/updates/#update-policy) to learn about Sourcegraph updates.
155+
- Find the entries that apply to the version range you're passing through in the [update notes for Sourcegraph with Docker Single Container](/admin/updates/server#multi-version-upgrade-procedure).
156+
157+
0. You must first shutdown the container instance via `docker stop [CONTAINER]`.
158+
1. Start a temporary Postgres container on top of the Postgres data directory used by the old `sourcegraph/server` image. You must use the *new* postgresql-16-codeinsights image, which is based on the new Postgresql 16 image, and provides an automatic upgrade script to move from Postgresql 12 to Postgresql 16.
159+
160+
`docker run --rm -it -v ~/.sourcegraph/data/postgresql:/data/pgdata-12 -e POSTGRES_USER=postgres -p 5432:5432 sourcegraph/postgresql-16-codeinsights:{CURRENT_VERSION_NO_V}`
161+
162+
2. Once that temporary container marks that Postgresql has started, the migration is complete and you can stop the temporary container.
163+
3. Start the new `sourcegraph/server` container.
164+
165+
`docker run --publish 7080:7080 --publish 127.0.0.1:3370:3370 --rm --volume ~/.sourcegraph/config:/etc/sourcegraph --volume ~/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:{CURRENT_VERSION_NO_V}`
166+
167+
You now have a single server Sourcegraph container image running on Postgresql 16.
168+
145169

146170
### Standard upgrades
147171

@@ -156,6 +180,16 @@ To update, just use the newer `sourcegraph/server:N.N.N` Docker image (where `N.
156180

157181
### Multi-version upgrades
158182

183+
> NOTE: It is no longer necessary to run Migrator outside of the single instance container. Migrator is now built into the container, and will be run via the `sourcegraph/server` image.
184+
>
185+
> We **still** recommend performing the entire upgrade procedure on an idle clone of the production instance and switch traffic over on success, if possible. This may be low-effort for installations with a canary environment or a blue/green deployment strategy.
186+
>
187+
> The below docs are kept for posterity for users on older versions of Sourcegraph that are looking to upgrade or run the migrator tool.
188+
189+
To update, just use the newer `sourcegraph/server:N.N.N` Docker image in place of the older one, using the same Docker volumes. Your server's data will be migrated automatically if needed. You can always find the version number details of the latest release via the [technical changelog](/technical-changelog).
190+
191+
### (Legacy) Multi-version upgrades
192+
159193
A [multi-version upgrade](/admin/updates/#multi-version-upgrades) is a downtime-incurring upgrade from version 3.20 or later to any future version. Multi-version upgrades will run both schema and data migrations to ensure the data available from the instance remains available post-upgrade.
160194

161195
> NOTE: It is highly recommended to **take an up-to-date snapshot of your databases** prior to starting a multi-version upgrade. The upgrade process aggressively mutates the shape and contents of your database, and undiscovered errors in the migration process or unexpected environmental differences may cause an unusable instance or data loss.
@@ -218,21 +252,22 @@ For example, `${PATH}` is `~/.sourcegraph/data` in `-v ~/.sourcegraph/data:/var/
218252

219253
```sh
220254
$ docker run --rm -it \
221-
-v ${PATH}/postgresql:/data/pgdata-${PG_VERSION} \
255+
-v ${PATH}/postgresql:/data/pgdata-12 \
222256
-u 70 \
223257
-p 5432:5432 \
224258
--entrypoint bash \
225-
sourcegraph/postgres-${PG_VERSION_TAG}:${SG_VERSION} \
226-
-c 'echo "host all all 0.0.0.0/0 trust" >> /data/pgdata-${PG_VERSION}/pg_hba.conf && postgres -c l listen_addresses="*" -D /data/pgdata-${PG_VERSION}'
259+
sourcegraph/${PG_VERSION_TAG}:${SG_VERSION} \
260+
-c 'echo "host all all 0.0.0.0/0 trust" >> /data/pgdata-12/pg_hba.conf && postgres -c l listen_addresses="*" -D /data/pgdata-12'
227261
```
228262

229263
The version of this Postgres container is dependent on the version of the instance prior to upgrade.
230264

231-
| `${SG_VERSION}` | `${PG_VERSION}` | `${PG_VERSION_TAG}` |
232-
| ------------------- | --------------- | ------------------- |
233-
| `3.20.X` - `3.29.X` | `12` | `12.6` |
234-
| `3.30.X` - `3.37.X` | `12` | `12.6-alpine` |
235-
| `3.38.X` - | `12` | `12-alpine` |
265+
| `${SG_VERSION}` | `${PG_VERSION_TAG}` |
266+
| ------------------- | ------------------- |
267+
| `3.20.X` - `3.29.X` | `postgres-12.6` |
268+
| `3.30.X` - `3.37.X` | `postgres-12.6-alpine`|
269+
| `3.38.X` - `5.9.X` | `postgres-12-alpine` |
270+
| `5.10.X` - | `postgresql-16` |
236271

237272
## Troubleshooting
238273

docs/admin/deploy/kubernetes/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ data:
103103
password: ""
104104
port: ""
105105
user: ""
106+
pgsslmode: "require" # optional, enable if using SSL
106107
---
107108
apiVersion: v1
108109
kind: Secret
@@ -115,6 +116,7 @@ data:
115116
password: ""
116117
port: ""
117118
user: ""
119+
pgsslmode: "require" # optional, enable if using SSL
118120
---
119121
apiVersion: v1
120122
kind: Secret
@@ -127,6 +129,7 @@ data:
127129
password: ""
128130
port: ""
129131
user: ""
132+
pgsslmode: "require" # optional, enable if using SSL
130133
```
131134
132135
The above Secrets should be deployed to the same namespace as the existing Sourcegraph deployment.
@@ -163,6 +166,7 @@ pgsql:
163166
user: "new-user"
164167
password: "new-password"
165168
port: "5432"
169+
pgsslmode: "require" # optional, enable if using SSL
166170
```
167171

168172
#### Using external Redis instances

docs/admin/executors/executors_troubleshooting.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,22 @@ Tells us that the Pod cannot be scheduled because the pod affinity rules (`EXECU
242242
configured do not match any nodes.
243243

244244
In this case, the `EXECUTOR_KUBERNETES_POD_AFFINITY` needs to be modified to correctly target the node.
245+
246+
### Executor Job failure issues
247+
248+
If you see below errors for executor jobs:
249+
250+
Codeintel
251+
```Index failed to index: Running command "step.kubernetes.pre-index.0": job sg-executor-job-codeintel-111877 failed: Usage of EmptyDir volume "job-data" exceeds the limit "5Gi".```
252+
253+
Batch Changes
254+
```"step.kubernetes.step.0.pre": job sg-executor-job-batches-91562 failed: Usage of EmptyDir volume "job-data" exceeds the limit "5Gi".```
255+
256+
Update the below variables in the respective executor's deployment file to increase EmptyDir volume "job-data" storage. In this example, ```KUBERNETES_JOB_VOLUME_SIZE``` is set to 20Gi, but you can tweak it as per your requirement.
257+
258+
```
259+
- name: KUBERNETES_JOB_VOLUME_TYPE value: emptyDir
260+
- name: KUBERNETES_JOB_VOLUME_SIZE value: 20Gi
261+
```
262+
263+
```KUBERNETES_JOB_VOLUME_TYPE``` can be either set to ```emptyDir``` or ```pvc``` and if it’s not set, the default is ```emptyDir```
File renamed without changes.

docs/releases.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Currently supported versions of Sourcegraph:
1212

1313
| **Release** | **General Availability Date** | **Supported** | **Release Notes** | **Install** |
1414
|--------------|-------------------------------|---------------|--------------------------------------------------------------------|------------------------------------------------------|
15+
| 5.11 Patch 4 | January 2025 || [Notes](https://sourcegraph.com/docs/technical-changelog#v5114013) | [Install](https://sourcegraph.com/docs/admin/deploy) |
1516
| 5.11 Patch 3 | January 2025 || [Notes](https://sourcegraph.com/docs/technical-changelog#v5114013) | [Install](https://sourcegraph.com/docs/admin/deploy) |
1617
| 5.11 Patch 2 | January 2025 || [Notes](https://sourcegraph.com/docs/technical-changelog#v5113601) | [Install](https://sourcegraph.com/docs/admin/deploy) |
1718
| 5.11 Patch 1 | January 2025 || [Notes](https://sourcegraph.com/docs/technical-changelog#v5112732) | [Install](https://sourcegraph.com/docs/admin/deploy) |

docs/technical-changelog.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,44 @@ This page documents all notable changes to Sourcegraph. For more detailed change
44

55
{/* CHANGELOG_START */}
66

7+
# 5.11 Patch 4
8+
9+
## v5.11.5234
10+
11+
- [sourcegraph](https://github.com/sourcegraph/sourcegraph/releases/tag/v5.11.5234)
12+
13+
- [docker-compose](https://github.com/sourcegraph/deploy-sourcegraph-docker/releases/tag/v5.11.5234)
14+
15+
- [helm](https://github.com/sourcegraph/deploy-sourcegraph-helm/releases/tag/v5.11.5234)
16+
17+
- [kustomize](https://github.com/sourcegraph/deploy-sourcegraph-k8s/releases/tag/v5.11.5234)
18+
19+
### Features
20+
21+
#### Perforce
22+
23+
- Use depot name for label cache `(PR #2805)`
24+
25+
### Fix
26+
27+
#### Source
28+
29+
- Possible Perforce changelists are now converted to their respective git commit during ResolveRevision `(PR #2825)`
30+
31+
### Reverts
32+
33+
There were no reverts for this release
34+
35+
### Uncategorized
36+
37+
#### Others
38+
39+
- [Manual Backport]: update shellcheck to 0.10.0 `(PR #2838)`
40+
- NA
41+
42+
{/* RSS={"version":"v5.11.5234", "releasedAt": "2025-01-17"} */}
43+
44+
745
# 5.11 Patch 3
846

947
## v5.11.4013

next.config.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,36 @@ const nextConfig = {
1414
// https://vercel.com/docs/projects/environment-variables/system-environment-variables
1515
// basePath: process.env.VERCEL_ENV === 'production' ? '/docs' : '',
1616
basePath: '/docs',
17-
async redirects() {
18-
return [
19-
...updatedRedirectsData,
20-
{
21-
source: `/v/${config.DOCS_LATEST_VERSION}/:slug*`,
22-
destination: `https://sourcegraph.com/docs/:slug*`,
23-
permanent: false
24-
},
25-
{
26-
source: `/@${config.DOCS_LATEST_VERSION}/:slug*`,
27-
destination: `https://sourcegraph.com/docs/:slug*`,
28-
permanent: false
29-
},
30-
{
31-
source: '/v/:version(\\d+\\.\\d+)/:slug*',
32-
destination: 'https://:version.sourcegraph.com/:slug*',
33-
permanent: true
34-
},
35-
{
36-
source: '/@:version(\\d+\\.\\d+)/:slug*',
37-
destination: 'https://:version.sourcegraph.com/:slug*',
38-
permanent: true
39-
},
40-
{
41-
source: '/changelog.rss',
42-
destination: '/technical-changelog.rss',
43-
permanent: true
44-
}
45-
];
46-
}
17+
// async redirects() {
18+
// return [
19+
// ...updatedRedirectsData,
20+
// {
21+
// source: `/v/${config.DOCS_LATEST_VERSION}/:slug*`,
22+
// destination: `https://sourcegraph.com/docs/:slug*`,
23+
// permanent: false
24+
// },
25+
// {
26+
// source: `/@${config.DOCS_LATEST_VERSION}/:slug*`,
27+
// destination: `https://sourcegraph.com/docs/:slug*`,
28+
// permanent: false
29+
// },
30+
// {
31+
// source: '/v/:version(\\d+\\.\\d+)/:slug*',
32+
// destination: 'https://:version.sourcegraph.com/:slug*',
33+
// permanent: true
34+
// },
35+
// {
36+
// source: '/@:version(\\d+\\.\\d+)/:slug*',
37+
// destination: 'https://:version.sourcegraph.com/:slug*',
38+
// permanent: true
39+
// },
40+
// {
41+
// source: '/changelog.rss',
42+
// destination: '/technical-changelog.rss',
43+
// permanent: true
44+
// }
45+
// ];
46+
// }
4747
};
4848

4949
module.exports = async () => {

src/data/navigation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export const navigation: NavigationItem[] = [
5656
{ title: "Chat", href: "/cody/capabilities/chat", },
5757
{ title: "Autocomplete", href: "/cody/capabilities/autocomplete", },
5858
{ title: "Auto-edit", href: "/cody/capabilities/auto-edit", },
59-
{ title: "Prompts", href: "/cody/capabilities/commands", },
6059
{ title: "OpenCtx", href: "/cody/capabilities/openctx", },
6160
{ title: "Debug Code", href: "/cody/capabilities/debug-code", },
6261
{ title: "Context Filters", href: "/cody/capabilities/ignore-context", },

src/data/redirects.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6717,6 +6717,20 @@ const redirectsData = [
67176717
destination: "/code-search/code-navigation/inference_configuration",
67186718
permanent: true
67196719
},
6720+
// Model Config docs
6721+
{
6722+
source: "/cody/clients/model-configuration",
6723+
destination: "/cody/enterprise/model-configuration",
6724+
permanent: true
6725+
},
6726+
6727+
//Commands redirects
6728+
{
6729+
source: "/cody/capabilities/commands",
6730+
destination: "/cody/capabilities/prompts",
6731+
permanent: true
6732+
},
6733+
67206734

67216735
];
67226736

src/middleware.ts

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import { NextResponse } from 'next/server'
2+
import type { NextRequest } from 'next/server'
3+
import docsConfig from '../docs.config.js'
4+
5+
const { updatedRedirectsData } = require('./data/redirects.ts');
6+
7+
function createRedirectUrl(request: NextRequest, destination: string, path: string): string {
8+
// Handle absolute URLs
9+
if (destination.startsWith('http')) {
10+
// Handle dynamic slug replacements
11+
if (destination.includes(':slug')) {
12+
const slugMatch = path.match(/[^/]+$/)
13+
const slug = slugMatch ? slugMatch[0] : ''
14+
destination = destination.replace(':slug*', slug)
15+
}
16+
// Handle version replacements
17+
if (destination.includes(':version')) {
18+
const versionMatch = path.match(/\d+\.\d+/)
19+
const version = versionMatch ? versionMatch[0] : ''
20+
destination = destination.replace(':version', version)
21+
}
22+
23+
return destination
24+
}
25+
26+
// Handle relative paths
27+
const basePath = '/docs'
28+
return destination.startsWith('/') ?
29+
`${request.nextUrl.origin}${basePath}${destination}` :
30+
`${request.nextUrl.origin}${basePath}/${destination}`
31+
}
32+
33+
export function middleware(request: NextRequest) {
34+
const path = request.nextUrl.pathname
35+
const pathWithoutBase = path.replace('/docs', '')
36+
37+
// Handle base redirects from redirects.ts
38+
const redirect = updatedRedirectsData.find((r: any) => r.source === pathWithoutBase)
39+
if (redirect) {
40+
return NextResponse.redirect(createRedirectUrl(request, redirect.destination, path))
41+
}
42+
// Handle version without slug
43+
const versionOnlyMatch = pathWithoutBase.match(/^\/v\/(\d+\.\d+)$/)
44+
if (versionOnlyMatch) {
45+
return NextResponse.redirect(`https://${versionOnlyMatch[1]}.sourcegraph.com/`)
46+
}
47+
// Handle version-specific redirects
48+
if (pathWithoutBase.startsWith(`/v/${docsConfig.DOCS_LATEST_VERSION}/`)) {
49+
return NextResponse.redirect(createRedirectUrl(
50+
request,
51+
`https://sourcegraph.com/docs/:slug*`,
52+
pathWithoutBase
53+
))
54+
}
55+
if (pathWithoutBase.startsWith(`/@${docsConfig.DOCS_LATEST_VERSION}/`)) {
56+
return NextResponse.redirect(createRedirectUrl(
57+
request,
58+
`https://sourcegraph.com/docs/:slug*`,
59+
pathWithoutBase
60+
))
61+
}
62+
const versionMatch = pathWithoutBase.match(/^\/v\/(\d+\.\d+)\/(.*)/)
63+
if (versionMatch) {
64+
return NextResponse.redirect(createRedirectUrl(
65+
request,
66+
'https://:version.sourcegraph.com/:slug*',
67+
pathWithoutBase
68+
))
69+
}
70+
const atVersionMatch = pathWithoutBase.match(/^\/@(\d+\.\d+)\/(.*)/)
71+
if (atVersionMatch) {
72+
return NextResponse.redirect(createRedirectUrl(
73+
request,
74+
'https://:version.sourcegraph.com/:slug*',
75+
pathWithoutBase
76+
))
77+
}
78+
if (pathWithoutBase === '/changelog.rss')
79+
return NextResponse.redirect(createRedirectUrl(request, '/technical-changelog.rss', path))
80+
81+
return NextResponse.next()
82+
}
83+
84+
export const config = {
85+
matcher: [
86+
'/((?!api|_next/static|_next/image|assets|favicon.ico|sw.js).*)',
87+
],
88+
}

0 commit comments

Comments
 (0)