Skip to content

Commit

Permalink
docs: update README.md add how to set up a data proxy locally
Browse files Browse the repository at this point in the history
  • Loading branch information
aiji42 committed Jun 24, 2022
1 parent 47010a6 commit e7ce5ef
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,55 @@ PORT={server port e.g. 3000}
yarn pdp
```

This will bring up the proxy server, but it must be SSL-enabled to connect from `@prisma/client`. We will soon describe how to use docker-compose for SSL with self-certification.
This will bring up the proxy server, but it must be SSL-enabled to connect from `@prisma/client`.
So here are the steps to establish a local connection with SSL using docker-compose and `https-portal` with a self certificate.

Create `entrypoint.sh`.
```sh
#!/bin/sh

yarn install
exec "$@"
```

Create `docker-compose.yml`.
```yaml
version: '3'

services:
data-proxy:
image: node:18-bullseye-slim
working_dir: /app
ports:
- "3000:3000"
entrypoint: /app/entrypoint.sh
command: yarn pdp
environment:
DATABASE_URL: your DATABASE_URL
DATA_PROXY_API_KEY: your DATA_PROXY_API_KEY
PORT: "3000"
volumes:
- ./:/app:cached
- node_modules:/app/node_modules
https-portal:
image: steveltn/https-portal:1
ports:
- "443:443"
environment:
STAGE: local
DOMAINS: 'localhost -> http://data-proxy:3000'
volumes:
- ./ssl-certs:/var/lib/https-portal

volumes:
node_modules:
```
```bash
docker-compose up
```

Now you can connect with data proxy with `DATABASE_URL=prisma://localhost?api_key={DATA_PROXY_API_KEY}`.

## Deploy

Expand Down

1 comment on commit e7ce5ef

@vercel
Copy link

@vercel vercel bot commented on e7ce5ef Jun 24, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.