Spaces:
Sleeping
Sleeping
Scott Hiett
commited on
Commit
•
4ef9714
1
Parent(s):
a7891c4
Update documentation with a tldr
Browse files
README.md
CHANGED
@@ -1,4 +1,34 @@
|
|
1 |
# SRH: Serverless Redis HTTP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
A Redis connection pooler for serverless applications. This allows your serverless functions to talk to Redis via HTTP,
|
3 |
while also not having to worry about the Redis max connection limits.
|
4 |
|
|
|
1 |
# SRH: Serverless Redis HTTP
|
2 |
+
|
3 |
+
---
|
4 |
+
|
5 |
+
**TLDR: If you want to run a local Upstash-compatible HTTP layer in front of your Redis:**
|
6 |
+
|
7 |
+
0) Have a locally running Redis instance - in this example bound to the default port 6379
|
8 |
+
1) create a json file called tokens.json in a folder called srh-config (`srh-config/tokens.json`)
|
9 |
+
2) paste this in:
|
10 |
+
```json
|
11 |
+
{
|
12 |
+
"example_token": {
|
13 |
+
"srh_id": "some_unique_identifier",
|
14 |
+
"connection_string": "redis://localhost:6379",
|
15 |
+
"max_connections": 3
|
16 |
+
}
|
17 |
+
}
|
18 |
+
```
|
19 |
+
3) Run this command:
|
20 |
+
`docker run -it -d -p 8079:80 --name srh --mount type=bind,source=$(pwd)/srh-config/tokens.json,target=/app/srh-config/tokens.json hiett/serverless-redis-http:latest`
|
21 |
+
4) Set this as your Upstash configuration
|
22 |
+
```js
|
23 |
+
import {Redis} from '@upstash/redis';
|
24 |
+
|
25 |
+
export const redis = new Redis({
|
26 |
+
url: "http://localhost:8079",
|
27 |
+
token: "example_token",
|
28 |
+
});
|
29 |
+
```
|
30 |
+
---
|
31 |
+
|
32 |
A Redis connection pooler for serverless applications. This allows your serverless functions to talk to Redis via HTTP,
|
33 |
while also not having to worry about the Redis max connection limits.
|
34 |
|