Skip to content

Commit

Permalink
Merge pull request #199 from mcarmonaa/improvement/add-docker-compose…
Browse files Browse the repository at this point in the history
…-file

*: Add docker-compose file to make easier run rovers and update the README
  • Loading branch information
mcarmonaa authored Aug 23, 2018
2 parents 9f7df2c + 8d6b813 commit becfa06
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 20 deletions.
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,40 @@
**rovers** is a service to retrieve repository URLs from multiple repository
hosting providers.

Type `help` fore commands info.

# Quick start using docker images

## Download docker images

Get the last version of rovers spark image:
Get the latest rovers image:

```bash
docker pull srcd/rovers
```

Also, you will need Postgres and RabbitMQ

```bash
docker pull postgres:9.6-alpine
docker pull rabbitmq:3-management
```
### Start everything using docker-compose

## Start everything
Install [docker-compose](https://docs.docker.com/compose/install/).

Start Rabbit and Postgres

```bash
docker run -d --hostname postgres --name postgres -e POSTGRES_PASSWORD=testing -p 5432:5432 -e POSTGRES_USER=testing postgres:9.6-alpine
docker-compose -d up rovers-postgres rovers-rabbitmq
```

Export as environment variables the API keys([see section](#supported-providers)).Then, you can execute rovers:
```bash
docker run -d --hostname rabbitmq --name rabbitmq -p 8081:15672 -p 5672:5672 rabbitmq:3-management
docker-compose up --no-deps rovers
```

Then, you can execute rovers using docker:
If you need run just some of the availables supported-providers, you can use this command replacing the flag `--provider` with those providers you want to use:
```bash
docker run --name rovers --link rabbitmq --link postgres \
-e CONFIG_GITHUB_TOKEN=[REPLACEWITHGHKEY] \
-e CONFIG_BING_KEY=[REPLACEWITHBINGKEY] \
srcd/rovers /bin/sh -c "rovers initdb; rovers repos --queue=rovers"
docker-compose run --rm --no-deps --service-ports rovers /bin/sh -c "rovers initdb; rovers repos --provider=github --provider=bitbucket"
```

After that, rovers will generate a lot of 'mentions' (git repositories found on the internet), and sending them to the 'rovers' queue in Rabbit.

To stop and remove all the containers running `docker-compose down`

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

# Supported Providers
Expand Down Expand Up @@ -138,9 +133,8 @@ This service uses PostgreSQL and RabbitMQ.
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
docker run -d --hostname rabbit --name rabbit -p 8081:15672 -p 5672:5672 rabbitmq:3-management
go test ./...
docker-compose up -d rovers-postgres rovers-rabbitmq
make test
```

# Running Rovers in Kubernetes
Expand Down
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3'

services:

rovers:
image: srcd/rovers:latest
container_name: rovers
environment:
- CONFIG_GITHUB_TOKEN=${CONFIG_GITHUB_TOKEN:-unknown_api_key}
- CONFIG_BING_KEY=${CONFIG_BING_TOKEN:-unknown_api_key}
- CONFIG_BROKER_URL=amqp://guest:guest@rovers-rabbitmq:5672
- CONFIG_DBHOST=rovers-postgres
depends_on:
- rovers-postgres
- rovers-rabbitmq
command: /bin/sh -c "rovers initdb; rovers repos"

rovers-postgres:
image: postgres:10.5-alpine
container_name: rovers-postrgres
ports:
- "5432:5432"
environment:
- POSTGRES_DB=testing
- POSTGRES_USER=testing
- POSTGRES_PASSWORD=testing

rovers-rabbitmq:
image: rabbitmq:3.7.7-management-alpine
container_name: rovers-rabbitmq
ports:
- "5672:5672"
- "15672:15672"

0 comments on commit becfa06

Please sign in to comment.