Skip to content

Commit 944bf2f

Browse files
authored
Merge pull request #319 from mcarmonaa/improvement/add-env-var-pilosa
Set pilosa endpoint through an environment variable.
2 parents 9652cd7 + 1f0f190 commit 944bf2f

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ make dependencies
9393

9494
## Usage
9595

96+
### Local
9697
```bash
9798
Usage:
9899
gitbase [OPTIONS] <server | version>
@@ -105,12 +106,30 @@ Available commands:
105106
version Show the version information.
106107
```
107108

108-
You can start a server by providing a path which contains multiple git repositories `/path/to/repositories` with this command:
109+
You can start a server providing a path which contains multiple git repositories `/path/to/repositories` with this command:
109110

110111
```
111-
$ gitbase server -v -g /path/to/repositories
112+
$ gitbase server -v -g /path/to/repositories -u gitbase
112113
```
113114

115+
### Docker
116+
117+
You can use the official image from [docker hub](https://hub.docker.com/r/srcd/gitbase/tags/) to quickly run gitbase:
118+
```
119+
docker run --rm --name gitbase -p 3306:3306 -v /my/git/repos:/opt/repos srcd/gitbase:latest
120+
```
121+
122+
If you want to speedup gitbase using indexes, you must run a pilosa container:
123+
```
124+
docker run -it --rm --name pilosa -p 10101:10101 pilosa/pilosa:v0.9.0
125+
```
126+
127+
Then link the gitbase container to the pilosa one:
128+
```
129+
docker run --rm --name gitbase -p 3306:3306 --link pilosa:pilosa -e PILOSA_ENDPOINT="http://pilosa:10101" -v /my/git/repos:/opt/repos srcd/gitbase:latest
130+
```
131+
132+
### Client
114133
A MySQL client is needed to connect to the server. For example:
115134

116135
```bash
@@ -126,15 +145,22 @@ SELECT commit_hash, commit_author_email, commit_author_name FROM commits LIMIT 2
126145
2 rows in set (0.01 sec)
127146
```
128147

148+
If gitbase is running in a container from the official image, you must use `gitbase` as user:
149+
```
150+
mysql -q -u gitbase -h 127.0.0.1
151+
```
152+
129153
### Environment variables
130154

131155
| Name | Description |
132156
|:---------------------------------|:----------------------------------------------------|
133157
| `BBLFSH_ENDPOINT` | bblfshd endpoint, default "127.0.0.1:9432" |
158+
| `PILOSA_ENDPOINT` | pilosa endpoint, default "http://localhost:10101" |
134159
| `GITBASE_BLOBS_MAX_SIZE` | maximum blob size to return in MiB, default 5 MiB |
135160
| `GITBASE_BLOBS_ALLOW_BINARY` | enable retrieval of binary blobs, default `false` |
136161
| `GITBASE_UNSTABLE_SQUASH_ENABLE` | **UNSTABLE** check *Unstable features* |
137162
| `GITBASE_SKIP_GIT_ERRORS` | do not stop queries on git errors, default disabled |
163+
| `GITBASE_INDEX_DIR` | directory where indexes will be persisted |
138164

139165
## Tables
140166

cmd/gitbase/command/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ type Server struct {
3939
Port int `short:"p" long:"port" default:"3306" description:"Port where the server is going to listen"`
4040
User string `short:"u" long:"user" default:"root" description:"User name used for connection"`
4141
Password string `short:"P" long:"password" default:"" description:"Password used for connection"`
42-
PilosaURL string `long:"pilosa" default:"http://localhost:10101" description:"URL to your pilosa server"`
43-
IndexDir string `short:"i" long:"index" default:"/var/lib/gitbase/index" description:"Directory where the gitbase indexes information will be persisted."`
42+
PilosaURL string `long:"pilosa" default:"http://localhost:10101" description:"URL to your pilosa server" env:"PILOSA_ENDPOINT"`
43+
IndexDir string `short:"i" long:"index" default:"/var/lib/gitbase/index" description:"Directory where the gitbase indexes information will be persisted." env:"GITBASE_INDEX_DIR"`
4444

4545
// UnstableSquash quashing tables and pushing down join conditions is still
4646
// a work in progress and unstable. To enable it, the GITBASE_UNSTABLE_SQUASH_ENABLE

0 commit comments

Comments
 (0)