Redis
Curated name redis. Adds a Redis 8 service to the workbench in compose mode, on
the default port with a readiness healthcheck.
What it’s for
Section titled “What it’s for”An in-memory key-value store for local development: caching, sessions, rate limits, queues, pub/sub. It runs without auth, matching a typical local setup.
Add it
Section titled “Add it”At init, or to an existing workbench:
monoceros init acme --with-services=redismonoceros add-service acme redisNeed a second instance (say one for cache, one for a queue)? Add it again under
a different name with --as - each gets its own host, data dir, and connection
env:
monoceros add-service acme redis --as=queueRemove it
Section titled “Remove it”monoceros remove-service acme redisOr delete the service’s block from acme.yml by hand and re-run
monoceros apply acme - the yml is the source of truth. (Its data volume monoceros-acme-data-redis is removed with the workbench on
monoceros remove, which backs it up first.)
The yml entry
Section titled “The yml entry”services: - name: redis # host name in the container + data dir name image: redis:8 port: 6379 # in-container port (feeds `monoceros tunnel`) volumes: - data:/data # the service's own Docker volume restart: unless-stopped healthcheck: # workspace waits for service_healthy test: [CMD, redis-cli, ping] interval: 10s timeout: 5s retries: 5 connectionEnv: # → the workspace env vars below URL: redis://${host}:${port} HOST: ${host} PORT: ${port}There are no credentials to seed - the default service has no auth (add a password via the service config if you need one).
What your code sees
Section titled “What your code sees”Monoceros injects a connection env into the workspace container, prefixed with the service name:
| Variable | Value (defaults) |
|---|---|
REDIS_URL | redis://redis:6379 |
REDIS_HOST | redis |
REDIS_PORT | 6379 |
The prefix is the service name, uppercased, so a second instance added with
--as=queue gets QUEUE_URL, … and never collides.