-
Notifications
You must be signed in to change notification settings - Fork 845
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from OSSHealth/dev
Docker support
- Loading branch information
Showing
35 changed files
with
4,246 additions
and
1,380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
*.sqlite | ||
*.ini | ||
*.cfg | ||
*.cfg.old | ||
|
||
# OS generated files # | ||
###################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM python:3 | ||
|
||
RUN mkdir /ghdata | ||
WORKDIR /ghdata | ||
ADD . /ghdata | ||
RUN pip install --upgrade . | ||
|
||
CMD ["ghdata"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,59 @@ | ||
# GHData | ||
|
||
branch | status | ||
--- | --- | ||
--- | --- | ||
master | [![Build Status](https://travis-ci.org/OSSHealth/ghdata.svg?branch=master)](https://travis-ci.org/OSSHealth/ghdata) | ||
dev | [![Build Status](https://travis-ci.org/OSSHealth/ghdata.svg?branch=dev)](https://travis-ci.org/OSSHealth/ghdata) | ||
dev | [![Build Status](https://travis-ci.org/OSSHealth/ghdata.svg?branch=dev)](https://travis-ci.org/OSSHealth/ghdata) | ||
|
||
GHData is a Python library and REST server that provides data related to GitHub repositories. Hosting the GHData project requires a copy of the [GHTorrent database](http://ghtorrent.org/downloads.html). | ||
|
||
GHData is under heavy development; expect frequent backwards-incompatible changes until a 1.x.x release! | ||
|
||
|
||
|
||
Roadmap | ||
------- | ||
|
||
Our technical, outreach, and academic goals [roadmap](https://github.com/OSSHealth/ghdata/wiki/Release-Schedule). | ||
|
||
|
||
License and Copyright | ||
--------------------- | ||
|
||
Copyright © 2017 University of Nebraska at Omaha and the University of Missouri | ||
Installation with Docker | ||
------------------------ | ||
1. Clone the repo | ||
2. `docker-compose build` | ||
3. `docker-compose up` | ||
|
||
GHData is free software: you can redistribute it and/or modify it under the terms of the MIT License as published by the Open Source Initiative. See the file LICENSE for more details. | ||
|
||
All associated documentation is licensed under the terms of the Creative Commons Attribution Share-Alike 4.0 license. See the file CC-BY-SA-4.0 for more details. | ||
|
||
|
||
Dependencies | ||
------------ | ||
|
||
Installation without Docker | ||
--------------------------- | ||
### Dependencies | ||
- Python 3.4.x and `pip` | ||
- MySQL 5.x or later with the [GHTorrent database](http://ghtorrent.org/) [MSR14 dataset](http://ghtorrent.org/) for testing | ||
- [Installation instructions](https://github.com/gousiosg/github-mirror/tree/master/sql) | ||
|
||
Installation | ||
------------ | ||
|
||
First, install ghdata | ||
|
||
- Stable: `pip install --upgrade https://github.com/OSSHealth/ghdata/archive/master.zip` | ||
- Development: `git clone -b dev https://github.com/OSSHealth/ghdata/ && pip install --upgrade ./ghdata/` | ||
|
||
Then, run `ghdata` to create a new config file. Edit the generated `ghdata.cfg` file with your database settings. | ||
- MySQL 5.x or later with the [GHTorrent database](http://ghtorrent.org/) | ||
- You can use the [MSR14 dataset](http://ghtorrent.org/msr14.html) for testing | ||
- [Installation instructions](https://github.com/gousiosg/github-mirror/tree/master/sql) | ||
|
||
Run `ghdata` again. For development, use `make run-debug`, that will start the server with Werkzeug's debugging on. | ||
After restoring GHTorrent (or msr14) to MySQL, it is recommended you create a user for GHData. GHData only needs `SELECT` privileges. | ||
|
||
Usage | ||
----- | ||
|
||
To run GHData as a server: | ||
1. Type `ghdata` in a terminal. A config file named ghdata.cfg will be generated. | ||
2. Edit the ghdata.cfg file with your database settings. | ||
3. Type `ghdata` again to start the server. | ||
|
||
|
||
To use as a Python package: | ||
```python | ||
from ghdata import GHData | ||
|
||
client = GHData('mysql+pymysql://<user>:<pass>@<host>:<port>/<database name>') | ||
railsID = client.repoid(owner='rails', repo='rails') | ||
railsStars = client.stargazers(railsID) | ||
Once the database is set up, clone GHData | ||
```bash | ||
git clone https://github.com/OSSHealth/ghdata/ | ||
cd ghdata && pip install -U . | ||
``` | ||
|
||
Uninstall | ||
------------ | ||
To uninstall, run `pip uninstall ghdata` | ||
|
||
|
||
TODO: More/Better API documentation | ||
Run `ghdata` to create the configuration file (ghdata.cfg). Edit the file to reflect your database credentials. | ||
|
||
DFD Descritpion of GHData | ||
--------------------------------------- | ||
Move ./ghdata/ghdata/static/ to a static host on the same domain. If you would like GHData to serve the files itself, set the "developer" flag to 1 in ghdata.cfg. *`ghdata` must be run in the base of the repo if it is serving the static files* | ||
|
||
DFD Image Here | ||
Run `ghdata` to start the backend. | ||
|
||
|
||
History | ||
------- | ||
|
||
|
||
Maintainers | ||
----------- | ||
License and Copyright | ||
--------------------- | ||
Copyright © 2017 University of Nebraska at Omaha and the University of Missouri | ||
|
||
GHData is free software: you can redistribute it and/or modify it under the terms of the MIT License as published by the Open Source Initiative. See the file LICENSE for more details. | ||
|
||
(This work has been funded through the Alfred P. Sloan Foundation) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: '3' | ||
services: | ||
|
||
db: | ||
build: ./docker/database | ||
restart: always | ||
command: mysqld --verbose | ||
volumes: | ||
- /var/lib/mysql | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_BASE: "msr14" | ||
MYSQL_USER: "msr14" | ||
MYSQL_PASSWORD: "password" | ||
MYSQL_ROOT_PASSWORD: "root" | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | ||
|
||
ghdata: | ||
build: . | ||
restart: always | ||
volumes: | ||
- .:/ghdata | ||
ports: | ||
- "5000:5000" | ||
links: | ||
- db | ||
depends_on: | ||
- db | ||
environment: | ||
GHDATA_DB_USER: "root" | ||
GHDATA_DB_PASS: "root" | ||
GHDATA_DB_PORT: "3306" | ||
GHDATA_DB_HOST: "db" | ||
GHDATA_DB_NAME: "msr14" | ||
GHDATA_GITHUB_API_KEY: | ||
GHDATA_PUBLIC_WWW_API_KEY: | ||
GHDATA_HOST: | ||
GHDATA_PORT: | ||
|
||
web: | ||
build: | ||
context: ./ | ||
dockerfile: ./docker/static-web/Dockerfile | ||
ports: | ||
- "80:80" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM mariadb:10 | ||
|
||
RUN mkdir /data | ||
WORKDIR /data | ||
|
||
# Download database dump | ||
RUN apt-get update && apt-get install -y curl && \ | ||
curl -O https://ghtstorage.blob.core.windows.net/downloads/msr14-mysql.gz | ||
|
||
# Configure it to work with the database we will create | ||
RUN echo 'CREATE DATABASE msr14; USE msr14;' > 02-msr14-mysql.sql && \ | ||
gunzip -c msr14-mysql.gz >> 02-msr14-mysql.sql && \ | ||
mv 02-msr14-mysql.sql /docker-entrypoint-initdb.d/msr-mysql.sql | ||
|
||
EXPOSE 3306 | ||
|
||
# Run the database | ||
CMD ["/usr/bin/mysqld"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM kyma/docker-nginx | ||
COPY ./ghdata/static /var/www | ||
CMD 'nginx' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ghdata/static |
Oops, something went wrong.