An open API service indexing awesome lists of open source software.

https://github.com/scieloorg/graph-data-experiment


https://github.com/scieloorg/graph-data-experiment

labs

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Graph data experiment

Experiment on persistent data history storage as a DAG.

The current working directory for all commands described here
is the repository root directory.

The extra tools required for running this experiment as described here
are Docker and [jq](https://github.com/stedolan/jq).

## Database setup

It's based on PostgreSQL.
For a single temporary example
(i.e., an environment with no persistent "volume"),
one can use the default Docker image, for example:

```bash
docker network create gd-network
docker run -d \
-p 5432:5432 \
-e POSTGRES_USER=user \
-e POSTGRES_PASSWORD=pass \
-e POSTGRES_DB=gd \
--name pgdb \
--network gd-network \
postgres:11.5-alpine
```

One still needs to initialize this database.
Assuming you have ``alembic`` and ``psycopg2``
(from the operating system packages
or from a virtual environment
such as the one described in the back-end session of this text,
by installing the frozen versions of these packages
with ``pip install -r migrations/requirements.txt``
or their current version
with ``pip install alembic psycopg2``),
you can bootstrap that database with the migration scripts:

```bash
export GD_PGSQL_DSN=postgres://user:pass@localhost:5432/gd
cd migrations # From the repository root directory
alembic upgrade head
```

These "local" PostgreSQL credentials are the ones
from the docker call in the example.
To bootstrap this otherwhere
just replace the `GD_PGSQL_DSN` environment variable
with the actual credentials.

## LDAP Authentication setup

For testing the application in an isolated environment,
one can run OpenLDAP and populate it with some users.
An example using OpenLDAP v2.4.47:

```bash
LDAP_MAIN_PASSWORD=$(head -c9 /dev/urandom | hexdump -e '"%x"')
echo 'Save this after running for the first time!!!'
echo "export LDAP_MAIN_PASSWORD='$LDAP_MAIN_PASSWORD'"

docker run -d \
-p 636:636 \
--name gd-ldap \
--network gd-network \
--env LDAP_ADMIN_PASSWORD="$LDAP_MAIN_PASSWORD" \
--env LDAP_CONFIG_PASSWORD="$LDAP_MAIN_PASSWORD" \
--env LDAP_DOMAIN="graph.data" \
--env LDAP_ORGANISATION="Organise & Organize Company Ltd." \
--env LDAP_TLS_VERIFY_CLIENT=try \
osixia/openldap:1.2.5

# Create an organizational unit, a common user and an "admin" user
docker exec -i gd-ldap ldapadd -x \
-D "cn=admin,dc=graph,dc=data" \
-w "$LDAP_MAIN_PASSWORD" \
-H ldap://localhost \
<