-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
191dd22
commit bc41a24
Showing
476 changed files
with
65,797 additions
and
584 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,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: f32800f3ace39151d4cdc84ff0e370e1 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+38.7 KB
docs/code_documentation/3.2.1/.doctrees/kubernetes_deployment.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+195 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.cleansing.doctree
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+23.4 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.data_importer.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.43 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.landing.management.commands.doctree
Binary file not shown.
Binary file added
BIN
+3.59 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.landing.management.doctree
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+46.8 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.lib.mappings.doctree
Binary file not shown.
Binary file added
BIN
+20.7 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.lib.merging.doctree
Binary file not shown.
Binary file added
BIN
+4.16 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.management.doctree
Binary file not shown.
Binary file added
BIN
+3.61 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.managers.doctree
Binary file not shown.
Binary file added
BIN
+3.11 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.managers.tests.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+31.1 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.serializers.doctree
Binary file not shown.
Binary file added
BIN
+28 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.templatetags.doctree
Binary file not shown.
Binary file added
BIN
+4.22 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.test_helpers.doctree
Binary file not shown.
Binary file added
BIN
+37.2 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.test_helpers.factory.doctree
Binary file not shown.
Binary file added
BIN
+2.89 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.test_helpers.factory.lib.doctree
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.23 KB
docs/code_documentation/3.2.1/.doctrees/modules/seed.tests.functional.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,68 @@ | ||
API | ||
=== | ||
|
||
Authentication | ||
-------------- | ||
Authentication is handled via an encoded authorization token set in a HTTP header. | ||
To request an API token, go to ``/app/#/profile/developer`` and click 'Get a New API Key'. | ||
|
||
Authenticate every API request with your username (email, all lowercase) and the API key via `Basic Auth`_. | ||
The header is sent in the form of ``Authorization: Basic <credentials>``, where credentials is the base64 encoding of the email and key joined by a single colon ``:``. | ||
|
||
.. _Basic Auth: https://en.wikipedia.org/wiki/Basic_access_authentication | ||
|
||
Using Python, use the requests library:: | ||
|
||
import requests | ||
|
||
result = requests.get('https://seed-platform.org/api/version/', auth=(user_email, api_key)) | ||
print result.json() | ||
|
||
Using curl, pass the username and API key as follows:: | ||
|
||
curl -u user_email:api_key http://seed-platform.org/api/version/ | ||
|
||
If authentication fails, the response's status code will be 302, redirecting the user to ``/app/login``. | ||
|
||
Payloads | ||
-------- | ||
|
||
Many requests require a JSON-encoded payload and parameters in the query string of the url. A frequent | ||
requirement is including the organization_id of the org you belong to. For example:: | ||
|
||
curl -u user_email:api_key https://seed-platform.org/api/v2/organizations/12/ | ||
|
||
Or in a JSON payload:: | ||
|
||
curl -u user_email:api_key \ | ||
-d '{"organization_id":6, "role": "viewer"}' \ | ||
https://seed-platform.org/api/v2/users/12/update_role/ | ||
|
||
Using Python:: | ||
|
||
params = {'organization_id': 6, 'role': 'viewer'} | ||
result = requests.post('https://seed-platform.org/api/v2/users/12/update_role/', | ||
data=json.dumps(params), | ||
auth=(user_email, api_key)) | ||
print result.json() | ||
|
||
Responses | ||
--------- | ||
|
||
Responses from all requests will be JSON-encoded objects, as specified in each endpoint's documentation. | ||
In the case of an error, most endpoints will return this instead of the expected payload (or an HTTP status code):: | ||
|
||
{ | ||
"status": "error", | ||
"message": "explanation of the error here" | ||
} | ||
|
||
API Endpoints | ||
------------- | ||
|
||
A list of interactive endpoints are available by accessing the API menu item on the left navigation | ||
pane within you account on your SEED instance. | ||
|
||
To view a list of non-interactive endpoints without an account, view swagger_ on the development server. | ||
|
||
.. _swagger: https://seed-platform.org/api/swagger/ |
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,183 @@ | ||
========= | ||
AWS Setup | ||
========= | ||
|
||
Amazon Web Services (`AWS`_) provides the preferred hosting for the SEED Platform. | ||
|
||
**seed** is a `Django Project`_ and Django's documentation is an excellent place for general | ||
understanding of this project's layout. | ||
|
||
.. _Django Project: https://www.djangoproject.com/ | ||
|
||
.. _AWS: http://aws.amazon.com/ | ||
|
||
Prerequisites | ||
^^^^^^^^^^^^^ | ||
|
||
Ubuntu server 18.04 LTS | ||
|
||
.. note:: These instructions have not been updated for Ubuntu 18.04. It is recommended to use Docker-based deployments. | ||
|
||
.. code-block:: console | ||
sudo apt-get update | ||
sudo apt-get upgrade | ||
sudo apt-get install -y libpq-dev python-dev python-pip libatlas-base-dev \ | ||
gfortran build-essential g++ npm libxml2-dev libxslt1-dev git mercurial \ | ||
libssl-dev libffi-dev curl uwsgi-core uwsgi-plugin-python | ||
PostgreSQL and Redis are not included in the above commands. For a quick installation on AWS it | ||
is okay to install PostgreSQL and Redis locally on the AWS instance. If a more permanent and | ||
scalable solution, it is recommended to use AWS's hosted Redis (ElastiCache) and PostgreSQL service. | ||
|
||
.. note:: postgresql ``>=9.4`` is required to support `JSON Type`_ | ||
|
||
.. code-block:: console | ||
# To install PostgreSQL and Redis locally | ||
sudo apt-get install redis-server | ||
sudo apt-get install postgresql postgresql-contrib | ||
.. _`JSON Type`: https://www.postgresql.org/docs/9.4/datatype-json.html | ||
|
||
Amazon Web Services (AWS) Dependencies | ||
++++++++++++++++++++++++++++++++++++++ | ||
|
||
The following AWS services can be used for **SEED** but are not required: | ||
|
||
* RDS (PostgreSQL >=9.4) | ||
* ElastiCache (redis) | ||
* SES | ||
|
||
|
||
Python Dependencies | ||
^^^^^^^^^^^^^^^^^^^ | ||
|
||
Clone the **SEED** repository from **github** | ||
|
||
.. code-block:: console | ||
$ git clone [email protected]:SEED-platform/seed.git | ||
enter the repo and install the python dependencies from `requirements`_ | ||
|
||
.. _requirements: https://github.com/SEED-platform/seed/blob/main/requirements/aws.txt | ||
|
||
.. code-block:: console | ||
$ cd seed | ||
$ sudo pip install -r requirements/aws.txt | ||
JavaScript Dependencies | ||
^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
``npm`` is required to install the JS dependencies. | ||
|
||
.. code-block:: console | ||
$ sudo apt-get install build-essential | ||
$ sudo apt-get install curl | ||
.. code-block:: console | ||
$ npm install | ||
Database Configuration | ||
^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Copy the ``local_untracked.py.dist`` file in the ``config/settings`` directory to | ||
``config/settings/local_untracked.py``, and add a ``DATABASES`` configuration with your database username, | ||
password, host, and port. Your database configuration can point to an AWS RDS instance or a PostgreSQL 9.4 database | ||
instance you have manually installed within your infrastructure. | ||
|
||
.. code-block:: python | ||
# Database | ||
DATABASES = { | ||
'default': { | ||
'ENGINE':'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'seed', | ||
'USER': '', | ||
'PASSWORD': '', | ||
'HOST': '', | ||
'PORT': '', | ||
} | ||
} | ||
.. note:: | ||
|
||
In the above database configuration, ``seed`` is the database name, this | ||
is arbitrary and any valid name can be used as long as the database exists. | ||
|
||
create the database within the postgres ``psql`` shell: | ||
|
||
.. code-block:: psql | ||
CREATE DATABASE seed; | ||
or from the command line: | ||
|
||
.. code-block:: console | ||
createdb seed | ||
create the database tables and migrations: | ||
|
||
.. code-block:: console | ||
python manage.py syncdb | ||
python manage.py migrate | ||
create a superuser to access the system | ||
|
||
.. code-block:: console | ||
$ python manage.py create_default_user [email protected] --organization=example --password=demo123 | ||
.. note:: | ||
|
||
Every user must be tied to an organization, visit ``/app/#/profile/admin`` | ||
as the superuser to create parent organizations and add users to them. | ||
|
||
Cache and Message Broker | ||
^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
The SEED project relies on `redis`_ for both cache and message brokering, and | ||
is available as an AWS `ElastiCache`_ service. | ||
``local_untracked.py`` should be updated with the ``CACHES`` and ``CELERY_BROKER_URL`` | ||
settings. | ||
|
||
.. _ElastiCache: https://aws.amazon.com/elasticache/ | ||
|
||
.. _redis: http://redis.io/ | ||
|
||
.. code-block:: python | ||
CELERY_BROKER_URL = 'redis://seed-core-cache.ntmprk.0001.usw2.cache.amazonaws.com:6379/1' | ||
CACHES = { | ||
'default': { | ||
'BACKEND': 'django_redis.cache.RedisCache', | ||
'LOCATION': CELERY_BROKER_URL, | ||
} | ||
} | ||
Running Celery the Background Task Worker | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
`Celery`_ is used for background tasks (saving data, matching, data quality checks, etc.) | ||
and must be connected to the message broker queue. From the project directory, ``celery`` | ||
can be started: | ||
|
||
.. code-block:: console | ||
celery -A seed worker -l INFO -c 2 --max-tasks-per-child 1000 -EBS django_celery_beat.schedulers:DatabaseScheduler | ||
.. _Celery: http://www.celeryproject.org/ |
Oops, something went wrong.