Skip to content

Commit 0ef56b1

Browse files
authored
Merge branch 'main' into wg/rel/sourcegraph-6-upgrade-docs
2 parents 4d992b2 + 515e3b1 commit 0ef56b1

File tree

104 files changed

+9287
-8461
lines changed

Some content is hidden

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

104 files changed

+9287
-8461
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 Dec 2024 Release -->
3+
<!-- Working branch for JAN 2025 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

dev/rss.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const generateRssFeed = () => {
3030
id: siteURL,
3131
link: baseURL,
3232
language: 'en',
33-
image: `${siteURL}/favicon.png`,
34-
favicon: `${siteURL}/favicon.ico`,
33+
image: `${siteURL}/sourcegraph-mark.png`,
34+
favicon: `${siteURL}/sourcegraph-mark.png`,
3535
copyright: `All rights reserved ${date.getFullYear()}, Sourcegraph`,
3636
updated: date,
3737
generator: 'Sourcegraph RSS Feed',

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.11'
2+
DOCS_LATEST_VERSION: '6.0'
33
};
44

55
module.exports = config;

docs/admin/enterprise_getting_started_guide/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Enterprise Getting Started Guide
1+
# Resources for Sourcegraph Enterprise Instance
22

33
If you're deploying a new Enterprise instance, this page covers our most frequently referenced pieces of documentation. Admins will be interested in the documentation for their specific deployment method; users will want to check out info on our search syntax, operators, batch changes, and browser extension.
44

