|
1 | 1 | # Quickstart
|
2 | 2 |
|
3 |
| -## Run bblfsh and gitbase Dependencies |
| 3 | +You can locally build and deploy `gitbase-playground` and its dependencies using [`docker-compose`](https://docs.docker.com/compose/install/). |
| 4 | +Docker compose will run three different containers: for the playground frontend itself, gitbase and bblfsh services. It will be the [latest gitbase version](https://hub.docker.com/r/srcd/gitbase/tags/) and [latest bblfsh version](https://hub.docker.com/r/bblfsh/bblfshd/tags/). |
4 | 5 |
|
5 |
| -It is recommended to read about `bblfsh` and `gitbase` from its own documentation, but here is a small guide about how to run both easily: |
| 6 | +If you preffer to run `gitbase-playground` dependencies manually, you can follow [the alternative playground quickstart](quickstart-manually.md) |
6 | 7 |
|
7 |
| -Launch [bblfshd](https://github.com/bblfsh/bblfshd) and install the drivers. More info in the [bblfshd documentation](https://doc.bblf.sh/user/getting-started.html): |
| 8 | + |
| 9 | +## Download the project |
8 | 10 |
|
9 | 11 | ```bash
|
10 |
| -$ docker run --privileged |
11 |
| - --publish 9432:9432 |
12 |
| - --volume /var/lib/bblfshd:/var/lib/bblfshd |
13 |
| - --name bblfsh |
14 |
| - bblfsh/bblfshd |
15 |
| -$ docker exec -it bblfsh |
16 |
| - bblfshctl driver install --recommended |
| 12 | +$ git clone [email protected]:src-d/gitbase-playground.git gitbase-playground |
| 13 | +$ cd gitbase-playground |
17 | 14 | ```
|
18 | 15 |
|
19 |
| -[gitbase](https://github.com/src-d/gitbase) will serve git repositories, so it is needed to populate a directory with them: |
| 16 | +This guide will assume you're running all commands from `gitbase-playground` sources directory |
20 | 17 |
|
21 |
| -```bash |
22 |
| -$ mkdir -p ~/gitbase/repos |
23 |
| -$ git clone [email protected]:src-d/go-git-fixtures.git ~/gitbase/repos/go-git-fixtures |
24 |
| -``` |
25 | 18 |
|
26 |
| -Install and run [gitbase](https://github.com/src-d/gitbase): |
| 19 | +## Populate the database |
| 20 | + |
| 21 | +It is needed to populate a directory with some git repositories to be served by [gitbase](https://github.com/src-d/gitbase) before running it. |
| 22 | + |
| 23 | +example: |
27 | 24 |
|
28 | 25 | ```bash
|
29 |
| -# This quickstart is using a custom gitbase image until the official `srcd/gitbase` image is provided |
30 |
| -# See: https://github.com/src-d/gitbase/issues/262 |
31 |
| -$ docker run |
32 |
| - --publish 3306:3306 |
33 |
| - --link bblfsh |
34 |
| - --volume ~/gitbase/repos:/opt/repos |
35 |
| - --env BBLFSH_ENDPOINT=bblfsh:9432 |
36 |
| - --name gitbase |
37 |
| - srcd/gitbase:latest |
| 26 | +$ git clone [email protected]:src-d/gitbase-playground.git ./repos/gitbase-playground |
| 27 | +$ git clone [email protected]:src-d/go-git-fixtures.git ./repos/go-git-fixtures |
38 | 28 | ```
|
39 | 29 |
|
| 30 | +Everytime you want to add a new repository to gitbase, the application should be restarted. |
40 | 31 |
|
41 |
| -## Run gitbase-playground |
42 | 32 |
|
43 |
| -Once bblfsh and gitbase are running and accessible, you can serve the playground: |
| 33 | +## Run the application |
| 34 | + |
| 35 | +Run the [latest released version of the frontend](https://hub.docker.com/r/srcd/gitbase-playground/tags/): |
44 | 36 |
|
45 | 37 | ```bash
|
46 |
| -$ docker run -d |
47 |
| - --publish 8080:8080 |
48 |
| - --link gitbase |
49 |
| - --env GITBASEPG_ENV=dev |
50 |
| - --env GITBASEPG_DB_CONNECTION="gitbase@tcp(gitbase:3306)/none?maxAllowedPacket=4194304" |
51 |
| - --name gitbase_playground |
52 |
| - srcd/gitbase-playground:latest |
| 38 | +$ GITBASEPG_REPOS_FOLDER=./repos docker-compose up --force-recreate |
53 | 39 | ```
|
54 | 40 |
|
55 |
| -Once the server is running –with its default values–, it will be accessible through: http://localhost:8080 |
| 41 | +If you want to build and run the playground from sources instead of using the last released version you can do so: |
56 | 42 |
|
57 |
| -You have more information about the [playground architecture](CONTRIBUTING.md#architecture), [development guides](CONTRIBUTING.md#development) and [configuration options](CONTRIBUTING.md#configuration) in the [CONTRIBUTING.md](CONTRIBUTING.md). |
| 43 | +<details> |
| 44 | +<pre> |
| 45 | +$ GITBASEPG_REPOS_FOLDER=./repos make compose-serve |
| 46 | +</pre> |
| 47 | +</details> |
| 48 | + |
| 49 | +## Stop the Application |
58 | 50 |
|
| 51 | +To kill the running containers just `Ctrl+C` |
59 | 52 |
|
60 |
| -## Run a Query |
| 53 | +To delete the containers run `docker-compose rm -f` |
| 54 | + |
| 55 | + |
| 56 | +## Access to the Playground and Run a Query |
| 57 | + |
| 58 | +Once the server is running –with its default values–, it will be accessible through: http://localhost:8080 |
61 | 59 |
|
62 | 60 | You will find more info about how to run queries using the playground API on the [rest-api guide](rest-api.md)
|
| 61 | + |
| 62 | + |
| 63 | +## More Info |
| 64 | + |
| 65 | +You have more information about the [playground architecture](CONTRIBUTING.md#architecture), [development guides](CONTRIBUTING.md#development) and [configuration options](CONTRIBUTING.md#configuration) in the [CONTRIBUTING.md](CONTRIBUTING.md). |
0 commit comments