Home → Installation and Upgrade Manual → HelpSpot 5 Installation → Optional Redis Server Configuration
1.11. Optional Redis Server Configuration
This guide provides step-by-step instructions for manually setting up and configuring Redis for HelpSpot usage. Redis is not generally required for running HelpSpot but utilizing Redis can solve performance issues on some large HelpSpot installations. This is based on an Ubuntu setup of HelpSpot. Other distributions will need slightly different steps.
Overview
This guide will walk you through:
- Installing Redis server
- Installing the PHP Redis extension
- Configuring Redis with AOF persistence and security settings
- Configuring HelpSpot to use Redis for caching, queues, and sessions
- Verifying the setup is working correctly
Installation
Step 1: Install Redis Server
Install Redis server from the default Ubuntu repositories:
# Update package lists
sudo apt-get update
# Install Redis server
sudo apt-get install -y redis-server
After installation, Redis will be automatically started. You can verify it's running:
# Check Redis service status
systemctl status redis
# Test Redis is responding
redis-cli ping
# Should return: PONG
Step 2: Install PHP Redis Extension
HelpSpot requires the PHP Redis extension to communicate with Redis. Install it for your PHP version:
# For PHP 8.3 (adjust version number if using a different PHP version)
sudo apt-get install -y php8.3-redis
# Restart PHP-FPM to load the extension
sudo systemctl restart php8.3-fpm
Verify the extension is installed:
php -m | grep redis
# Should output: redis
If you're using a different PHP version, replace php8.3 with your version (e.g., php8.2, php8.1, etc.).
Configuration Steps
Now that Redis is installed, we'll configure it for HelpSpot usage.
1. Stop Redis Service
Stop Redis before making configuration changes:
sudo systemctl stop redis
2. Configure Redis Settings
Edit the Redis configuration file at /etc/redis/redis.conf to enable AOF persistence and ensure proper security settings.
Key Configuration Changes:
Edit /etc/redis/redis.conf and verify/set these values:
# Security - bind to localhost only
bind 127.0.0.1
# Persistence - enable AOF for better durability
appendonly yes
appendfsync everysec
# Disable RDB snapshots (comment out all save directives)
# save 900 1
# save 300 10
# save 60 10000
3. Start Redis Service
Start Redis and enable it to start on boot:
# Start Redis
sudo systemctl start redis
# Enable Redis to start on boot
sudo systemctl enable redis
# Verify it's running
sudo systemctl status redis
Configure HelpSpot to Use Redis
After Redis is installed and running, configure HelpSpot to use Redis for caching and queues.
Important Notes Before Configuration
⚠️ Session Driver Warning: Changing SESSION_DRIVER to Redis will immediately log out all users. Consider:
- Enabling this during a maintenance window or low-traffic period
- Notifying users in advance
- Enabling cache and queue drivers first, then sessions separately
⚠️ Queue Connection Warning: Changing to the redis queue driver from the database based queue driver will orphan any queue jobs that are currently in the queue. We'd recommend doing this during a maintenance window.
💡 Incremental Enablement: You can enable these drivers independently:
- Start with:
CACHE_DRIVER=redis(safest, immediate performance boost) - Then add:
QUEUE_CONNECTION=redis(improves background job processing) - Optionally add:
SESSION_DRIVER=redis(be careful with implementing, this will log out all current users)
Configuration Steps
Edit the HelpSpot .env file (typically located at /var/www/helpspot/.env):
sudo nano /var/www/helpspot/.env
Add or update these lines (choose which drivers to enable based on your needs):
# Recommended: Enable cache driver (safe, no user impact)
CACHE_DRIVER=redis
# Recommended: Enable queue driver (see notes above)
QUEUE_CONNECTION=redis
# Optional: Enable session driver (will log out all users!)
SESSION_DRIVER=redis
# Redis connection settings (optional - these are the defaults)
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=null
REDIS_DB=0
Environment Variable Descriptions:
Cache & Queue (Safe to enable anytime):
CACHE_DRIVER=redis- Uses Redis for application cache (recommended for performance)QUEUE_CONNECTION=redis- Uses Redis for job queue processing
Sessions (Logs out all users when enabled):
SESSION_DRIVER=redis- Uses Redis for user sessions (optional, defaults to file-based sessions)
Optional Connection Settings (Laravel defaults shown):
REDIS_HOST=127.0.0.1- Redis server host (default: localhost)REDIS_PORT=6379- Redis server port (default: 6379)REDIS_PASSWORD=null- Redis password (default: no password)REDIS_DB=0- Redis database number (default: 0)
Note: If using the default Redis configuration from this guide (localhost, port 6379, no password), you don't need to explicitly set the REDIS_* variables - Laravel will use these defaults automatically.
After making changes to the .env file, clear the application cache:
cd /var/www/helpspot
sudo -u www-data php artisan config:clear
sudo -u www-data php artisan cache:clear
If you're using Supervisor to manage HelpSpot queue workers, restart them to pick up the changes:
sudo supervisorctl restart all
Important Notes
-
Data Directory: Redis will use the default
/var/lib/redisdirectory for data storage -
Persistence Strategy: This configuration uses AOF (Append-Only File) persistence with
everysecfsync, which provides good durability (loses at most 1 second of data) while maintaining performance -
Security: Redis is bound to localhost only (127.0.0.1), making it inaccessible from external networks. This is the recommended configuration for HelpSpot.
-
No RDB Snapshots: RDB snapshot persistence is disabled to rely solely on AOF for persistence, which provides better durability guarantees
-
HelpSpot Integration: HelpSpot can use Redis for:
- Caching - Speeds up frequent database queries and application data
- Queue Processing - Background jobs for email sending, notifications, etc.
- Sessions (optional) - User session storage for better scalability
-
Redis Connection: HelpSpot connects to Redis using the default host (127.0.0.1) and port (6379). No additional Redis configuration is needed beyond what's in this guide.
Troubleshooting
Redis fails to start
Check the logs:
sudo journalctl -u redis -n 50 --no-pager
sudo tail -100 /var/log/redis/redis-server.log
Common issues:
- Configuration syntax errors in
/etc/redis/redis.conf - Port 6379 already in use by another process
- Insufficient permissions on data directory
Permission denied errors
Ensure the data directory has correct ownership:
sudo chown -R redis:redis /var/lib/redis
sudo chmod 750 /var/lib/redis
Configuration not taking effect
After making configuration changes, always restart Redis:
sudo systemctl restart redis
You can verify current running configuration with:
redis-cli CONFIG GET '*' | less
HelpSpot not connecting to Redis
If HelpSpot isn't using Redis after configuration:
-
Verify Redis is running and accessible:
redis-cli ping # Should return: PONG -
Check that the
.envfile has the correct settings:grep -E "CACHE_DRIVER|QUEUE_CONNECTION|SESSION_DRIVER" /var/www/helpspot/.env -
Check HelpSpot logs for Redis connection errors:
sudo tail -100 /var/www/helpspot/storage/logs/helpspot.log -
Verify the PHP Redis extension is installed:
php -m | grep redis # Should show: redis
If the Redis extension is not installed:
sudo apt-get install -y php-redis
sudo systemctl restart php8.3-fpm