Skip to content

Instantly share code, notes, and snippets.

@slimsag
Created December 6, 2022 01:31
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/51dd826ce48478202433e74b5e4ee5eb to your computer and use it in GitHub Desktop.
Save slimsag/51dd826ce48478202433e74b5e4ee5eb to your computer and use it in GitHub Desktop.
k3d start sourcegraph 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 repo:

./overlay-generate-cluster.sh low-resource generated-cluster
kubectl apply --prune -l deploy=sourcegraph -f generated-cluster --recursive

low-resources is too low by default and frontend will OOM, so edit the frontend deployment and raise limits::

kubectl edit deployment/sourcegraph-frontend

Create an ingress so traffic can reach:

cat <<EOT >> ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sourcegraph-frontend
  annotations:
    ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: sourcegraph-frontend
            port:
              number: 30080
EOT
kubectl apply -f ingress.yaml

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

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