Skip to content
This repository was archived by the owner on Nov 5, 2019. It is now read-only.

Commit 0824ca1

Browse files
authored
Merge pull request #23 from datatogether/dev-instructions
Add developer instructions
2 parents 81623fa + cd37df3 commit 0824ca1

File tree

5 files changed

+113
-17
lines changed

5 files changed

+113
-17
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ gin-bin
33
coverage
44
coverage.txt
55
config.*.json
6-
*.env
6+
.env

Diff for: Makefile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
DOCKER := $(shell command -v docker 2> /dev/null)
3+
DOCKER_COMPOSE := $(shell command -v docker-compose 2> /dev/null)
4+
5+
dchecks:
6+
ifndef DOCKER
7+
$(error "Command is not available please install Docker")
8+
endif
9+
ifndef DOCKER_COMPOSE
10+
$(error "Command is not available please install docker-compose")
11+
endif
12+
13+
setup: checks ## Docker: setup, build/rebuild app container
14+
cp --no-clobber sample.env .env
15+
docker-compose build
16+
17+
run: checks ## Docker: run app in container
18+
docker-compose up
19+
20+
run-cmd: checks ## Docker: run arbitary command in container, eg. `make drun-cmd go test`
21+
docker-compose run coverage $(filter-out $@,$(MAKECMDGOALS))
22+
23+
test: checks ## Docker: run unit tests in container
24+
docker-compose run coverage go test
25+
26+
%:
27+
@true
28+
29+
.PHONY: help
30+
31+
help:
32+
@echo 'Usage: make <command>'
33+
@echo
34+
@echo 'where <command> is one of the following:'
35+
@echo
36+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
37+
38+
.DEFAULT_GOAL := help

Diff for: README.md

+70-13
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ It takes a list of urls and associated archiving information, and turns that int
3333
The output is cached in [`cache.json`](cache.json). Because this is a large file, we provide incremental pieces of the cached tree as a web server. To dynamically calculate coverage completion to can work with the `cache.json` file.
3434

3535

36-
## License & Copyright
37-
38-
Copyright (C) 2017 Data Together
39-
This program is free software: you can redistribute it and/or modify it under
40-
the terms of the GNU Affero General Public License as published by the Free Software
41-
Foundation, version 3.0.
36+
## Routes
4237

43-
This program is distributed in the hope that it will be useful, but WITHOUT ANY
44-
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
45-
PARTICULAR PURPOSE.
38+
* `/healthcheck` - server status
39+
* `/repositories` - list all data repositories [:question:][route-repos]
40+
* `/repositories/:repository_uuid` - get details for a single data repository [:question:][route-repo]
41+
* `/fulltree` - get full coverage tree of url-based resources
42+
* `/tree` - get scope-able coverage tree [:question:][route-coverage]
43+
* `/coverage` - get coverage summary (not currently used)
4644

47-
See the [`LICENSE`](./LICENSE) file for details.
45+
[route-repos]: http://petstore.swagger.io/?url=https://raw.githubusercontent.com/datatogether/api/master/open_api.yaml#/default/get_repositories
46+
[route-repo]: http://petstore.swagger.io/?url=https://raw.githubusercontent.com/datatogether/api/master/open_api.yaml#/default/get_repository__id_
47+
[route-coverage]: http://petstore.swagger.io/?url=https://raw.githubusercontent.com/datatogether/api/master/open_api.yaml#/default/get_coverage
4848

4949

5050
## Getting Involved
@@ -56,11 +56,68 @@ We use GitHub issues for [tracking bugs and feature requests](./issues) and Pull
5656

5757
## Installation
5858

59-
The easiest way to get going is to use [docker-compose](https://docs.docker.com/compose/install/). Once you have that:
59+
Running this project can be done either directly on your workstation system, or in a "container" via Docker.
60+
61+
For people comfortable with Docker, or who are excited to learn about it, it can be the best way to get going.
62+
63+
### Docker Install
64+
65+
Running this project via Docker requires:
66+
67+
* [Docker](https://docs.docker.com/engine/installation/)
68+
* [`docker-compose`](https://docs.docker.com/compose/install/)
69+
70+
Running the project in a Docker container should be as simple as:
71+
72+
```
73+
make setup
74+
make run
75+
```
76+
77+
If you get an error about a port "address already in use", you can change the `PORT` environment variable in your local `.env` file.
78+
79+
Barring any changes, you may now visit a JSON endpoint at: `http://localhost:8080/repositories`
80+
81+
### Local System Install
6082

61-
TODO - finish installation instructions
83+
Running this project directly on your system requires:
84+
85+
* Go 1.7+
86+
* Postgresql
87+
88+
(Setting up these services is outside the scope of this README.)
89+
90+
```
91+
cd path/to/coverage
92+
createdb datatogether_coverage
93+
go build
94+
go get ./
95+
# Set a free port on which to serve JSON
96+
export PORT=8080
97+
# Your postgresql instance may be running on a different port
98+
export POSTGRES_DB_URL=postgres://localhost:5432/datatogether_coverage
99+
$GOPATH/bin/coverage
100+
```
101+
102+
Barring any changes, you may now visit a JSON endpoint at: `http://localhost:8080/repositories`
62103

63104

64105
## Development
65106

66-
Coming soon.
107+
Please follow the install instructions above! Inclusion of tests are appreciated!
108+
109+
For a list of all availabe helper commands, just type `make`.
110+
111+
112+
## License & Copyright
113+
114+
Copyright (C) 2017 Data Together
115+
This program is free software: you can redistribute it and/or modify it under
116+
the terms of the GNU Affero General Public License as published by the Free Software
117+
Foundation, version 3.0.
118+
119+
This program is distributed in the hope that it will be useful, but WITHOUT ANY
120+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121+
PARTICULAR PURPOSE.
122+
123+
See the [`LICENSE`](./LICENSE) file for details.

Diff for: docker-compose.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ services:
66
- .:/go/src/github.com/datatogether/coverage
77
- ./sql:/sql
88
ports:
9-
- 8080:8080
9+
- $PORT:$PORT
1010
networks:
1111
- back-tier
1212
depends_on:
1313
- postgres
1414
environment:
15-
- PORT=8080
15+
- PORT=$PORT
1616
- TLS=false
1717
- GOLANG_ENV=develop
1818
- POSTGRES_DB_URL=postgres://postgres@postgres/postgres?sslmode=disable
@@ -23,4 +23,4 @@ services:
2323
- back-tier
2424

2525
networks:
26-
back-tier:
26+
back-tier:

Diff for: sample.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PORT=8080

0 commit comments

Comments
 (0)