https://github.com/scieloorg/graph-data-experiment
https://github.com/scieloorg/graph-data-experiment
labs
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/scieloorg/graph-data-experiment
- Owner: scieloorg
- License: bsd-2-clause
- Created: 2019-03-22T20:26:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T11:30:33.000Z (over 3 years ago)
- Last Synced: 2024-04-14T20:25:29.643Z (about 2 years ago)
- Topics: labs
- Language: Python
- Size: 951 KB
- Stars: 1
- Watchers: 13
- Forks: 0
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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 \
<