Installation
Prerequisites
Before installing Redix, make sure you have:
- A working FiveM or RedM server
- Docker installed (see instructions below)
- Access to the
server.cfgfile - Access to the server
resourcesfolder
Installing Docker
Docker is required to run Redis Stack Server. Choose the installation method that best suits your needs:
Docker Desktop (Recommended for beginners)
Docker Desktop provides a graphical interface and is easier to manage:
- Download Docker Desktop for Windows
- Download Docker Desktop for Mac
- Download Docker Desktop for Linux
Docker Desktop
Docker Desktop includes Docker Engine, Docker CLI, Docker Compose, and a graphical interface to manage containers easily.
Docker Engine (CLI only)
For servers or if you prefer the command line:
-
Ubuntu:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh -
Debian:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh -
CentOS/RHEL:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh
For other distributions, visit the official Docker Engine installation guide.
Verify Docker Installation
After installation, verify that Docker is working correctly:
docker --version
docker run hello-worldYou should see the Docker version and a "Hello from Docker!" message.
Docker Installation
If you're new to Docker, we recommend starting with Docker Desktop for a better experience. For production servers, Docker Engine is lighter and more suitable.
Installation Guide
Install Redis Server
Redix requires Redis with JSON module support. You can choose between:
- Redis Stack Server: Includes RedisJSON modules without the dashboard. Recommended for most use cases - lighter and production-ready.
- Redis Stack: Complete version with RedisJSON modules + Redis Insight dashboard (on port 8001). Heavier but useful for development and debugging.
- Redis standard: Lightest but lacks JSON modules. Only suitable if you don't use JSON operations.
Option A: Installation with Docker
Recommended: Redis Stack Server (without dashboard)
Docker is the simplest and most reliable method. This is the recommended version - includes JSON support without the dashboard overhead.
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latestThis version includes all necessary modules (RedisJSON) without the web interface, making it lighter and suitable for production.
Option A2: Redis Stack (with dashboard)
If you want the Redis Insight web dashboard for development:
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latestRedis Insight Dashboard
This version includes Redis Insight on port 8001, a web interface to view and manage Redis data in real-time. Access it via http://localhost:8001.
Option A3: Standard Redis (not recommended)
Only if you don't need JSON operations:
docker run -d --name redis -p 6379:6379 redis:latest⚠️ This version does not support JSONSet, JSONGet and similar operations.
Docker Compose
For Redis Stack Server (recommended):
version: "3.8"
services:
redis-stack-server:
image: redis/redis-stack-server:latest
container_name: redis-stack-server
ports:
- "6379:6379"
environment:
- REDIS_ARGS=--requirepass yourSecurePassword
volumes:
- redis-data:/data
restart: unless-stopped
volumes:
redis-data:Then start with:
docker-compose up -dChoosing the Right Version
- Redis Stack Server (recommended): Includes JSON modules, lightweight, production-ready
- Redis Stack: Same as Server + web dashboard for debugging (heavier)
- Standard Redis: No JSON support, only use if you avoid all JSON operations
Verify Redis Installation
Before proceeding, verify that Redis is running:
# Test the connection
docker exec -it redis-stack-server redis-cli pingYou should receive the response: PONG
To verify that RedisJSON is available:
docker exec -it redis-stack-server redis-cli
127.0.0.1:6379> JSON.SET test $ '{"hello":"world"}'
127.0.0.1:6379> JSON.GET testYou should see: "{\"hello\":\"world\"}"
Download and Install Redix
Method 1: Download Release
- Go to the Redix GitHub releases page
- Download the latest version
- Extract the contents to your server
resourcesfolder - You should have the structure:
resources/redix/fxmanifest.lua
Method 2: Build from Source
If you prefer to compile from source:
# Clone the repository
git clone https://github.com/CrystalTwoK/redix.git
cd redix
# Install dependencies
npm install
# Build
npm run build
# The result will be in dist/redix/
# Copy this folder to your resources folderConfigure server.cfg
Add the following lines to your server.cfg file:
Basic Configuration
# Redis Connection
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:db "0"
# Start Redix
ensure redixConfiguration with Password
If you set a password for Redis:
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:password "yourSecurePassword"
set redix:db "0"
ensure redixComplete Configuration
# Connection
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:password "yourSecurePassword"
set redix:db "0"
# Advanced Options
set redix:username ""
set redix:family "4"
set redix:connectTimeout "10000"
set redix:keepAlive "30000"
set redix:lazyConnect "false"
set redix:retryEnabled "true"
set redix:maxRetries "3"
# Logging
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "true"
# Localization
set redix:locale "en"
# Testing
set redix:testOnStartup "false"
# Start Redix
ensure redixStartup Order
Ensure that ensure redix is present before the resources that use it in
your server.cfg
Verify Installation
Start your FiveM or RedM server and check the console. You should see:
...
[Redix] @@@@@@@@@@@@@@@ @@@@@
[Redix] @@@@@@ @@@@@ @@@@ @@@@@@ @@@@
[Redix] @@@@@ @@@@@@ @@@@@ @@@@@@ @@@ @
[Redix] @@@ @@@@@@ @@@@@ @@@@@ @@@@@@@@@@ @@@@@ @@@@@ @@@
[Redix] @@@@@@ @@@@@@ @@@@@ @@@@ @@@@@ @@@@@@ @@@@@@ @@@@@@ @@@
[Redix] @@@@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@@@@@
[Redix] @@@@@ @@@@ @@@@@ @@@@ @@@@@ @@@@@ @@@@@@ @@@@@@@@@
[Redix] @@@@@@@@@ @@@@@@@@@ @@@@@@ @@@@@ @@@@@ @@@ @@@@@ @@
[Redix] @@@@@ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@@ @@ @@@@@ @@
[Redix] @@@@@ @@@@@ @@@@@ @@@@@ @@@@@@ @@@@@@ @@ @@@@@@@ @@
[Redix] @@@@ @@@@@@@ @@@@@ @@ @@@@@@@@@@@@@@@@@@@@ @@@ @@@ @@@@@@@@
[Redix] @@@@ @@@@@@@@ @@@@@@@@ @@@@ @@@@@ @@@@@@ @@@ @@@@@
[Redix] @@@@@@@ vX.X.X
[Redix]
[Redix] Redis Wrapper for FiveM/RedM
...Manual Test
You can test the connection with the server console command:
-- In your resource server.lua file
local Redix = exports.redix:GetInterface()
-- Connection test
exports.redix:TestConnection()Or enable automatic tests on startup:
set redix:testOnStartup "true"This will run a complete test suite on server startup, verifying all operations.
First Use
Now you are ready to use Redix! In any server-side resource:
local Redix = exports.redix:GetInterface()
-- Save data
Redix.Save('test:key', {message = 'Redix works!'})
-- Retrieve data
Redix.Get('test:key', function(err, data)
if not err and data then
print('Message:', data.message)
end
end)Troubleshooting
Redis Does Not Connect
Error: Failed to connect to Redis
Solutions:
- Verify that the Docker container is running:
docker ps - Check that the host and port are correct in
server.cfg - If Redis is on a remote server, check firewall rules
- Verify that the password is correct if one is set
JSON Modules Not Available
Error: ERR unknown command 'JSON.SET'
Solution: You are using standard Redis instead of Redis Stack Server. You must use the redis/redis-stack-server:latest or redis/redis-stack:latest image instead of redis:latest.
Redix Does Not Start
Problem: No startup message in console
Solutions:
- Verify that the resource path is correct
- Check that
fxmanifest.luais present in the redix folder - Ensure that
ensure redixis inserver.cfg - Check server logs for errors
Performance Issues
If you notice latency:
- Verify that Redis is local or on a fast network
- Increase
connectTimeoutif the network is slow - Reduce
keepAlivefor more frequent connections
Production Configuration
For a production server, consider:
1. Data Persistence
Configure Redis to save data to disk:
docker run -d \
--name redis-stack-server \
-p 6379:6379 \
-v redis-data:/data \
redis/redis-stack-server:latest \
redis-server --save 60 1 --appendonly yes2. Strong Password
Always set a strong password in production:
docker run -d \
--name redis-stack-server \
-p 6379:6379 \
redis/redis-stack-server:latest \
redis-server --requirepass "ComplexPassword123!"3. Network Limitations
If possible, expose Redis only on localhost and not on the internet:
docker run -d \
--name redis-stack-server \
-p 127.0.0.1:6379:6379 \
redis/redis-stack-server:latest4. Automatic Backups
Configure periodic backups of Redis data:
docker run -d \
--name redis-stack-server \
-p 6379:6379 \
-v redis-data:/data \
-v /path/to/backup:/backup \
redis/redis-stack-server:latestCompleted!
You have now successfully installed and configured Redis Stack Server and Redix! You are ready to start developing.