Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More detailed setup documents with less assumptions on users #359

Merged
merged 19 commits into from
Oct 22, 2020
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,47 @@ 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 the Go tools](https://golang.org/doc/install) if you don't have it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably make this a bit terser:

  1. Install Go if you don't have it already. Hound requires version 1.4 or later. You might also want to define a GOPATH environment variable) (it defaults to $HOME/go if you don't explicitly have one set). If everything is installed properly, go version will print out the installed version of go.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestion. Updated.


+ After installing Go, make sure go's version is 1.4+ by typing `go version` in the command line.
+ Set up your [`GOPATH`](https://github.com/golang/go/wiki/GOPATH) to a directory where you want to store all your Go packages. Otherwise
all packages will be installed to `$HOME/go` by default.

1. Use the Go tools to install Hound. The binaries `houndd` (server) and `hound` (cli) will be installed in your $GOPATH.

```
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 [simple-config-example.json](config-examples/simple-config-example.json) in your local file directory. For simplicity, we just showed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the quick start guide for the most part should be kept relatively brief. The config-example.json documents the variety of ways to set up a repo in lieu of more explicit documentation. Since we don't really know what sort of repo people want to track, it's probably a good idea to not make a ton of assumptions.

Instead, it might be helpful to use the default-config.json that's included in the root of the repo:

Create a config.json file and use it to list your repositories. Check out our example config.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:

{
  "dbpath" : "db",
  "repos" : {
    "Hound" : { "url" : "https://github.com/etsy/hound.git" }
  }
}

Copy link
Contributor Author

@rfan-debug rfan-debug Oct 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. thank you! I did not notice there was a simplified default-config.json earlier

the simplest configuration for local file search only. (For a more hybrid solution, please refer to [config-example.json](config-examples/config-example.json))

In the simple configuration file, we placed a tensorflow repo at `/home/rfan/tensorflow` path.

3. Run the Hound server with `houndd` and you should see output similar to:
3. Run the Hound server with `houndd -addr=localhost:6880 -conf <your config.json file>` and you should see output similar to:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd also omit the arguments to houndd, although I would mention that it needs to be run from the same directory that the config file is in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. i can remove that.

```
2015/03/13 09:07:42 Searcher started for statsd
2015/03/13 09:07:42 Searcher started for Hound
2015/03/13 09:07:42 All indexes built!
2015/03/13 09:07:42 running server at http://localhost:6080
```

4. Open your browser at `http://localhost:6880`, you should be able to search the tensorflow repo rapidly like the following.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clean things up a bit:

  1. By default, hound hosts a web ui at http://localhost:6080 . Open it in your browser, and start searching.

I don't necessarily think we need another screenshot of the UI here since we include that gif at the top of the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Removed.


![Tensorflow Hound Search Screenshot](imgs/tensorflow_hound_search.png)

### 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.

1. Create a [simple-config-example.json](config-examples/simple-config-example.json) in your local file directory. For simplicity, we just showed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

the simplest configuration for local file search only. (For a more hybrid solution, please refer to [config-example.json](config-examples/config-example.json))

2. Run
```
Expand All @@ -42,7 +58,8 @@ You should be able to navigate to [http://localhost:6080/](http://localhost:6080

## 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. Adding TLS support is pretty straight forward though if anyone wants to add it.
rfan-debug marked this conversation as resolved.
Show resolved Hide resolved

## Why Another Code Search Tool?

Expand All @@ -66,7 +83,7 @@ Hound supports the following version control systems:
* SVN - use `"vcs" : "svn"` in the config
* Bazaar - use `"vcs" : "bzr"` in the config

See [config-example.json](config-example.json) for examples of how to use each VCS.
See [config-example.json](config-examples/config-example.json) for examples of how to use each VCS.

## Private Repositories

Expand All @@ -79,7 +96,7 @@ not work. (This also doesn't work on local folders that are not of a supported r

## Keeping Repos Updated

By default Hound polls the URL in the config for updates every 30 seconds. You can override this value by setting the `ms-between-poll` key on a per repo basis in the config. If you are indexing a large number of repositories, you may also be interested in tweaking the `max-concurrent-indexers` property. You can see how these work in the [example config](config-example.json).
By default Hound polls the URL in the config for updates every 30 seconds. You can override this value by setting the `ms-between-poll` key on a per repo basis in the config. If you are indexing a large number of repositories, you may also be interested in tweaking the `max-concurrent-indexers` property. You can see how these work in the [example config](config-examples/config-example.json).

## Editor Integration

Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions config-examples/simple-config-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"max-concurrent-indexers" : 2,
"dbpath" : "data",
"title" : "Hound",
"health-check-uri" : "/healthz",
"vcs-config" : {
"git": {
"detect-ref" : true
}
},
"repos" : {
"LocalFolder" : {
"url" : "file:////home/rfan/tensorflow"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this above, but I think default-config.json does the job of providing a simple config example. It also uses Hound's own source code on Github, so we know it'll work out of the box for most people. I believe it's used in our Dockerfile, so it might make sense to leave it (as well as the example config) in the root of the repository for now.

Copy link
Contributor Author

@rfan-debug rfan-debug Oct 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this configuration file and use the original example config.

}
}
}
File renamed without changes
Binary file added imgs/tensorflow_hound_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.