Redis

Redis is an open-source, in-memory data structure store that can be used as a database, cache, and message broker. This guide will walk you through how to use Redis with Spin.

Installation

To install Redis, you will be prompted to include the Redis service on install. You simply just need to select it.

Install Redis

What Spin does for you

If you select to install Laravel Horizon, Spin will automatically install Redis for you.

When you install Redis, Spin will set up a dedicated "Redis" service for you with persistent volumes so you do not lose data when updating your container.

Default Configuration

The database uses the official Redis image. The default configuration allows us to:

  • ✅ Quickly set up a database service with the exact version of our choice
  • ✅ Automatically create databases, users, and passwords (defined by the environment: variables in the docker-compose.*.yml files)

⚠️ Special Connection Notes

Since the database is running in a container, you will need to connect to the database using the container name. For example, if you have a Laravel application, you would use the following in your .env file:

Avoid special characters in database passwords as they can cause connection issues. Use long (20+ characters) alphanumeric passwords instead.Generate secure passwords →
Example .env File
REDIS_HOST=redis
REDIS_PASSWORD=redispassword

Usage

When you run spin up, the Redis container will create our database and start the Redis service.