From f9d9b44af70c67f73db52ec43f5e7ebd6d19f802 Mon Sep 17 00:00:00 2001 From: Brian Cherinka Date: Tue, 24 Oct 2023 10:31:08 -0400 Subject: [PATCH] updating readme --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 546ed9e..d3258e9 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,44 @@ uvicorn valis.wsgi:app --reload ``` This will start a local web server at `http://localhost:8000/valis/`. The API documentation will be located at `http://localhost:8000/valis/docs`. Or to see the alternate documentation, go to `http://localhost:8000/valis/redoc/` +### Database Connection + +Valis uses the `sdssdb` package for all connections to databases. The most relevant database for the API is the `sdss5db` on `pipelines.sdss.org`. The easiest way to connect is through a local SSH tunnel. To set up a tunnel, + +1. Add the following to your `~/.ssh/config`. Replace `unid` with your Utah unid. + +``` +Host pipe + HostName pipelines.sdss.org + User [unid] + ForwardX11Trusted yes + ProxyCommand ssh -A [unid]@mwm.sdss.org nc %h %p +``` +1. In a terminal, create an ssh tunnel to the pipelines database localhost port 5432, to a some local port. E.g. this maps the remote db localhost port 5432 to local machine on port 6000. +``` + ssh -L 6000:localhost:5432 pipe +``` +2. Optionally, update your `~/.pgass` file with the following lines. Replace `port`, `unid`, and `password`, with your tunneled port, Utah unid, and db password, respectively. Alternatively, just set the VALIS_DB_PASS environment variable with your database password. +``` +localhost:[port]:*:[unid]:[password] +host.docker.internal:[port]:*:[unid]:[password] +``` +3. Set the following environment variables. + +- export VALIS_DB_PORT=6000 +- export VALIS_DB_USER={unid} +- export VALIS_DB_PASS={password} (if skipped step 2.) + +or optionally add them to the `~/.config/sdss/valis.yaml` configuration file. + +``` +allow_origin: ['http://localhost:3000'] +db_remote: true +db_port: 6000 +db_user: {unid} +``` + + ## Deployment ### Deploying at Utah in api.sdss.org docker - Login to `lore` or `manga` machines