Skip to content

Commit

Permalink
Added v3.2.1 and v3.2.2 docs (#68)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicholas Long <[email protected]>
  • Loading branch information
axelstudios and nllong authored Dec 25, 2024
1 parent 6ec2e76 commit f6c41de
Show file tree
Hide file tree
Showing 476 changed files with 65,797 additions and 584 deletions.
4 changes: 4 additions & 0 deletions docs/code_documentation/3.2.1/.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: 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 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 added docs/code_documentation/3.2.1/_images/case-a.webp
Binary file not shown.
Binary file added docs/code_documentation/3.2.1/_images/case-b.webp
Binary file not shown.
Binary file added docs/code_documentation/3.2.1/_images/case-c.webp
Binary file not shown.
Binary file added docs/code_documentation/3.2.1/_images/case-d.webp
Binary file not shown.
Binary file not shown.
68 changes: 68 additions & 0 deletions docs/code_documentation/3.2.1/_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/
183 changes: 183 additions & 0 deletions docs/code_documentation/3.2.1/_sources/aws.rst.txt
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/
Loading

0 comments on commit f6c41de

Please sign in to comment.