-
Notifications
You must be signed in to change notification settings - Fork 23
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 #221 from SEL-Columbia/staging
0.2.2 release
- Loading branch information
Showing
67 changed files
with
2,496 additions
and
711 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "react"] | ||
} |
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
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,90 +1,65 @@ | ||
# About | ||
# Dokomo Forms | ||
|
||
Dokomo Forms is a self-hosted data collection and analysis platform, and is the successor to [Formhub](https://formhub.org/). | ||
Dokomo Forms is a free and open source data collection and analysis platform. | ||
|
||
[![Build Status](https://travis-ci.org/SEL-Columbia/dokomoforms.svg?branch=master)](https://travis-ci.org/SEL-Columbia/dokomoforms) | ||
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/SEL-Columbia/dokomoforms?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
|
||
[![Coverage Status](https://coveralls.io/repos/SEL-Columbia/dokomoforms/badge.svg?branch=master)](https://coveralls.io/r/SEL-Columbia/dokomoforms?branch=master) | ||
|
||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/dokomo_sauce_matrix.svg)](https://saucelabs.com/u/dokomo_sauce_matrix) | ||
|
||
[![Documentation Status](https://readthedocs.org/projects/dokomoforms/badge/?version=master)](https://readthedocs.org/projects/dokomoforms/?badge=latest) | ||
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/SEL-Columbia/dokomoforms?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![Dependency Status](https://gemnasium.com/SEL-Columbia/dokomoforms.svg)](https://gemnasium.com/SEL-Columbia/dokomoforms) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/dokomo_sauce_matrix.svg)](https://saucelabs.com/u/dokomo_sauce_matrix) | ||
|
||
[![Documentation Status](https://readthedocs.org/projects/dokomoforms/badge/?version=latest)](https://readthedocs.org/projects/dokomoforms/?badge=latest) | ||
|
||
# Staging | ||
|
||
1. Organization owns instance, and all users belong to the organization. (TODO) | ||
|
||
2. Filesystem-level encryption. (TODO) | ||
|
||
3. i18n | ||
|
||
4. Focus on questions rather than surveys. (TODO) | ||
|
||
5. You can specify configuration options in `local_config.py` or as command line flags to [webapp.py](webapp.py). The available options are defined in [dokomoforms/options.py](dokomoforms/options.py) | ||
|
||
6. [webapp.py](webapp.py) now sets up the tables for you (no more `manage_db.py`). If you want `$ manage_db.py -d`, run | ||
|
||
`$ ./webapp.py --kill=True` | ||
|
||
You can also specify the schema you want like `$ ./webappy.py --schema=whatever` | ||
|
||
7. New way to run tests (after `$ pip install tox`): | ||
|
||
`$ tox` | ||
|
||
Or, if you want the coverage report as well, | ||
|
||
`$ tox -e cover` | ||
|
||
The tests only touch the `doko_test` schema (which they create/destroy for you). | ||
## About the Project | ||
|
||
# Using Docker for Local Dev Environment and Deployment | ||
Several solutions exist to handle offline mobile data collection. While this type of technology is increasingly valuable to organizations working in the developing world, the available solutions are cumbersome to use, often requiring a confusing mélange of individual software components and advanced technical skills to setup and manage. | ||
|
||
[Docker](https://en.wikipedia.org/wiki/Docker_(software)) is a container management software that aims at component separation and deployment automation. Please refer to [the Docker API](https://docs.docker.com/) for a fuller introduction. | ||
**Dokomo strives to simplify the process by integrating the elements of a data collection effort into a unified system, from creation of mobile-ready surveys to quick analysis and visualization of the collected data.** | ||
|
||
## Using Docker Manually (Docker knowledge required) | ||
## Features | ||
|
||
There is a [Dockerfile](Dockerfile) in the root directory to build the Docker image of the Dokomo Forms webapp component building on top a Python 3 image. To build the webapp image, run | ||
#### Mobile-Web Technology | ||
|
||
> $ docker build -t selcolumbia/dokomoforms . | ||
Instead of relying on platform-specific apps, Dokomo's surveys are conducted using an offline-capable mobile web app. This makes for an easier workflow for administrators and enumerators — surveys can be distributed and accessed via a normal web link, and can be conducted on (almost) any device that has a web browser. | ||
|
||
However, Dokomo Forms as a service needs other components such as the database in order to work. We have referenced `mdillon/postgis` as the image, since we are using PostgreSQL with the PostGIS extension. You may also substitute `mdillon/postgis` with any image includes PostGIS. A manual way to run Dokomo Forms as a service would involve starting the `postgis` container and linking it to the Dokomo Forms image we have just built, such as: | ||
![alt Dokomo Forms Admin - Manage](https://i.imgur.com/saW5zcB.jpg) | ||
|
||
> $ docker run -d -p 8888:8888 --link postgis:db selcolumbia/dokomoforms | ||
#### Survey Monitoring | ||
|
||
## Using Docker for Local Development | ||
As an adminstrator of a surveying effort, it's important to know where, when, and by whom data is being submitted. Dokomo Forms lets administrators quickly see the current progress of an effort, providing a quick list and map of the latest submissions and a graph showing submissions/day for the recent past. | ||
|
||
`docker-compose` is the program that automates Docker container building, running, and linking as described above. It uses the [docker-compose.yml](docker-compose.yml) file which is provided in the root directory. | ||
![alt Dokomo Forms Admin - Manage](https://i.imgur.com/6z7UJt2.jpg) | ||
|
||
To start the service locally, run: | ||
#### Submission Data Quick Views | ||
|
||
> $ docker-compose up | ||
Administrators can quickly view data from individual submissions and get some basic statistics and aggregations from each question on a survey. | ||
|
||
Docker will download the necessary images, then build and link them. This step takes 3-5 minutes for the first build. Once the command has finished, you can visit [http://localhost:8888](http://localhost:8888) and start using Dokomo Forms. | ||
![alt Dokomo Forms Admin - Data](https://i.imgur.com/hwYRf8e.jpg) | ||
|
||
## Using Docker for Automated Deployment | ||
#### Revisit Integration | ||
|
||
`docker-machine` is the program that automates the deployment process. It can hook into many VPS providers such as [AWS](http://aws.amazon.com/), [Rackspace](http://www.rackspace.com/) and [DigitalOcean](https://www.digitalocean.com/). | ||
Dokomo Forms integrates with [Revisit](http://revisit.global), a global facility registry API built here at the Sustainable Engineering Lab. Leveraging Revisit, multiple surveys conducted at the same facility can be easily linked, allowing changes in data points at survey locations to be tracked over time. | ||
|
||
Here is an example using DigitalOcean: | ||
## Under Development | ||
|
||
1. Obtain a token from DigitalOcean. Click on "Generate New Token" from the API page as indicated below. | ||
Dokomo Forms is under active development, with some pretty nifty features on the horizon. | ||
|
||
![doapi](http://i.imgur.com/0SrmqX7.jpg) | ||
#### Survey Creation GUI | ||
|
||
2. Create a droplet with the token you have just acquired | ||
Soon survey administrators will be able to quickly create surveys though a web-based creation tool, built directly into Dokomo Forms. | ||
|
||
> $ docker-machine create -d digitalocean --digitalocean-access-token YOUR_ACCESS_TOKEN dokomoforms | ||
#### Better Survey Administration | ||
|
||
3. Make your local Docker environment aware of this new machine | ||
- Publish surveys directly from the administration panel to enumerators' mobile devices. | ||
- Send updates and communications to enumerators | ||
|
||
> $ eval $(docker-machine env dokomoforms) | ||
#### Data Visualization | ||
|
||
4. Run `docker-compose` with the new environment | ||
- View collected data on map | ||
- See quick statistics and aggregations on a per-question basis | ||
|
||
> $ docker-compose up -d | ||
## Guides and Documentation | ||
|
||
Now you have an instance of Dokomo Forms running on your DigitalOcean droplet! | ||
- [User Guide](https://github.com/SEL-Columbia/dokomoforms/wiki/User-Guide) | ||
- [Local Development Environment Setup](https://github.com/SEL-Columbia/dokomoforms/wiki/Local-Development-Environment) | ||
- [Deployment](https://github.com/SEL-Columbia/dokomoforms/wiki/Deployment) | ||
- [REST API Documentation](https://github.com/SEL-Columbia/dokomoforms/wiki/REST-API-v0.2.0) |
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 |
---|---|---|
|
@@ -29,9 +29,10 @@ | |
|
||
db_database = 'doko' | ||
db_user = 'postgres' | ||
organization = 'unconfigured organization' | ||
|
||
https = True | ||
organization = 'unconfigured organization' | ||
admin_email = '[email protected]' | ||
admin_name = 'admin' | ||
|
||
try: | ||
from local_config import * # NOQA | ||
|
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,22 +1,22 @@ | ||
nginx: | ||
image: "nginx:1.9.5" | ||
image: "nginx:1.9.8" | ||
links: | ||
- "webapp:webapp" | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf | ||
- /etc/letsencrypt:/etc/letsencrypt | ||
- /tmp:/tmp | ||
webapp: | ||
image: "selcolumbia/dokomoforms" | ||
command: bash -c "head -c 24 /dev/urandom > cookie_secret && python webapp.py" | ||
image: "selcolumbia/dokomoforms:0.2.2" | ||
command: bash -c "./docker-wait-for-postgres.sh db && head -c 24 /dev/urandom > cookie_secret && python webapp.py" | ||
links: | ||
- "db:db" | ||
ports: | ||
- "8888:8888" | ||
volumes: | ||
- ./local_config.py:/dokomo/local_config.py | ||
db: | ||
image: "mdillon/postgis:9.4" | ||
environment: | ||
POSTGRES_PASSWORD: 'password' | ||
POSTGRES_DB: 'doko' |
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,6 @@ | ||
#!/usr/bin/env sh | ||
until psql --host=$1 --username=postgres -w &>/dev/null | ||
do | ||
echo "Waiting for PostgreSQL..." | ||
sleep 1 | ||
done |
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
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
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
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
Oops, something went wrong.