Skip to content

Commit 36e318b

Browse files
committed
Let the user to choose between runing the latest or build from sources
Signed-off-by: David Pordomingo <[email protected]>
1 parent 7a68843 commit 36e318b

File tree

4 files changed

+59
-8
lines changed

4 files changed

+59
-8
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ YARN := yarn --cwd $(FRONTEND_PATH)
2121
REMOVE := rm -rf
2222
MOVE := mv
2323
MKDIR := mkdir -p
24+
COMPOSE_UP := docker-compose
2425

2526
# Default rule
2627
all:
@@ -68,6 +69,16 @@ build-path:
6869

6970
serve: | front-build back-start
7071

72+
compose-serve: | require-repos-folder front-dependencies build
73+
GITBASEPG_REPOS_FOLDER=${GITBASEPG_REPOS_FOLDER} \
74+
$(COMPOSE_UP) -f docker-compose.yml -f docker-compose.build.yml up --force-recreate --build
75+
76+
require-repos-folder:
77+
@if [[ -z "$(GITBASEPG_REPOS_FOLDER)" ]]; then \
78+
echo "error. undefined 'GITBASEPG_REPOS_FOLDER' to be served under gitbase"; \
79+
exit 1; \
80+
fi
81+
$(MKDIR) $(GITBASEPG_REPOS_FOLDER)
7182

7283
# Backend
7384

docker-compose.build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: '3.3'
2+
3+
services:
4+
playground:
5+
image: gitbase-playground-dev
6+
build: .

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
environment:
1414
BBLFSH_ENDPOINT: bblfsh:9432
1515
volumes:
16-
- ${REPOS_FOLDER}:/opt/repos
16+
- ${GITBASEPG_REPOS_FOLDER}:/opt/repos
1717
bblfsh:
1818
image: "bblfsh/bblfshd"
1919
privileged: true

docs/quickstart.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,65 @@
11
# Quickstart
22

3-
You can locally build and deploy `gitbase-playground` and its dependencies using [`docker-compose`](https://docs.docker.com/compose/install/)
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/).
45

56
If you preffer to run `gitbase-playground` dependencies manually, you can follow [the alternative playground quickstart](quickstart-manually.md)
67

8+
9+
## Download the project
10+
11+
```bash
12+
$ git clone [email protected]:src-d/gitbase-playground.git gitbase-playground
13+
$ cd gitbase-playground
14+
```
15+
16+
This guide will assume you're running all commands from `gitbase-playground` sources directory
17+
18+
719
## Populate the database
820

9-
Populate a directory with some git repositories to be served by [gitbase](https://github.com/src-d/gitbase):
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:
1024

1125
```bash
1226
$ git clone [email protected]:src-d/gitbase-playground.git ./repos/gitbase-playground
1327
$ git clone [email protected]:src-d/go-git-fixtures.git ./repos/go-git-fixtures
1428
```
1529

30+
Everytime you want to add a new repository to gitbase, the application should be restarted.
31+
32+
1633
## Run the application
1734

18-
Once bblfsh and gitbase are running and accessible, you can serve the playground:
35+
Run the [latest released version of the frontend](https://hub.docker.com/r/srcd/gitbase-playground/tags/):
1936

2037
```bash
21-
$ GITBASEPG_ENV=dev REPOS_FOLDER=./repos GITBASEPG_ENV=dev docker-compose up
38+
$ GITBASEPG_REPOS_FOLDER=./repos docker-compose up --force-recreate
2239
```
2340

24-
Once the server is running &ndash;with its default values&ndash;, 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:
42+
43+
<details>
44+
<pre>
45+
$ GITBASEPG_REPOS_FOLDER=./repos make compose-serve
46+
</pre>
47+
</details>
48+
49+
## Stop the Application
50+
51+
To kill the running containers just `Ctrl+C`
52+
53+
To delete the containers run `docker-compose rm -f`
2554

26-
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).
2755

56+
## Access to the Playground and Run a Query
2857

29-
## Run a Query
58+
Once the server is running &ndash;with its default values&ndash;, it will be accessible through: http://localhost:8080
3059

3160
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

Comments
 (0)