Skip to content

Instantly share code, notes, and snippets.

@slimsag
Last active December 6, 2022 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slimsag/514d04035d5d871cae8f65a2e77e163e to your computer and use it in GitHub Desktop.
Save slimsag/514d04035d5d871cae8f65a2e77e163e to your computer and use it in GitHub Desktop.
k3d start Sourcegraph+helm cluster

If existing already, delete the default k3d cluster:

k3d cluster delete

Start a k3d cluster and port forward the loadbalancer:

k3d cluster create -p "30080:80@loadbalancer"

In the deploy-sourcegraph-helm repo:

Create your override.yaml:

storageClass:
  create: true
  name: local-path

# Disable resources requests/limits
sourcegraph:
  localDevMode: true

Deploy via Helm:

helm upgrade --install --create-namespace -n sourcegraph -f ./override.yaml sourcegraph charts/sourcegraph/.

Port-forward traffic:

kubectl port-forward -n sourcegraph svc/sourcegraph-frontend 30080:30080

Navigate to http://localhost:30080

@slimsag
Copy link
Author

slimsag commented Dec 6, 2022

Codeintel-qa testing:

  1. On the instance, create a GitHub code host connection.
  2. Paste the configuration from cat ../dev-private/enterprise/dev/external-services-config.json
  3. Create an access token

In the Sourcegraph repo modify dev/codeintel-qa/internal/env.go (the env var doesn't work):

diff --git a/dev/codeintel-qa/internal/env.go b/dev/codeintel-qa/internal/env.go
index 143d0573d3..dbad4b8a9e 100644
--- a/dev/codeintel-qa/internal/env.go
+++ b/dev/codeintel-qa/internal/env.go
@@ -3,6 +3,6 @@ package internal
 import "github.com/sourcegraph/sourcegraph/internal/env"
 
 var (
-       SourcegraphEndpoint    = env.Get("SOURCEGRAPH_BASE_URL", "http://127.0.0.1:3080", "Sourcegraph frontend endpoint")
+       SourcegraphEndpoint    = env.Get("SOURCEGRAPH_BASE_URL", "http://127.0.0.1:30080", "Sourcegraph frontend endpoint")
        SourcegraphAccessToken = env.Get("SOURCEGRAPH_SUDO_TOKEN", "", "Sourcegraph access token with sudo privileges")
 )

Navigate into the sourcegraph repo and export tokens:

cd sourcegraph/dev/codeintel-qa
export SOURCEGRAPH_SUDO_TOKEN=MY_SECRET_TOKEN
export SOURCEGRAPH_BASE_URL=http://localhost:30080

Run the tests:

go run ./cmd/upload
go run ./cmd/query

NOTE: I did not run cmd/query as it took too long, instead opting to navigate to the UI and confirm precise nav worked manually on a few files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment