Skip to content

Commit

Permalink
Merge pull request #200 from mcarmonaa/improvement/improve-readme
Browse files Browse the repository at this point in the history
README: improve documentation
  • Loading branch information
mcarmonaa authored Aug 23, 2018
2 parents d9a0e11 + 97b5ee3 commit 9f7df2c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 25 deletions.
86 changes: 62 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@ hosting providers.

Type `help` fore commands info.

## Quick start using docker images
# Quick start using docker images

### Generate needed API keys for the providers

To be able to fetch github and cgit repositories, you should create several API keys:

- Get Github token: https://github.com/settings/tokens
- Get Bing token (Bing is the search engine used to fetch cgit repositories from internet): https://azure.microsoft.com/en-us/pricing/details/cognitive-services/search-api/web/

### Download docker images
## Download docker images

Get the last version of rovers spark image:

```bash
docker pull quay.io/srcd/rovers
docker pull srcd/rovers
```

Also, you will need Postgres and RabbitMQ
Expand All @@ -29,7 +22,7 @@ docker pull postgres:9.6-alpine
docker pull rabbitmq:3-management
```

### Start everything
## Start everything

Start Rabbit and Postgres

Expand All @@ -45,23 +38,35 @@ Then, you can execute rovers using docker:
docker run --name rovers --link rabbitmq --link postgres \
-e CONFIG_GITHUB_TOKEN=[REPLACEWITHGHKEY] \
-e CONFIG_BING_KEY=[REPLACEWITHBINGKEY] \
quay.io/srcd/rovers /bin/sh -c "rovers initdb; rovers repos --queue=rovers"
srcd/rovers /bin/sh -c "rovers initdb; rovers repos --queue=rovers"
```
After that, rovers will generate a lot of 'mentions' (git repositories found on the internet), and sending them to the 'rovers' queue in Rabbit.

Finally, you can use [Borges](https://github.com/src-d/borges) to fetch the content of these repositories.

## Supported Providers
# Supported Providers

All the supported providers are used by default. In case you need run only some of them you must use the `--provider` flag:
```bash
rovers repos --provider=github --provider=bitbucket
```

### GitHub
## Generate needed API keys for the providers

To be able to fetch github and cgit repositories, you should create several API keys:

- Get Github token: https://github.com/settings/tokens
- Get Bing token (Bing is the search engine used to fetch cgit repositories from internet): https://azure.microsoft.com/en-us/pricing/details/cognitive-services/search-api/web/

## GitHub

Uses the GitHub API to get new repositories. Requires a GitHub API token. You can set the token through the environment variable:

```bash
$ export CONFIG_GITHUB_TOKEN=github-token
```

### Bitbucket
## Bitbucket

Uses the Bitbucket API to get new repositories as an anonymous user.

Expand All @@ -77,27 +82,60 @@ new repositories. Requires a Bing API key. You can set the key through the envir
$ export CONFIG_BING_KEY=bing-api-key
```

## Installation
# Installation

```
go get -u github.com/src-d/rovers/...
```

## Usage
# Usage

Run `rovers --help` to get help about the supported commands and their options.

## Test

This service uses PostgreSQL and RabbitMQ.
To initialize the database schemas. You need to run this command only once.
```
rovers initdb
```
To start collecting repository URLs
```
rovers repos --provider=github
```

To execute test locally you need to run RabbitMQ and PostgreSQL too. To set broker's URL for RabbitMQ you can do it through the environment variable:
You can configure rovers by environment variables:

```bash
$ export CONFIG_BROKER_URL=url
```
Providers:
- `CONFIG_GITHUB_TOKEN` to set the github api key.
- `CONFIG_BING_KEY` to set the cgit api key.

Broker:
- `CONFIG_BROKER_URL` to set the broker url, by default `amqp://guest:guest@localhost:5672`

Database:
- `CONFIG_DBUSER`: database username,by default if not set `testing`
- `CONFIG_DBPASS`: database user password,by default if not set `testing`
- `CONFIG_DBHOST`: database host,by default if not set `0.0.0.0`
- `CONFIG_DBPORT`: database port,by default if not set `5432`
- `CONFIG_DBNAME`: database name,by default if not set `testing`
- `CONFIG_DBSSLMODE`: ssl mode to use,by default if not set `disable`
- `CONFIG_DBTIMEOUT`: connection timeout,by default if not set `30s`
- `CONFIG_DBAPPNAME`: application name

# Development

## Build

- `rm Makefile.main; rm -rf .ci` to make sure you will have the last Makefile changes.
- `make dependencies` to download vendor dependencies.
- `make packages` to generate binaries for several platforms.

You will find the built binaries under `./build`.

## Test

This service uses PostgreSQL and RabbitMQ.

By default this URL is set to `amqp://guest:guest@localhost:5672/`. To run tests:
To execute test locally you need to run RabbitMQ and PostgreSQL.

```bash
docker run --hostname postgres --name postgres -e POSTGRES_PASSWORD=testing -p 5432:5432 -e POSTGRES_USER=testing -d postgres
Expand Down
2 changes: 1 addition & 1 deletion commands/cmd_repo_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type CmdRepoProviders struct {
CmdBase
CmdQueue

Providers []string `short:"p" long:"provider" optional:"yes" description:"list of providers to execute. (default: all)"`
Providers []string `short:"p" long:"provider" optional:"yes" description:"provider to execute, any of [github bitbucket cgit]. (If you don't set any provider, all supported provider will be used)"`
WatcherTime time.Duration `short:"t" long:"watcher-time" optional:"no" default:"1h" description:"Time to try again to get new repos"`
}

Expand Down

0 comments on commit 9f7df2c

Please sign in to comment.