docs/admin/how-to/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@
2828
- [Migrating code intelligence data from LSIF to SCIP (Sourcegraph 4.5 -> 4.6)](/admin/how-to/lsif_scip_migration)
2929
- [How to export search results](/admin/how-to/export-search-results)
3030
- [How to debug / confirm blobstore is healthy](/admin/how-to/blobstore_debugging)
31+
- [How to handle postgresql 12 to 16 drift](/admin/how-to/postgresql-12-to-16-drift)
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# PostgreSQL 12 to 16 Schema Drift
2+
3+
In Sourcegraph versions `5.10.x` and `5.11.x` we support both PostgreSQL 12 and 16. However, Sourcegraph's database management tool `migrator` expects the database schema of the various Sourcegraph databases to be in an exact expected state. The upgrade from PostgreSQL 12 to 16 is opinionated and automatically mutates the schema without running our application defined migrations. Starting in Sourcegraph `5.10.0` we expect databases to be in PosttgresSQL 16 and as such our tooling will identify schema drift in PostgreSQL 12 databases. This drift does not impact the functionality of the Sourcegraph instance but will stop migrator's multiversion `upgrade` command and `autoupgrade` from executing.
4+
5+
The drift takes the following general form, dropping table prefixes to columns in views, and changing `uuid` types to `gen_random_uuid()`:
6+
```diff
7+
Schema drift detected in 8 objects:
8+
9+
webhooks.uuid:
10+
Problem: Unexpected properties of column webhooks."uuid"
11+
Solution: alter the column
12+
Statement: ALTER TABLE webhooks ALTER COLUMN uuid SET DEFAULT public.gen_random_uuid();
13+
14+
batch_spec_workspace_execution_queue:
15+
Problem: Unexpected definition of view "batch_spec_workspace_execution_queue"
16+
Solution: redefine the view
17+
Diff:
18+
(
19+
"""
20+
... // 6 identical lines
21+
ORDER BY (rank() OVER (PARTITION BY queue.user_id ORDER BY exec.created_at, exec.id)), queue.latest_dequeue NULLS FIRST
22+
)
23+
- SELECT id,
24+
+ SELECT queue_candidates.id,
25+
row_number() OVER () AS place_in_global_queue,
26+
- place_in_user_queue
27+
+ queue_candidates.place_in_user_queue
28+
FROM queue_candidates;
29+
"""
30+
)
31+
32+
codeintel_configuration_policies:
33+
Problem: Unexpected definition of view "codeintel_configuration_policies"
34+
Solution: redefine the view
35+
Diff:
36+
(
37+
"""
38+
- SELECT id,
39+
- repository_id,
40+
- name,
41+
- type,
42+
- pattern,
43+
- retention_enabled,
44+
- retention_duration_hours,
45+
- retain_intermediate_commits,
46+
- indexing_enabled,
47+
- index_commit_max_age_hours,
48+
- index_intermediate_commits,
49+
- protected,
50+
- repository_patterns,
51+
- last_resolved_at,
52+
- embeddings_enabled
53+
+ SELECT lsif_configuration_policies.id,
54+
+ lsif_configuration_policies.repository_id,
55+
+ lsif_configuration_policies.name,
56+
+ lsif_configuration_policies.type,
57+
+ lsif_configuration_policies.pattern,
58+
+ lsif_configuration_policies.retention_enabled,
59+
+ lsif_configuration_policies.retention_duration_hours,
60+
+ lsif_configuration_policies.retain_intermediate_commits,
61+
+ lsif_configuration_policies.indexing_enabled,
62+
+ lsif_configuration_policies.index_commit_max_age_hours,
63+
+ lsif_configuration_policies.index_intermediate_commits,
64+
+ lsif_configuration_policies.protected,
65+
+ lsif_configuration_policies.repository_patterns,
66+
+ lsif_configuration_policies.last_resolved_at,
67+
+ lsif_configuration_policies.embeddings_enabled
68+
FROM lsif_configuration_policies;
69+
"""
70+
)
71+
72+
codeintel_configuration_policies_repository_pattern_lookup:
73+
Problem: Unexpected definition of view "codeintel_configuration_policies_repository_pattern_lookup"
74+
Solution: redefine the view
75+
Diff:
76+
(
77+
"""
78+
- SELECT policy_id,
79+
- repo_id
80+
+ SELECT lsif_configuration_policies_repository_pattern_lookup.policy_id,
81+
+ lsif_configuration_policies_repository_pattern_lookup.repo_id
82+
FROM lsif_configuration_policies_repository_pattern_lookup;
83+
"""
84+
)
85+
86+
lsif_dumps:
87+
Problem: Unexpected definition of view "lsif_dumps"
88+
Solution: redefine the view
89+
Diff:
90+
strings.Join({
91+
" SELECT ",
92+
+ "u.",
93+
"id,\n ",
94+
+ "u.",
95+
"commit,\n ",
96+
- "root,\n queued_at,\n uploaded_at,\n state,\n ",
97+
+ "u.root,\n u.queued_at,\n u.uploaded_at,\n u.state,\n u.",
98+
"failure_message,\n ",
99+
+ "u.",
100+
"started_at,\n ",
101+
+ "u.",
102+
"finished_at,\n ",
103+
+ "u.",
104+
"repository_id,\n ",
105+
+ "u.",
106+
"indexer,\n ",
107+
+ "u.",
108+
"indexer_version,\n ",
109+
+ "u.",
110+
"num_parts,\n ",
111+
+ "u.",
112+
"uploaded_parts,\n ",
113+
+ "u.",
114+
"process_after,\n ",
115+
+ "u.",
116+
"num_resets,\n ",
117+
+ "u.",
118+
"upload_size,\n ",
119+
+ "u.",
120+
"num_failures,\n ",
121+
+ "u.",
122+
"associated_index_id,\n ",
123+
+ "u.",
124+
"expired,\n ",
125+
+ "u.",
126+
"last_retention_scan_at,\n ",
127+
+ "u.",
128+
"finished_at AS processed_at\n FROM lsif_uploads u\n WHERE ((",
129+
+ "u.",
130+
"state = 'completed'::text) OR (",
131+
+ "u.",
132+
"state = 'deleting'::text));",
133+
}, "")
134+
135+
outbound_webhooks_with_event_types:
136+
Problem: Unexpected definition of view "outbound_webhooks_with_event_types"
137+
Solution: redefine the view
138+
Diff:
139+
(
140+
"""
141+
- SELECT id,
142+
- created_by,
143+
- created_at,
144+
- updated_by,
145+
- updated_at,
146+
- encryption_key_id,
147+
- url,
148+
- secret,
149+
+ SELECT outbound_webhooks.id,
150+
+ outbound_webhooks.created_by,
151+
+ outbound_webhooks.created_at,
152+
+ outbound_webhooks.updated_by,
153+
+ outbound_webhooks.updated_at,
154+
+ outbound_webhooks.encryption_key_id,
155+
+ outbound_webhooks.url,
156+
+ outbound_webhooks.secret,
157+
array_to_json(ARRAY( SELECT json_build_object('id', outbound_webhook_event_types.id, 'outbound_webhook_id', outbound_webhook_event_types.outbound_webhook_id, 'event_type', outbound_webhook_event_types.event_type, 'scope', outbound_webhook_event_types.scope) AS json_build_object
158+
FROM outbound_webhook_event_types
159+
... // 2 identical lines
160+
"""
161+
)
162+
163+
site_config:
164+
Problem: Unexpected definition of view "site_config"
165+
Solution: redefine the view
166+
Diff:
167+
(
168+
"""
169+
- SELECT site_id,
170+
- initialized
171+
+ SELECT global_state.site_id,
172+
+ global_state.initialized
173+
FROM global_state;
174+
"""
175+
)
176+
```
177+
178+
## Solutions for Handling Schema Drift
179+
180+
If you're confident that your instance is seeing database drift associated with the PG12 to PG16 upgrade, you can run a nultiversion upgrade via migrator `upgrade` or run `autoupgrade` using the following options.
181+
182+
To run `autoupgrade` via the frontend, set the `SRC_AUTOUPGRADE_IGNORE_DRIFT=true` environment variable in the frontend container.
183+
184+
To run migrators `upgrade` command add the `--skip-drift-check` flag to migrator's entrycommand as below:
185+
```yaml
186+
command: ['upgrade', '-from', '5.5.0', '-to', '5.10.0', '--skip-drift-check=true']             
187+
```
188+
189+
If you have any concerns about the drift, please reach out to us at [email protected]

