Hound is an extremely fast source code search engine. The core is based on this article (and code) from Russ Cox: Regular Expression Matching with a Trigram Index. Hound itself is a static React frontend that talks to a Go backend. The backend keeps an up-to-date index for each repository and and answers searches through a minimal API.
- Clone the repo:
git clone git@github.com:etsy/Hound.git
- Edit config-example.json to add the repos you want:
cd Hound && vim config-example.json
- Rename the (now edited) config file:
mv config-example.json config.json
- Set your GOPATH:
export GOPATH=`pwd`
- Run the server:
go run src/hound/cmds/houndd/main.go
- See Hound in action in your browser at http://localhost:6080/
Have Rake installed? Steps 4 and 5 change to:
- Run rake to create binaries:
rake
- Run the binary:
./bin/houndd
This is the preferred approach, since the binaries are generally easier to work with, and rake will build both the server and the CLI binaries at the same time.
We've used many similar tools in the past, and most of them are either too slow, too hard to configure, or require too much software to be installed. Which brings us to...
- Go 1.3+
- Rake (for building the binaries, not strictly required)
- nodejs (for the command line react-tools)
Yup, that's it. You can proxy requests to the Go service through Apache/nginx/etc., but that's not required.
rake
This will build ./bin/houndd
which is the server binary and ./bin/hound
which is the command line client.
./bin/houndd
This will start up the combined server and indexer. The first time you start the server, it will take a bit of time to initialize your data
directory with the repository data.
You can access the web frontend at http://localhost:6080/
./bin/houndd --prod --addr=address:port
The will start up the combined server/indexer and build all static assets in production mode. The default addr is ":6080", and thus the --addr
flag can be used to have the server listen on a different port.
IRC: #codeascraft on freenode
Created at Etsy by: