Skip to content

Commit

Permalink
Copied diffs from #430 as unable to resolve merge conflicts with fork…
Browse files Browse the repository at this point in the history
…ed codebase due to permissions.
  • Loading branch information
dschott committed May 5, 2023
1 parent 6b38958 commit fd54717
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 816 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.18", "1.17", "1.14"]
go: ["1.18", "1.17"]
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v2
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
go-test:
strategy:
matrix:
go: ["1.18", "1.17", "1.14"]
go: ["1.18", "1.17"]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.vagrant
/.build
.build
/ui/.build
/node_modules
.DS_Store
*.exe
Expand Down
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,24 @@ endif

ALL: $(CMDS)

ui: ui/bindata.go
ui: ui/.build/ui

# the mtime is updated on a directory when its files change so it's better
# to rely on a single file to represent the presence of node_modules.
node_modules/build:
npm install
date -u >> $@

.build/bin/houndd: ui/bindata.go $(SRCS)
.build/bin/houndd: ui/.build/ui $(SRCS)
go build -o $@ github.com/hound-search/hound/cmds/houndd

.build/bin/hound: ui/bindata.go $(SRCS)
go build -o $@ github.com/hound-search/hound/cmds/hound

.build/bin/go-bindata:
go build -o $@ github.com/go-bindata/go-bindata/go-bindata

ui/bindata.go: .build/bin/go-bindata node_modules/build $(wildcard ui/assets/**/*)
rsync -r ui/assets/* .build/ui
ui/.build/ui: node_modules/build $(wildcard ui/assets/**/*)
mkdir -p ui/.build
rsync -r ui/assets/* ui/.build/ui
npx webpack $(WEBPACK_ARGS)
$< -o $@ -pkg ui -prefix .build/ui -nomemcopy .build/ui/...

dev: node_modules/build

Expand All @@ -46,3 +43,4 @@ lint:

clean:
rm -rf .build node_modules
rm -rf ui/.build node_modules
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Hound is an extremely fast source code search engine. The core is based on this
### 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.
0. [Install Go](https://golang.org/doc/install) if you don't have it already. Hound requires version 1.18 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).

Expand All @@ -38,7 +38,7 @@ print out the installed version of go.
You might have to change the path of the last command if you installed Go somewhere else on your system.

2. Create a config.json file in your `$GOPATH/bin` 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
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
Expand All @@ -62,24 +62,24 @@ the config found in [default-config.json](default-config.json):

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

### Using Docker (1.4+)
### Using Docker (1.14+)

0. [Install 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).
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 ghcr.io/hound-search/hound:latest
```

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.
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?
Expand All @@ -88,7 +88,7 @@ We've used many similar tools in the past, and most of them are either too slow,
Which brings us to...

## Requirements
* Go 1.13+
* Go 1.18+

Yup, that's it. You can proxy requests to the Go service through Apache/nginx/etc., but that's not required.

Expand All @@ -97,7 +97,7 @@ Yup, that's it. You can proxy requests to the Go service through Apache/nginx/et

Currently Hound is only tested on MacOS and CentOS, but it should work on any *nix system. Hound on Windows is not supported but we've heard it compiles and runs just fine (although it helps to exclude your data folder from Windows Search Indexer).

Hound supports the following version control systems:
Hound supports the following version control systems:

* Git - This is the default
* Mercurial - use `"vcs" : "hg"` in the config
Expand All @@ -112,12 +112,12 @@ There are a couple of ways to get Hound to index private repositories:

* Use the `file://` protocol. This allows you to index a local clone of a repository. The downside here is that the polling to keep the repo up to date will
not work. (This also doesn't work on local folders that are not of a supported repository type.) If you're using Docker, you must mount a volume to your repository (e.g., `-v $(pwd)/src:/src`) and use the relative path to the repo in your configuration.
* Use SSH style URLs in the config: `"url" : "[email protected]:foo/bar.git"`. As long as you have your
* Use SSH style URLs in the config: `"url" : "[email protected]:foo/bar.git"`. As long as you have your
[SSH keys](https://help.github.com/articles/generating-ssh-keys/) set up on the box where Hound is running this will work.

## 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-example.json).

## Editor Integration

Expand Down Expand Up @@ -160,8 +160,8 @@ 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,
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.
Expand Down
2 changes: 1 addition & 1 deletion cmds/houndd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"strings"
"syscall"

"github.com/blang/semver"
"github.com/blang/semver/v4"
"github.com/hound-search/hound/api"
"github.com/hound-search/hound/config"
"github.com/hound-search/hound/searcher"
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module github.com/hound-search/hound

go 1.13
go 1.17

require github.com/blang/semver v3.5.1+incompatible

require (
github.com/blang/semver v3.5.1+incompatible
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
github.com/blang/semver v1.1.0 h1:ol1rO7QQB5uy7umSNV7VAmLugfLRD+17sYJujRNYPhg=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/go-bindata/go-bindata v1.0.0 h1:DZ34txDXWn1DyWa+vQf7V9ANc2ILTtrEjtlsdJRF26M=
github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE=
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
Loading

0 comments on commit fd54717

Please sign in to comment.