Skip to content

Commit f698968

Browse files
Fix: Get Version string from the releaseRegistry (#676)
- **Hackathon attempt to get latest version into docs** - **POC for Versions being updated from the ReleaseRegistry** - **Remove Versions.tsx, it's no longer required** - **Update all instances of "v5.6.2535" to be {CURRENT_VERSION}** - **remove flake.nix whoops** <!-- Explain the changes introduced in your PR --> Our version strings are always out of date because we don't have any automation to update them. This PR resolves that problem by reaching out to the ReleaseRegistry at build time to get the latest version string. It then replaces that string in any code block using the PreCodeBlock component (which was previously broken and is now fixed). It also adds an exported const `CURRENT_VERSION_STRING` which can be used outside of Code Blocks and is similarly populated at build time. The final stage of this PR is automation that kicks off a build and releases the docs from the release pipeline itself so nobody has to go in and do that manually. ## Pull Request approval Although pull request approval is not enforced for this repository in order to reduce friction, merging without a review will generate a ticket for the docs team to review your changes. So if possible, have your pull request approved before merging. --------- Co-authored-by: Jacob Pleiness <[email protected]>
1 parent 3ff1a50 commit f698968

File tree

25 files changed

+5898
-3810
lines changed

25 files changed

+5898
-3810
lines changed

docs/admin/deploy/docker-compose/aws.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ set -euxo pipefail
6868
###############################################################################
6969
# Please read the notes below the script if you are cloning a private repository
7070
DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL='https://github.com/sourcegraph/deploy-sourcegraph-docker.git'
71-
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION='v5.6.2535'
71+
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION={CURRENT_VERSION}
7272
##################### NO CHANGES REQUIRED BELOW THIS LINE #####################
7373
DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT='/home/ec2-user/deploy-sourcegraph-docker'
7474
DOCKER_COMPOSE_VERSION='1.29.2'

docs/admin/deploy/docker-compose/azure.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ set -euxo pipefail
7777
###############################################################################
7878
# Please read the notes below the script if you are cloning a private repository
7979
DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL='https://github.com/sourcegraph/deploy-sourcegraph-docker.git'
80-
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION='v5.6.2535'
80+
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION={CURRENT_VERSION}
8181
##################### NO CHANGES REQUIRED BELOW THIS LINE #####################
8282
DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT='/root/deploy-sourcegraph-docker'
8383
DOCKER_COMPOSE_VERSION='1.29.2'

docs/admin/deploy/docker-compose/digitalocean.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ set -euxo pipefail
5656
###############################################################################
5757
# Please read the notes below the script if you are cloning a private repository
5858
DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL='https://github.com/sourcegraph/deploy-sourcegraph-docker.git'
59-
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION='v5.6.2535'
59+
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION={CURRENT_VERSION}
6060
##################### NO CHANGES REQUIRED BELOW THIS LINE #####################
6161
DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT='/root/deploy-sourcegraph-docker'
6262
DOCKER_DATA_ROOT='/mnt/docker-data'

docs/admin/deploy/docker-compose/google_cloud.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ set -euxo pipefail
5454
###############################################################################
5555
# Please read the notes below the script if you are cloning a private repository
5656
DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL='https://github.com/sourcegraph/deploy-sourcegraph-docker.git'
57-
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION='v5.6.2535'
57+
DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION={CURRENT_VERSION}
5858
##################### NO CHANGES REQUIRED BELOW THIS LINE #####################
5959
# IMPORTANT: DO NOT MAKE ANY CHANGES FROM THIS POINT ONWARD
6060
DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT='/root/deploy-sourcegraph-docker'

docs/admin/deploy/docker-compose/index.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Sourcegraph with Docker Compose
2-
31
Setting up Docker applications with [multiple containers](https://www.docker.com/resources/what-container) like Sourcegraph using Docker Compose allows us to start all the applications with a single command. It also makes configuring the applications easier through updating the docker-compose.yaml and docker-compose.override.yaml files. Please see the [official Docker Compose docs](https://docs.docker.com/compose/) to learn more about Docker Compose.
42

53
This guide will take you through how to install Sourcegraph with Docker Compose on a server, which could be the local machine, a server on a local network, or cloud-hosted server. You can also follow one of the available *cloud-specific guides* listed below to prepare and install Sourcegraph on a supported cloud environment:
@@ -115,9 +113,10 @@ Continue with the following steps *after* you have created a public or private c
115113
- This branch will be used to [upgrade Sourcegraph](/admin/deploy/docker-compose/upgrade) and install your Sourcegraph instance.
116114
- It also allows us to track all of the customizations made to your Sourcegraph instance.
117115

118-
```bash
116+
117+
```
119118
# Specify the version you want to install
120-
export SOURCEGRAPH_VERSION="v5.6.2535"
119+
export SOURCEGRAPH_VERSION={CURRENT_VERSION}
121120
# Check out the selected version for use, in a new branch called "release"
122121
git checkout $SOURCEGRAPH_VERSION -b release
123122
```

docs/admin/deploy/docker-compose/upgrade.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock'
2+
13
# Upgrade Sourcegraph on Docker Compose
24

35
This document describes the process to update a Docker Compose Sourcegraph instance. If you are unfamiliar with sourcegraph versioning or releases see our [general concepts documentation](/admin/updates/).
@@ -8,7 +10,7 @@ This document describes the process to update a Docker Compose Sourcegraph insta
810

911
A [standard upgrade](/admin/updates/#upgrade-types) occurs between a Sourcegraph version and the minor or major version released immediately after it. If you would like to jump forward several versions, you must perform a [multi-version upgrade](#multi-version-upgrades) instead.
1012

11-
If you've [configured Docker Compose with a release branch](/admin/deploy/docker-compose/#step-1-prepare-the-deployment-repository), please merge the upstream release tag for the next minor version into your `release` branch. In the following example, the release branch is being upgraded to v5.6.2535.
13+
If you've [configured Docker Compose with a release branch](/admin/deploy/docker-compose/#step-1-prepare-the-deployment-repository), please merge the upstream release tag for the next minor version into your `release` branch. In the following example, the release branch is being upgraded to {CURRENT_VERSION_STRING}.
1214

1315
```sh
1416
# first, checkout the release branch
@@ -17,16 +19,16 @@ git checkout release
1719
git fetch upstream
1820
# merge the upstream release tag into your release branch
1921
git checkout release
20-
git merge v5.6.2535
22+
git merge {CURRENT_VERSION}
2123
```
2224

2325
#### Address any merge conflicts you might have
2426

2527
For each conflict, you need to reconcile any customizations you made with the updates from the new version. Use the information you gathered earlier from the change log and changes list to interpret the merge conflict and to ensure that it doesn't over-write your customizations. You may need to update your customizations to accommodate the new version.
2628

27-
> NOTE: If you have made no changes or only very minimal changes to your configuration, you can also ask git to always select incoming changes in the event of merge conflicts. In the following example merges will be accepted from the upstream version v5.6.2535:
29+
> NOTE: If you have made no changes or only very minimal changes to your configuration, you can also ask git to always select incoming changes in the event of merge conflicts. In the following example merges will be accepted from the upstream version {CURREN_VERSION_STRING()}:
2830
>
29-
> `git merge -X theirs v5.6.2535`
31+
> `git merge -X theirs {CURRENT_VERSION_STRING}`
3032
>
3133
> If you do this, make sure your configuration is correct before proceeding because it may have made changes to your docker-compose YAML file.
3234

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { CURRENT_VERSION_STRING_NO_V, CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock'
2+
13
# Install single-container Sourcegraph with Docker on AWS
24

35
This tutorial shows you how to deploy [single-container Sourcegraph with Docker](/admin/deploy/docker-single-container/) to a single EC2 instance on AWS.
@@ -33,7 +35,7 @@ This tutorial shows you how to deploy [single-container Sourcegraph with Docker]
3335
- usermod -a -G docker ec2-user
3436
3537
# Install and run Sourcegraph. Restart the container upon subsequent reboots
36-
- [ sh, -c, 'docker run -d --publish 80:7080 --publish 443:7080 --publish 127.0.0.1:3370:3370 --restart unless-stopped --volume /home/ec2-user/.sourcegraph/config:/etc/sourcegraph --volume /home/ec2-user/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:5.6.2535' ]
38+
- [ sh, -c, 'docker run -d --publish 80:7080 --publish 443:7080 --publish 127.0.0.1:3370:3370 --restart unless-stopped --volume /home/ec2-user/.sourcegraph/config:/etc/sourcegraph --volume /home/ec2-user/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:{CURRENT_VERSION_NO_V}' ]
3739
```
3840

3941
- Select **Next: ...** until you get to the **Configure Security Group** page. Then add the following rules:

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { CURRENT_VERSION_STRING_NO_V, CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock'
2+
13
# Install single-container Sourcegraph with Docker on DigitalOcean
24

35
This tutorial shows you how to deploy [single-container Sourcegraph with Docker](/admin/deploy/docker-single-container/) to a single node running on DigitalOcean.
@@ -17,7 +19,7 @@ This tutorial shows you how to deploy [single-container Sourcegraph with Docker]
1719
1. Run the Sourcegraph Docker image as a daemon:
1820

1921
```
20-
docker run -d --publish 80:7080 --publish 443:7443 --restart unless-stopped --volume /root/.sourcegraph/config:/etc/sourcegraph --volume /root/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:5.6.2535
22+
docker run -d --publish 80:7080 --publish 443:7443 --restart unless-stopped --volume /root/.sourcegraph/config:/etc/sourcegraph --volume /root/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:{CURRENT_VERSION_NO_V}
2123
```
2224
1. Navigate to the droplet's IP address to finish initializing Sourcegraph. If you have configured a
2325
DNS entry for the IP, configure `externalURL` to reflect that.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { CURRENT_VERSION_STRING_NO_V, CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock'
2+
13
# Install single-container Sourcegraph with Docker on Google Cloud
24

35
This tutorial shows you how to deploy [single-container Sourcegraph with Docker](/admin/deploy/docker-single-container/) to a single node running on Google Cloud.
@@ -23,7 +25,7 @@ This tutorial shows you how to deploy [single-container Sourcegraph with Docker]
2325
sudo apt-get install -y docker-ce
2426
mkdir -p /root/.sourcegraph/config
2527
mkdir -p /root/.sourcegraph/data
26-
docker run -d --publish 80:7080 --publish 443:7443 --restart unless-stopped --volume /root/.sourcegraph/config:/etc/sourcegraph --volume /root/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:5.6.2535
28+
docker run -d --publish 80:7080 --publish 443:7443 --restart unless-stopped --volume /root/.sourcegraph/config:/etc/sourcegraph --volume /root/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:{CURRENT_VERSION_NO_V}
2729
```
2830

2931
- Create your VM, then navigate to its public IP address.

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { CURRENT_VERSION_STRING_NO_V, CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock'
2+
13
# Docker Single Container Deployment
24

35
The Docker Single Container deployment type is a way to very quickly get an instance of Sourcegraph set up locally to experiment with many of its features. However, it is **not recommended** for a production instance, and **has limitations** depending on the OS you are deploying to, as well as the associated resources. See the [troubleshooting section](#troubleshooting) for additional information.
@@ -13,7 +15,7 @@ docker run
1315
--publish 7080:7080 --publish 127.0.0.1:3370:3370 --rm
1416
--volume ~/.sourcegraph/config:/etc/sourcegraph
1517
--volume ~/.sourcegraph/data:/var/opt/sourcegraph
16-
sourcegraph/server:5.6.2535
18+
sourcegraph/server:{CURRENT_VERSION_NO_V}
1719
```
1820

1921
Once the server is ready (logo is displayed in the terminal), navigate to the hostname or IP address on port `7080`. Create the admin account, then you'll be guided through setting up Sourcegraph for code searching and navigation.
@@ -46,7 +48,7 @@ For example, to mount a `.gitconfig`, create a file `/mnt/sourcegraph/config/git
4648
Alternatively you can create a new Docker image which inherits from Sourcegraph and then mutates the environment:
4749

4850
```dockerfile
49-
FROM sourcegraph/server:5.6.2535
51+
FROM sourcegraph/server:{CURRENT_VERSION_NO_V}
5052

5153
COPY gitconfig /etc/gitconfig
5254
COPY ssh /root/.ssh
@@ -87,7 +89,7 @@ This is required to [collect debug data](/admin/pprof).
8789
The docker run command for single-container Sourcegraph needs an additional publish flag to expose the debug port:
8890

8991
```sh
90-
$ docker run --publish 7080:7080 --publish 127.0.0.1:3370:3370 --publish 127.0.0.1:6060:6060 --rm --volume ~/.sourcegraph/config:/etc/sourcegraph --volume ~/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:5.6.2535
92+
$ docker run --publish 7080:7080 --publish 127.0.0.1:3370:3370 --publish 127.0.0.1:6060:6060 --rm --volume ~/.sourcegraph/config:/etc/sourcegraph --volume ~/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:{CURRENT_VERSION_NO_V}
9193
```
9294

9395
If Sourcegraph is deployed to a remote server, then access via an SSH tunnel using a tool
@@ -105,7 +107,7 @@ Add the following to your docker run command:
105107
```sh
106108
$ docker run [...]
107109
-e (YOUR CODE)
108-
sourcegraph/server:5.6.2535
110+
sourcegraph/server:{CURRENT_VERSION_NO_V}
109111
```
110112

111113
## Operation
@@ -254,7 +256,7 @@ Sourcegraph can be **tested** on Windows 10 using roughly the same steps provide
254256
1. [Install Docker for Windows](https://docs.docker.com/docker-for-windows/install/)
255257
2. Using a command prompt, follow the same [installation steps provided above](#install-sourcegraph-with-docker) but remove the `--volume` arguments. For example by pasting this:
256258

257-
<pre class="pre-wrap"><code>docker run<span class="virtual-br"></span> --publish 7080:7080 --publish 127.0.0.1:3370:3370 --rm<span class="virtual-br"></span> sourcegraph/server:5.6.2535</code></pre>
259+
<pre class="pre-wrap"><code>docker run<span class="virtual-br"></span> --publish 7080:7080 --publish 127.0.0.1:3370:3370 --rm<span class="virtual-br"></span> sourcegraph/server:{CURRENT_VERSION_STRING_NO_V()}</code></pre>
258260

259261
### Low resource environments
260262

0 commit comments

Comments
 (0)