Update all documentation
This commit is contained in:
Родитель
7ec2f6d2e7
Коммит
ecf62397b1
63
README.md
63
README.md
|
@ -1,57 +1,18 @@
|
|||
# Development
|
||||
# Distribution Viewer
|
||||
|
||||
## Install
|
||||
The distribution viewer is a dashboard for viewing empirical cumulative
|
||||
distributions of the Unified Telemetry ping data.
|
||||
|
||||
Follow these steps to install distribution-viewer locally:
|
||||
[![Build](https://img.shields.io/circleci/project/mozilla/distribution-viewer.svg)](https://circleci.com/gh/mozilla/distribution-viewer/)
|
||||
|
||||
1. Install any of the following that are not installed already
|
||||
* git
|
||||
* npm
|
||||
* pip
|
||||
* postgres
|
||||
* python
|
||||
* virtualenv
|
||||
2. `git clone https://github.com/mozilla/distribution-viewer.git`
|
||||
3. `cd distribution-viewer`
|
||||
4. `echo DEBUG=True >> .env`
|
||||
5. `virtualenv env`
|
||||
6. `source env/bin/activate`
|
||||
7. `pip install -r requirements.txt`
|
||||
8. `npm install`
|
||||
9. `npm install -g gulp`
|
||||
10. Start PostgreSQL
|
||||
* Mac: `brew services start postgresql` (see `brew info postgresql` for more
|
||||
info)
|
||||
11. Set up the database
|
||||
1. Create a new user with name *distributionviewer* and password
|
||||
*distributionviewer*
|
||||
* Mac: `createuser --pwprompt distributionviewer`
|
||||
2. Create a new database named *distributionviewer* that the
|
||||
*distributionviewer* user has read/write access to
|
||||
* Mac: `createdb -Odistributionviewer -Eutf8 distributionviewer`
|
||||
3. Give the user *distributionviewer* access to create new tables (needed to
|
||||
run tests later)
|
||||
* Mac: `psql -c "ALTER USER distributionviewer CREATEDB" postgres`
|
||||
## Table of contents
|
||||
|
||||
## Run
|
||||
- Installation
|
||||
- [Install Docker](docs/docker.md)
|
||||
- [Install Frontend](docs/frontend.md)
|
||||
- [API Documentation](docs/api.md)
|
||||
|
||||
1. Start PostgreSQL
|
||||
* If you just finished the install instructions or if you ran `brew services
|
||||
start postgresql` at any point in the past, PostgreSQL should already be
|
||||
running
|
||||
2. `source env/bin/activate`
|
||||
3. `./manage.py runserver`
|
||||
4. In another terminal: `gulp serve:api`
|
||||
5. In another terminal: `gulp watch`
|
||||
6. Load [127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
## More information
|
||||
|
||||
New dependencies will need to be installed from time to time. Run the following
|
||||
if you see an error about a missing or out-of-date dependency:
|
||||
|
||||
1. `pip install -U -r requirements.txt`
|
||||
2. `npm install`
|
||||
|
||||
## Test
|
||||
|
||||
* `./manage.py test`
|
||||
* `gulp test`
|
||||
- Wiki: https://wiki.mozilla.org/Data/Tools
|
||||
- IRC: #datatools on irc.mozilla.org
|
||||
|
|
|
@ -17,15 +17,27 @@ already. See the [Docker documentation][docker-docs] for help.
|
|||
`docker-compose up`
|
||||
|
||||
Running `docker-compose up` from the root directory starts the database and
|
||||
web server. The frontend build step is the same as documented in the README
|
||||
and builds the static files on the host machine. The host machine and web
|
||||
server container share a volume.
|
||||
web server. The frontend build step (see [frontend docs](../docs/frontend.md))
|
||||
builds the static files on the host machine. The host machine and web server
|
||||
container share a volume.
|
||||
|
||||
* To populate the database with sample data:
|
||||
|
||||
`docker exec distributionviewer_server_1 ./manage.py loaddata fixtures/sample.json`
|
||||
|
||||
* View the website in your browser at localhost:8000.
|
||||
Testing
|
||||
=======
|
||||
|
||||
Syntax & unit tests must pass for Pull Requests to be accepted on GitHub.
|
||||
|
||||
* To run server tests:
|
||||
|
||||
`docker exec distributionviewer_server_1 ./manage.py test`
|
||||
|
||||
* To run server linting:
|
||||
|
||||
`docker exec distributionviewer_server_1 flake8 distributionviewer`
|
||||
|
||||
|
||||
Tips & Tricks
|
||||
=============
|
||||
|
@ -36,16 +48,6 @@ Tips & Tricks
|
|||
|
||||
This is necessary for running Django commands, among other things.
|
||||
|
||||
* Syntax & unit tests must pass for Pull Requests to be accepted on GitHub.
|
||||
|
||||
* To run server tests:
|
||||
|
||||
`docker exec distributionviewer_server_1 ./manage.py test`
|
||||
|
||||
* To run server linting:
|
||||
|
||||
`docker exec distributionviewer_server_1 flake8 distributionviewer`
|
||||
|
||||
* If you change `requirements.txt` to add dependencies for Django, you must rebuild `server`:
|
||||
|
||||
`docker-compose build server`
|
|
@ -0,0 +1,24 @@
|
|||
Frontend Dev Notes
|
||||
==================
|
||||
|
||||
The frontend is a single page app built in React.
|
||||
|
||||
Setup
|
||||
=====
|
||||
|
||||
1. `npm install`
|
||||
2. `npm install -g gulp`
|
||||
|
||||
Run
|
||||
===
|
||||
|
||||
1. `gulp watch`
|
||||
2. Load [localhost:8000](http://localhost:8000)
|
||||
|
||||
New dependencies will need to be installed from time to time. Run `npm install`
|
||||
if you see an error about a missing or out-of-date dependency:
|
||||
|
||||
Testing
|
||||
=======
|
||||
|
||||
Run `gulp test` to run the frontend tests.
|
Загрузка…
Ссылка в новой задаче