Environment:AFK surf Open agent Redis
| Knowledge Sources | |
|---|---|
| Domains | Cache, Deployment, Self_Hosting |
| Last Updated | 2026-10-25 00:00 GMT |
Overview
Redis 7 (Alpine) run as a Docker container (`redis:7-alpine`), providing the cache and pub/sub layer for the Open-Agent self-hosting stack.
Description
This environment provides the cache service for the Self_Hosting_Deployment workflow. The compose file pulls the lightweight `redis:7-alpine` image, persists data to a bind-mounted `./cache` volume, and exposes a `redis-cli ping` healthcheck that the `app-init` and `app` services wait on.
Usage
Use this environment as a required dependency of Docker_Compose_Stack. It is the mandatory cache/coordination store for the Open-Agent application; both `app-init` and `app` connect to it via the `REDIS_SERVER_HOST` environment variable.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| Runtime | Docker Engine (see Docker_Engine) | Runs as a compose service; no host Redis install needed |
| Disk | 256MB+ free | For the `./cache` bind-mount volume |
| Memory | 64MB+ dedicated | Alpine Redis is lightweight |
Dependencies
System Packages
- Docker Engine (see Environment:AFK_surf_Open_agent_Docker_Engine)
Image References
- `redis:7-alpine` — Redis 7 community edition on Alpine Linux
Connection
- `REDIS_SERVER_HOST=redis` (the compose service name on the internal network)
Credentials
No password is configured by default (the `redis:7-alpine` image runs without `requirepass`). For production:
- Set a Redis password via a custom `redis.conf` or the `redis-server --requirepass <secret>` command, and inject it into the `app`/`app-init` environment.
- Never commit real production credentials to the compose file — use Docker secrets or an `.env` file.
Quick Install
# Start only the cache service (from the deploy directory):
docker compose up -d redis
# Verify health:
docker compose ps redis # should show "healthy"
docker compose exec redis redis-cli ping # should return PONG
Code Evidence
Redis service definition from `.docker/docker-compose.yml:17-26`:
redis:
image: redis:7-alpine
volumes:
- ./cache:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
REDIS_SERVER_HOST wiring for app services from `.docker/docker-compose.yml:33,49`:
app-init:
environment:
- REDIS_SERVER_HOST=redis
app:
environment:
- REDIS_SERVER_HOST=redis
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `NOAUTH Authentication required` | A password was set on Redis but `REDIS_SERVER_HOST`/password not passed to app | Provide the matching Redis URL/password in the app environment |
| `redis-cli ping` returns `LOADING` | Redis is still loading the RDB snapshot on boot | Wait a moment; the healthcheck retries up to 5 times |
| `Could not connect to redis at redis:6379` | `app` started before `redis` was healthy | The compose `depends_on: redis: condition: service_healthy` guard prevents this; if bypassed, start redis first |
| cache not persisting | `./cache` volume not writable | Ensure the directory is writable by the container user; check volume mount path |
Compatibility Notes
- External Redis: You may replace the compose `redis` service with an externally managed Redis; set `REDIS_SERVER_HOST` to the external host in the `app`/`app-init` environment.
- Redis 6/8: The stack pins Redis 7; Redis 8 should be compatible but is untested.
- Data persistence: The `./cache` bind mount (Redis `--appendonly` / RDB) is required to survive container recreation; without it, cache state is lost on `docker compose down`.