Using Redis
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
As many applications depend on Redis as their key-value store, you eventually need it in order for your tests to run. Below you are guided how to do this with the Docker and Shell executors of GitLab Runner.
Use Redis with the Docker executor
If you are using GitLab Runner with the Docker executor you basically have everything set up already.
First, in your .gitlab-ci.yml
add:
services:
- redis:latest
Then you need to configure your application to use the Redis database, for example:
Host: redis
And that’s it. Redis is now available to be used within your testing framework.
You can also use any other Docker image available on Docker Hub.
For example, to use Redis 6.0 the service becomes redis:6.0
.
Use Redis with the Shell executor
Redis can also be used on manually configured servers that are using GitLab Runner with the Shell executor.
In your build machine install the Redis server:
sudo apt-get install redis-server
Verify that you can connect to the server with the gitlab-runner
user:
# Try connecting the Redis server
sudo -u gitlab-runner -H redis-cli
# Quit the session
127.0.0.1:6379> quit
Finally, configure your application to use the database, for example:
Host: localhost
Example project
We have set up an Example Redis Project for your convenience that runs on GitLab.com using our publicly available instance runners.
Want to hack on it? Fork it, commit and push your changes. Within a few moments the changes are picked by a public runner and the job begins.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support