Skip to content

Commit

Permalink
updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Oct 24, 2023
1 parent ececdeb commit f9d9b44
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9d9b44

Please sign in to comment.