CoolFace
Apppublic

ballsniffer246/redis-hf

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
App README

Redis on HuggingFace Spaces

Runs the official Redis Docker image on HuggingFace Spaces, listening on port 7860 (the port HF Spaces exposes externally).


Environment Variables

All settings are configured through environment variables. Set them in your Space's Settings → Repository secrets / Variables panel.

VariableDefaultDescription
REDIS_PORT7860Port Redis listens on (keep at 7860 for HF Spaces)
REDIS_BIND0.0.0.0Interface(s) to bind to
REDIS_LOGLEVELnoticedebug / verbose / notice / warning
REDIS_DATABASES16Number of logical databases
REDIS_MAXMEMORY256mbMemory cap (e.g. 512mb, 1gb)
REDIS_MAXMEMORY_POLICYallkeys-lruEviction policy
REDIS_USERNAME(empty)ACL username (Redis 6+) — requires REDIS_REQUIREPASS to also be set
REDIS_REQUIREPASS(empty)Password — leave empty to disable auth
REDIS_PROTECTED_MODEnoyes enforces auth / local-only access
REDIS_APPENDONLYnoEnable AOF persistence (yes / no)
REDIS_APPENDFSYNCeverysecalways / everysec / no
REDIS_SAVE(empty = disabled)RDB snapshot schedule, e.g. "3600 1 300 100"
REDIS_TIMEOUT0Close idle clients after N seconds (0 = off)
REDIS_TCP_KEEPALIVE300TCP keepalive in seconds
REDIS_VERSION (build arg)7.4Redis version tag (set at build time)

Connecting

bash
# From outside HuggingFace (replace with your Space URL)
redis-cli -h <your-space>.hf.space -p 7860

# With a password
# With username + password (ACL mode)
redis-cli -h <your-space>.hf.space -p 7860 --user $REDIS_USERNAME -a $REDIS_REQUIREPASS

# With password only
redis-cli -h <your-space>.hf.space -p 7860 -a $REDIS_REQUIREPASS

Local Development

bash
# Build & run locally (uses docker-compose)
docker compose up --build

# Or with Docker directly
docker build -t my-redis .
docker run -p 7860:7860 \
  -e REDIS_REQUIREPASS=mysecret \
  -e REDIS_MAXMEMORY=512mb \
  my-redis

Deploying to HuggingFace Spaces

  1. 1.Create a new Space → Docker SDK.
  2. 2.Push this repo's contents to the Space repository.
  3. 3.Set any desired environment variables in Settings → Variables and secrets.
  4. 4.The Space will build and start Redis automatically.
Note: HuggingFace Spaces free tier is ephemeral — data is lost on restart. For persistence, mount an external volume or use AOF/RDB with HF persistent storage.