docs/admin/postgres.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ Sourcegraph uses several PostgreSQL databases to support various functionality.
1010

1111
### Version requirements
1212

13-
We support Postgres 16 and above. Older versions of Sourcegraph supported 12 see our [Postgres 12 deprecation notice](/admin/postgres12_end_of_life_notice) for more details.
13+
We support Postgres 16 and above. Older versions of Sourcegraph supported 12 see our [Postgres 12 deprecation notice](/admin/postgres12_end_of_life_notice) for more details. Starting in Sourcegraph 6.0.0, sourcegraph services will no longer connect to a PostgreSQL 12 or lower database. Instead displaying an error message in container logs for services attempting to connect to a PostgreSQL database below version 16.
14+
```
15+
migrator | ✱ Sourcegraph migrator 6.0.0
16+
migrator | ⚠️ Failed to check for migrator update: unexpected status code 404. Continuing...
17+
migrator | Attempting connection to frontend...
18+
migrator | {"SeverityText":"FATAL","Timestamp":1738107940979396426,"InstrumentationScope":"migrator","Caller":"migrator/main.go:24","Function":"main.main","Body":"new db handle: Sourcegraph requires PostgreSQL 16+. For more information about PostgreSQL requirements and upgrade guides, visit https://sourcegraph.com/docs/admin/postgres","Resource":{"service.name":"migrator","service.version":"6.0.0","service.instance.id":"23097a97-50f4-4b42-80b5-83802baffeb4"},"Attributes":{}}
19+
migrator exited with code 1
20+
```
1421

1522
Sourcegraph services attempting to connect to a database running Postgres 12 or less will display the following error message:
1623
```
@@ -57,6 +64,12 @@ These images contain an entryscript which will detect and upgrade Postgres insta
5764
5865
**For instance specfic instructions on how to upgrade a builtin Postgres database via the image entrypoint script, see [our instance specific operational instructions](/admin/how-to/upgrade-postgres-12-16-builtin-dbs).**
5966

67+
We have the following advisements to admins:
68+
- Container orchestration management systems (e.g. Kubernetes) may restart containers at any time, **it is recommended that you take a backup of your database before starting the upgrade process.**
69+
- Review your deployment types [upgrade notes](/admin/updates#upgrades-index) before upgrading. The PostgreSQL upgrade process mutates the database schema in a way that may Sourcegraph `v5.10.0` and `v5.11.0` may not recognize. [Learn more about pg12 to pg16 schema drift here](/admin/how-to/postgres_12_to_16_drift).
70+
71+
For additional assistance with PostgreSQL upgrades, please contact [email protected].
72+
6073
### Upgrade entrypoint script options
6174

6275
The `PG_UPGRADE_EXTRA_ARGS` environment variable allows you to customize the `pg_upgrade` command in `postgresql-16` and `postgresql-16-codeinsights` deployments.

docs/admin/pricing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ A billable active Code Search or Code Intelligence Platform user is one who is s
4848

4949
A user who has accessed a Sourcegraph product is counted as active once they complete an action that represents usage reflected above.
5050

51-
User counts can be found in the **Site admin** section of the Sourcegraph web application, and Cody-specific usage metrics can be found in the [Cody Analytics service](../cody/clients/enable-cody-enterprise#analytics).
51+
User counts and more usage metrics can be found in [Sourcegraph Analytics](../analytics).

docs/admin/updates/docker_compose.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ For upgrade procedures or general info about sourcegraph versioning see the link
1111
>
1212
> ***If the notes indicate a patch release exists, target the highest one.***
1313
14-
## Unreleased
14+
## v6.0.0
15+
16+
- Sourcegraph 6.0.0 no longer supports PostgreSQL 12, admins must upgrade to PostgreSQL 16. See our [postgres 12 end of life](/admin/postgres12_end_of_life_notice) notice! As well as [supporting documentation](/admin/postgres) and advisements on how to upgrade.
1517

1618
## v5.9.0 ➔ v5.10.1164
1719

docs/admin/updates/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ If your instance has schema drift or unfinished oob migrations you may need to a
119119
- [**Sourcegraph AWS AMI instances**](/admin/deploy/machine-images/aws-ami#upgrade)
120120

121121
## Other helpful links
122-
- [Postgres 12 End Of Life Notice](admin/postgres12_end_of_life_notice#postgres-12-end-of-life)
122+
- [Postgres 12 End Of Life Notice](/admin/postgres12_end_of_life_notice)
123123
- [Migrator operations](/admin/updates/migrator/migrator-operations)
124124
- [Upgrading Early Versions](/admin/updates/migrator/upgrading-early-versions)
125125
- [Troubleshooting upgrades](/admin/updates/migrator/troubleshooting-upgrades)

0 commit comments

Comments
 (0)