File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 11# 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+
232A Redis connection pooler for serverless applications. This allows your serverless functions to talk to Redis via HTTP,
333while also not having to worry about the Redis max connection limits.
434
You can’t perform that action at this time.
0 commit comments