Back to Lobehub

Configuring Upstash Redis Service

docs/self-hosting/advanced/redis/upstash.mdx

2.1.561.9 KB
Original Source

Configuring Upstash Redis Service

Upstash is a serverless Redis service that provides a free tier and pay-as-you-go pricing, making it ideal for LobeHub deployments.

Configuration Steps

<Steps> ### Create Redis Database on Upstash
  1. Visit Upstash Console and sign up
  2. Click Create Database and configure: name, region, enable TLS
  3. Copy the Redis URL (TCP connection, not REST API) from the database details page:

<Image alt={'Copy Redis URL from Upstash'} src={'https://hub-apac-1.lobeobjects.space/docs/43d110283ba816c0c2b45408e4f9d344.png'} />

Configure Environment Variables

shell
# Upstash Redis URL (copy from Upstash console)
REDIS_URL=rediss://default:[email protected]:6379

# Optional: Enable TLS (recommended for Upstash)
REDIS_TLS=1

# Optional: Set a prefix for Redis keys
REDIS_PREFIX=lobechat

<Callout type={'info'}> Upstash uses rediss:// (with double 's') for TLS connections. LobeHub supports this format automatically. </Callout> </Steps>

Environment Variables Overview

shell
# Upstash Redis Connection URL
REDIS_URL=rediss://default:[email protected]:6379

# Optional: Enable TLS encryption (recommended for Upstash)
REDIS_TLS=1

# Optional: Key prefix for data isolation
REDIS_PREFIX=lobechat

Notes

<Callout type={'tip'}> Upstash offers a generous free tier with 10,000 commands per day, which is sufficient for personal use and small deployments. </Callout>

<Callout type={'warning'}> Make sure to keep your Redis URL secure and never expose it in client-side code or public repositories. </Callout>

  • Free Tier Limits: 10,000 commands/day, 256MB storage
  • TLS Required: Upstash requires TLS connections, ensure REDIS_TLS=1 is set
  • Regional vs Global: Choose Global for better latency if your users are distributed worldwide