Skip to content
New issue

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

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

Already on GitHub? # to your account

docs: update readme for postgres setup #14

Merged
merged 2 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ according to the GA4GH Variation Representation standards.
* [future] Structural Variation/Translocations/Fusions

All types are assigned computed, digest-based identifiers based on the
underlying data.
underlying data.


## Architecture
Expand Down Expand Up @@ -67,8 +67,8 @@ variables provide additional configuration:
Example for running with REST API:

```
$ export GA4GH_VRS_DATAPROXY_URI=https://services.genomicmedlab.org/seqrepo
$ export ANYVAR_STORAGE_URI="redis:///15"
$ export GA4GH_VRS_DATAPROXY_URI=seqrepo+https://services.genomicmedlab.org/seqrepo
$ export ANYVAR_STORAGE_URI=postgres://postgres:postgres@localhost/anyvar_db
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep the documentation for how to use redis?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreasprlic updated in latest commit

```

Example for running with local SeqRepo:
Expand Down Expand Up @@ -114,7 +114,15 @@ $ docker run --name anyvar_redis -v anyvar_redis_vol:/data -d redis redis-server
$ python3 -m anyvar.restapi
```

### Setting up Postgres

A Postgres-backed *AnyVar* installation may use any Postgres instance, local
or remote. The following instructions are for using a docker-based
Postgres instance.

First, run the commands in (README-pg.md)[src/anyvar/storage/README-pg.md]. This will create and start a local Postgres docker instance.

Next, run the commands in (postgres_init.sql)[src/anyvar/storage/postgres_init.sql]. This will create the `anyvar` user with the appropriate permissions and create the `anyvar_db` database.

## Deployment

Expand Down
2 changes: 1 addition & 1 deletion src/anyvar/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_storage(uri=None):
from .redisobjectstore import RedisObjectStore
storage = RedisObjectStore(redis.Redis.from_url(uri))

elif parsed_uri.scheme == "postgres":
elif parsed_uri.scheme == "postgresql":
from .postgres import PostgresObjectStore
storage = PostgresObjectStore(uri)

Expand Down
2 changes: 1 addition & 1 deletion src/anyvar/storage/pg_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self,
url = _parse_url(db_url)
#if url.schema is None:
# raise Exception("No schema name provided in {url}".format(url=url))
if url.scheme != "postgres":
if url.scheme != "postgresql":
raise Exception("Only Postgres databases supported for now")
self.application_name = application_name
self.pooling = pooling
Expand Down
3 changes: 1 addition & 2 deletions src/anyvar/storage/postgres_init.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CREATE USER anyvar;
CREATE DATABASE anyvar_db;
GRANT ALL PRIVILEGES ON DATABASE anyvar_db TO anyvar;
CREATE TABLE vrs_objects (id BIGINT primary key, vrs_id text, vrs_object jsonb);
GRANT ALL PRIVILEGES ON DATABASE anyvar_db TO anyvar;