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

Commit e905155

Browse files
committed
Improved developer instructions for both docker and system install. Added Makefile.
1 parent 81623fa commit e905155

File tree

3 files changed

+106
-16
lines changed

3 files changed

+106
-16
lines changed

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

README.md

+66-14
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ 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.
42-
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.
36+
## Routes
4637

47-
See the [`LICENSE`](./LICENSE) file for details.
38+
* `/healthcheck` - server status
39+
* `/repositories` - listing of all data repositories
40+
* `/repositories/:repository_uuid` - details of one data repository
41+
* `/fulltree` -
42+
* `/coverage` -
43+
* `/tree` - alias for `/coverage`
4844

4945

5046
## Getting Involved
@@ -56,11 +52,67 @@ We use GitHub issues for [tracking bugs and feature requests](./issues) and Pull
5652

5753
## Installation
5854

59-
The easiest way to get going is to use [docker-compose](https://docs.docker.com/compose/install/). Once you have that:
55+
Running this project can be done either directly on your workstation system, or in a "container" via Docker.
56+
57+
For people comfortable with Docker, or who are excited to learn about it, it can be the best way to get going.
58+
59+
### Docker Install
60+
61+
Running this project via Docker requires:
62+
63+
* [Docker](https://docs.docker.com/engine/installation/)
64+
* [`docker-compose`](https://docs.docker.com/compose/install/)
65+
66+
Running the project in a Docker container should be as simple as:
67+
68+
```
69+
make setup
70+
make run
71+
```
72+
73+
If you get an error about a port "address already in use", you can change the `PORT` environment variable in your local `.env` file.
74+
75+
Barring any changes, you may now visit a JSON endpoint at: `http://localhost:8080/repositories`
76+
77+
### Local System Install
78+
79+
Running this project directly on your system requires:
80+
81+
* Go 1.7+
82+
* Postgresql
83+
84+
(Setting up these services is outside the scope of this README.)
85+
86+
```
87+
cd path/to/coverage
88+
createdb datatogether_coverage
89+
go build
90+
go get ./
91+
# Set a free port on which to serve JSON
92+
export PORT=8080
93+
# Your postgresql instance may be running on a different port
94+
export POSTGRES_DB_URL=postgres://localhost:5432/datatogether_coverage
95+
$GOPATH/bin/coverage
96+
```
97+
98+
Barring any changes, you may now visit a JSON endpoint at: `http://localhost:8080/repositories`
6099

61-
TODO - finish installation instructions
62100

63101

64102
## Development
65103

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

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
- .:/go/src/github.com/datatogether/coverage
77
- ./sql:/sql
88
ports:
9-
- 8080:8080
9+
- $PORT:8080
1010
networks:
1111
- back-tier
1212
depends_on:
@@ -23,4 +23,4 @@ services:
2323
- back-tier
2424

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

0 commit comments

Comments
 (0)