Categorygithub.com/src-d/gitbase-web
module
0.6.5
Repository: https://github.com/src-d/gitbase-web.git
Documentation: pkg.go.dev

# README

Build Status codecov.io

Gitbase Web

Application to query Git repositories using SQL. Powered by gitbase, it allows to perform SQL queries on the Git history and the Universal AST of the code itself.

Screenshot

Usage

With Docker Compose

The easiest way to run Gitbase Web and its dependencies is using Docker Compose.

The first step is to populate a directory with some Git repositories to be served by gitbase before running it. For example:

$ mkdir $HOME/repos
$ cd $HOME/repos
$ git clone [email protected]:src-d/gitbase.git
$ git clone [email protected]:bblfsh/bblfshd.git
$ git clone [email protected]:src-d/gitbase-web.git

Next you will need to download the docker-compose.yml file from this repository and run docker-compose up. This tool will run three different containers: the gitbase-web frontend itself, gitbase, and bblfshd. To kill the running containers use Ctrl+C.

$ wget https://raw.githubusercontent.com/src-d/gitbase-web/master/docker-compose.yml
$ docker-compose pull
$ GITBASEPG_REPOS_FOLDER=$HOME/repos docker-compose up --force-recreate

The server should be now available at http://localhost:8080.

In case there are any containers left, you can use

docker-compose down

for cleanup.

Without Docker Compose

The application will run the queries against a gitbase server, and will request UASTs to a bblfsh server. Make sure both are properly configured.

Then you can choose to run the web client either as a docker container, or as a binary.

As a Docker

$ docker pull srcd/gitbase-web:latest
$ docker run -d \
    --publish 8080:8080 \
    --env GITBASEPG_DB_CONNECTION="root@tcp(<gitbase-ip>:3306)/none" \
    --env GITBASEPG_BBLFSH_SERVER_URL="<bblfshd-ip>:9432" \
    srcd/gitbase-web:latest

As a Binary

Download the binary from our releases section, and run it:

$ export GITBASEPG_DB_CONNECTION="root@tcp(<gitbase-ip>:3306)/none"
$ export GITBASEPG_BBLFSH_SERVER_URL="<bblfshd-ip>:9432"
$ ./gitbase-web serve

Configuration

Any of the previous execution methods accept configuration through the following environment variables or CLI arguments.

VariableArgumentDefault valueMeaning
GITBASEPG_HOST--host0.0.0.0IP address to bind the HTTP server
GITBASEPG_PORT--port8080Port to bind the HTTP server
GITBASEPG_SERVER_URL--serverURL used to access the application in the form HOSTNAME[:PORT]. Leave it unset to allow connections from any proxy or public address
GITBASEPG_DB_CONNECTION--dbroot@tcp(localhost:3306)/none?maxAllowedPacket=4194304gitbase connection string. Use the DSN (Data Source Name) format described in the Go MySQL Driver docs.
GITBASEPG_CONN_MAX_LIFETIME--conn-max-lifetime30Maximum amount of time a SQL connection may be reused, in seconds. Make sure this value is lower than the timeout configured in the gitbase server, set with GITBASE_CONNECTION_TIMEOUT
GITBASEPG_BBLFSH_SERVER_URL--bblfsh127.0.0.1:9432Address where bblfsh server is listening
GITBASEPG_SELECT_LIMIT--select-limit100Default LIMIT forced on all the SQL queries done from the UI. Set it to 0 to remove any limit
GITBASEPG_FOOTER_HTML--footerAllows to add any custom html to the page footer. It must be a string encoded in base64. Use it, for example, to add your analytics tracking code snippet
LOG_LEVEL--log-level=infoLogging level (info, debug, warning or error)
LOG_FORMAT--log-format=log format (text or json), defaults to text on a terminal and json otherwise
LOG_FIELDS--log-fields=default fields for the logger, specified in json
LOG_FORCE_FORMAT--log-force-formatignore if it is running on a terminal or not

Contribute

Contributions are more than welcome, if you are interested please take a look to our Contributing Guidelines. There you will also find information on how to build and run the project from sources.

Code of Conduct

All activities under source{d} projects are governed by the source{d} code of conduct.

License

GPL v3.0, see LICENSE

# Packages

No description provided by the author
No description provided by the author