diff --git a/.gitignore b/.gitignore index da009bc4..1d2a79ec 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ *.exe /db /data +/.idea diff --git a/README.md b/README.md index 72977369..cfc30c67 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,38 @@ Hound is an extremely fast source code search engine. The core is based on this [Regular Expression Matching with a Trigram Index](http://swtch.com/~rsc/regexp/regexp4.html). Hound itself is a static [React](http://facebook.github.io/react/) frontend that talks to a [Go](http://golang.org/) backend. The backend keeps an up-to-date index for each repository and answers searches through a minimal API. Here it is in action: -![Hound Screen Capture](screen_capture.gif) +![Hound Screen Capture](imgs/screen_capture.gif) ## Quick Start Guide ### Using Go Tools + +0. [Install Go](https://golang.org/doc/install) if you don't have it already. Hound requires version 1.4 or later. +You might also want to define a [`GOPATH`](https://github.com/golang/go/wiki/GOPATH) environment variable) +(it defaults to $HOME/go if you don't explicitly have one set). If everything is installed properly, `go version` should +print out the installed version of go. + 1. Use the Go tools to install Hound. The binaries `houndd` (server) and `hound` (cli) will be installed in your $GOPATH/bin directory. Your $GOPATH should be in your $PATH (`echo $PATH` to check). + ``` go get github.com/hound-search/hound/cmds/... ``` -2. Create a [config.json](config-example.json) in a directory with your list of repositories. +2. Create a config.json file and use it to list your repositories. Check out our [example-config.json](config-example.json) +to see how to set up various types of repositories. For example, we can configure Hound to search its own source code using +the config found in [default-config.json](default-config.json): +```json +{ + "dbpath" : "db", + "repos" : { + "Hound" : { "url" : "https://github.com/etsy/hound.git" } + } +} +``` -3. Run the Hound server with `$GOPATH/bin/houndd`. You should see output similar to: +3. Run the Hound server with `houndd` in the same directory as your `config.json`. You should see output similar to: ``` 2015/03/13 09:07:42 Searcher started for statsd 2015/03/13 09:07:42 Searcher started for Hound @@ -28,21 +45,27 @@ go get github.com/hound-search/hound/cmds/... 2015/03/13 09:07:42 running server at http://localhost:6080 ``` +4. By default, hound hosts a web ui at http://localhost:6080 . Open it in your browser, and start searching. + ### Using Docker (1.4+) -1. Create a [config.json](config-example.json) in a directory with your list of repositories. +0. [Install the docker](https://docs.docker.com/get-docker/) if you don't have it. We need at least `Docker >= 1.14`. + +1. Create a config.json file and use it to list your repositories. Check out our [example-config.json](config-example.json) +to see how to set up various types of repositories. For example, we can configure Hound to search its own source code using +the config found in [default-config.json](default-config.json). 2. Run ``` docker run -d -p 6080:6080 --name hound -v $(pwd):/data etsy/hound ``` -You should be able to navigate to [http://localhost:6080/](http://localhost:6080/) as usual. - +You should be able to navigate to [http://localhost:6080/](http://localhost:6080/) as usual. ## Running in Production -There are no special flags to run Hound in production. You can use the `--addr=:6880` flag to control the port to which the server binds. Currently, Hound does not support TLS as most users simply run Hound behind either Apache or nginx. Adding TLS support is pretty straight forward though if anyone wants to add it. +There are no special flags to run Hound in production. You can use the `--addr=:6880` flag to control the port to which the server binds. +Currently, Hound does not support TLS as most users simply run Hound behind either Apache or nginx. However, we are open to contributions to add TLS support. ## Why Another Code Search Tool? @@ -128,7 +151,11 @@ If you want to just run the JavaScript test suite, use: npm test ``` -Any Go files that end in `_test.go` are assumed to be test files. Similarly, any JavaScript files that ends in `.test.js` are automatically run by Jest, our test runner. Tests should live next to the files that they cover. [Check out Jest's docs](https://jestjs.io/docs/en/getting-started) for more details on writing Jest tests, and [check out Go's testing docs](https://golang.org/pkg/testing/) for more details on testing Go code. +Any Go files that end in `_test.go` are assumed to be test files. Similarly, any JavaScript files that ends in `.test.js` are automatically run by Jest, our test runner. Tests should live next to the files that they cover. +[Check out Jest's docs](https://jestjs.io/docs/en/getting-started) for more details on writing Jest tests, +and [check out Go's testing docs](https://golang.org/pkg/testing/) for more details on testing Go code. + +You need to install `Node.js >= 12` and install `jest` by `npm install jest` to run the JS tests. ### Working on the web UI diff --git a/screen_capture.gif b/imgs/screen_capture.gif similarity index 100% rename from screen_capture.gif rename to imgs/screen_capture.gif