Skip to main content
Vercel For Frontend uses Redis to manage the build queue between the upload service and deploy service. The upload service pushes project IDs to the queue, and the deploy service pulls them for processing.

How Redis is Used

The platform uses Redis for asynchronous job processing:
  1. Upload Service (upload-service/src/utils/buildQueue.ts:11): Pushes project IDs to the build-queue using LPUSH
  2. Deploy Service (deploy-service/src/server.ts:13): Blocks and waits for new items using BLPOP
Redis acts as a reliable message broker, ensuring builds are processed in order and no projects are lost during high load.

Installation

1

Install via Homebrew

brew install redis
2

Start Redis Server

brew services start redis
Or run Redis in the foreground:
redis-server
3

Verify Installation

redis-cli ping
Expected output: PONG

Configuration

Default Configuration

The application uses default Redis connection settings:
// Default connection (localhost:6379)
const client = createClient()
This connects to:
  • Host: localhost (127.0.0.1)
  • Port: 6379
  • Database: 0
  • No authentication

Custom Configuration

If your Redis runs on a different host or port, update the connection:
const client = createClient({
  url: 'redis://username:password@hostname:6379'
})
If you modify connection settings, update both upload-service/src/utils/buildQueue.ts:3 and deploy-service/src/server.ts:5.

Production Configuration

For production deployments, configure Redis with:
redis.conf
# Bind to specific interface (or remove for all interfaces)
bind 127.0.0.1

# Require password
requirepass your-strong-password-here

# Enable persistence
appendonly yes
appendfsync everysec

# Set max memory
maxmemory 256mb
maxmemory-policy allkeys-lru

# Enable logging
loglevel notice
logfile /var/log/redis/redis-server.log
Restart Redis after changes:
sudo systemctl restart redis-server

Testing the Connection

1

Test Basic Connection

redis-cli ping
Expected: PONG
2

Test Queue Operations

Simulate the upload service pushing to queue:
redis-cli LPUSH build-queue "test-project-123"
Check queue length:
redis-cli LLEN build-queue
Simulate deploy service pulling from queue:
redis-cli BLPOP build-queue 5
Should return: 1) "build-queue" 2) "test-project-123"
3

Monitor Real-Time Activity

Watch Redis commands in real-time:
redis-cli MONITOR
Keep this running while your services operate to see queue activity.
4

Test from Node.js

Create a test script test-redis.js:
test-redis.js
import { createClient } from 'redis';

const client = createClient();

client.on('error', (err) => {
  console.error('Redis error:', err);
  process.exit(1);
});

client.on('connect', () => {
  console.log('✓ Connected to Redis');
});

await client.connect();

// Test push
await client.lPush('test-queue', 'test-value');
console.log('✓ Pushed to queue');

// Test pop
const value = await client.blPop('test-queue', 5);
console.log('✓ Popped from queue:', value);

await client.disconnect();
console.log('✓ All tests passed!');
Run with Bun:
bun test-redis.js

Monitoring and Management

Check Queue Status

# View queue length
redis-cli LLEN build-queue

# View queue contents without removing items
redis-cli LRANGE build-queue 0 -1

# View memory usage
redis-cli INFO memory

# View connected clients
redis-cli CLIENT LIST

Clear Queue

This will delete all pending builds. Use with caution!
redis-cli DEL build-queue

Backup and Restore

# Trigger immediate save
redis-cli SAVE

# Background save
redis-cli BGSAVE

# Copy snapshot
cp /var/lib/redis/dump.rdb /backup/dump.rdb

# Restore (stop Redis first)
sudo systemctl stop redis-server
cp /backup/dump.rdb /var/lib/redis/dump.rdb
sudo systemctl start redis-server

Troubleshooting

Error: Error: connect ECONNREFUSED 127.0.0.1:6379Solutions:
  • Check if Redis is running: redis-cli ping
  • Start Redis: sudo systemctl start redis-server
  • Check Redis logs: sudo tail -f /var/log/redis/redis-server.log
  • Verify port: sudo lsof -i :6379
Error: NOAUTH Authentication requiredSolutions:
  • Set password in connection:
    const client = createClient({
      password: 'your-password'
    })
    
  • Or disable auth in redis.conf (development only):
    # requirepass your-password
    
Symptoms: Items stay in queue, builds don’t startSolutions:
  • Check deploy service is running and connected
  • Verify queue has items: redis-cli LLEN build-queue
  • Check for errors in deploy service logs
  • Ensure BLPOP timeout is set correctly (0 = block forever)
Error: OOM command not allowed when used memory > 'maxmemory'Solutions:
  • Increase max memory in redis.conf:
    maxmemory 512mb
    
  • Set eviction policy:
    maxmemory-policy allkeys-lru
    
  • Clear old data: redis-cli FLUSHDB
Symptoms: Service stops unexpectedlySolutions:
  • Check system logs: sudo journalctl -u redis-server -n 100
  • Verify disk space: df -h
  • Check Redis logs: /var/log/redis/redis-server.log
  • Increase system limits in /etc/systemd/system/redis.service:
    [Service]
    LimitNOFILE=65535
    

Security Best Practices

Enable Authentication

redis.conf
requirepass your-strong-password
Update connection:
createClient({ password: 'your-strong-password' })

Bind to Localhost

redis.conf
bind 127.0.0.1 ::1
Only allow local connections unless needed.

Rename Dangerous Commands

redis.conf
rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command CONFIG "CONFIG-SECRET-NAME"

Use TLS Encryption

redis.conf
tls-port 6380
tls-cert-file /path/to/redis.crt
tls-key-file /path/to/redis.key
tls-ca-cert-file /path/to/ca.crt

Redis Cloud Alternatives

For production, consider managed Redis services:
  • AWS ElastiCache: Fully managed Redis on AWS
  • Redis Cloud: Official cloud offering from Redis Labs
  • DigitalOcean Managed Redis: Simple, affordable option
  • Azure Cache for Redis: Integrated with Azure services
  • Google Cloud Memorystore: Redis on Google Cloud
Update the connection URL in your services to point to the managed Redis endpoint.

Next Steps

Docker Setup

Install Docker for running project builds

Environment Variables

Configure all required environment variables

Build docs developers (and LLMs) love