Sourcegraph

Sourcegraph #

Sourcegraph is a useful code searching tool that supports powerful cross-reference.

Pitfalls #

  • Sourcegraph’s index of git branch of large repository like rocksdb is not functional, the workaround is to squash a large repository into a commit and push to master branch

Setup #

docker run -e SRC_REPOS_DESIRED_PERCENT_FREE=0 -d \
	--tmpfs /tmp:rw,nodev,noexec,nosuid,size=65536k \
    --publish 7080:7080 --publish 127.0.0.1:3370:3370 \
    --volume ~/.sourcegraph/config:/etc/sourcegraph \
    --name sourcegraph-3.14 \
    --volume ~/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:3.14.3
# https://github.com/sourcegraph/sourcegraph/issues/9546

Enable repositories from Github and Bitbucket:

# Github
{
  "url": "https://github.com",
  "token": "<token>",
  "orgs": [],
  "repos": [
    "google/leveldb"
  ]
}

# Bitbucket
# index the repos in team "sourcegraph-yunchih" only
# in this team, all repositories are squashed, as mentioned in pitfalls above ...
{
  "url": "https://bitbucket.org",
  "appPassword": "<pass>",
  "username": "<username>",
  "exclude": [{"pattern":"^<username>/.*"}]
  "teams": [
    "sourcegraph-yunchih" 
  ]
}
Calendar Last modified: June 2, 2020