Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for v2.21.0 #39

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions docs/code_documentation/2.21.0/.buildinfo
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: f1a17141f94cb2079d56bce92dc65614
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 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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions docs/code_documentation/2.21.0/_sources/api.rst.txt
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/
185 changes: 185 additions & 0 deletions docs/code_documentation/2.21.0/_sources/aws.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
=========
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

CACHES = {
'default': {
'BACKEND': 'redis_cache.cache.RedisCache',
'LOCATION': "seed-core-cache.ntmprk.0001.usw2.cache.amazonaws.com:6379",
'OPTIONS': { 'DB': 1 },
'TIMEOUT': 300
}
}
CELERY_BROKER_URL = 'redis://seed-core-cache.ntmprk.0001.usw2.cache.amazonaws.com:6379/1'

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/
Loading