Replace DragonflyDB with Valkey throughout codebase
- Update all DragonflyDB references to Valkey in README and docker-compose.yml - Update install instructions to use Valkey package repository and .deb download - Update configuration paths from /etc/dragonfly/ to /etc/valkey/ - Update version requirement to Valkey 8.x+ (successor to Redis OSS)
This commit is contained in:
1 parent
cea88eaa57
commit
75eada7a59
2 files changed
+25
-18
No files matched your search
@@ -16,7 +16,7 @@ Features a premium animated homepage (typewriter hero, floating orbs, scroll cou
|
|||||||
| yarn | >= 4.x | Supported alternative |
|
| yarn | >= 4.x | Supported alternative |
|
||||||
| MySQL / MariaDB | 8.0+ / 10.6+ | Shared with the emulator |
|
| MySQL / MariaDB | 8.0+ / 10.6+ | Shared with the emulator |
|
||||||
| Docker | 24+ | Optional — for containerized deployment |
|
| Docker | 24+ | Optional — for containerized deployment |
|
||||||
| DragonflyDB | 1.x+ | Optional — caching, rate limiting, SSE |
|
| Valkey | 8.x+ | Optional — caching, rate limiting, SSE |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ HOTEL_NAME=YourHotel
|
|||||||
APP_URL=http://localhost:3002
|
APP_URL=http://localhost:3002
|
||||||
```
|
```
|
||||||
|
|
||||||
See `.env.example` for all optional variables (RCON, email, DragonflyDB, OAuth, PayPal, etc.).
|
See `.env.example` for all optional variables (RCON, email, Valkey, OAuth, PayPal, etc.).
|
||||||
|
|
||||||
### 4. Run CMS Migrations
|
### 4. Run CMS Migrations
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ docker compose build --build-arg RUN_USER=1000
|
|||||||
|
|
||||||
### Networking
|
### Networking
|
||||||
|
|
||||||
The CMS container runs with `network_mode: host`. This lets the existing `127.0.0.1` references in `.env` keep working against host services — MariaDB (`3306`), DragonflyDB/Redis (`6379`), the emulator RCON/API (`3003`/`3001`) and the avatar imager — without re-writing any environment variables. The container consequently listens **directly on the host's port 3002**, so stop any previous host-side CMS (e.g. `pm2 stop next`) that occupies that port before starting it.
|
The CMS container runs with `network_mode: host`. This lets the existing `127.0.0.1` references in `.env` keep working against host services — MariaDB (`3306`), Valkey/Redis (`6379`), the emulator RCON/API (`3003`/`3001`) and the avatar imager — without re-writing any environment variables. The container consequently listens **directly on the host's port 3002**, so stop any previous host-side CMS (e.g. `pm2 stop next`) that occupies that port before starting it.
|
||||||
|
|
||||||
The **build** also runs on the host network (`build.network: host`) because this host disables Docker iptables (`/etc/docker/daemon.json`: `"iptables": false`), which would otherwise leave build containers without outbound NAT/DNS when fetching packages.
|
The **build** also runs on the host network (`build.network: host`) because this host disables Docker iptables (`/etc/docker/daemon.json`: `"iptables": false`), which would otherwise leave build containers without outbound NAT/DNS when fetching packages.
|
||||||
|
|
||||||
@@ -507,28 +507,35 @@ The script sets `FOREIGN_KEY_CHECKS=0` for the session and is safe to interrupt:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## DragonflyDB (Caching, Rate Limiting, SSE)
|
## Valkey (Caching, Rate Limiting, SSE)
|
||||||
|
|
||||||
DragonflyDB is a drop-in, Redis-compatible in-memory datastore. The CMS connects to it via `REDIS_URL` using the `ioredis` client. It is optional: without it the CMS falls back to in-process memory.
|
Valkey is a drop-in, Redis-compatible open-source in-memory datastore (successor to Redis OSS). The CMS connects to it via `REDIS_URL` using the `ioredis` client. It is optional: without it the CMS falls back to in-memory memory.
|
||||||
|
|
||||||
### Install (Ubuntu/Debian)
|
### Install (Ubuntu/Debian)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL -o /tmp/dragonfly_amd64.deb \
|
# Option 1: Package repository (recommended)
|
||||||
https://github.com/dragonflydb/dragonfly/releases/download/v1.40.1/dragonfly_amd64.deb
|
curl -fsSL https://packages.valkey.io/valkey-pgp-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/valkey-archive-keyring.gpg
|
||||||
apt-get install -y /tmp/dragonfly_amd64.deb
|
echo "deb [signed-by=/usr/share/keyrings/valkey-archive-keyring.gpg] https://packages.valkey.io/apt $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/valkey.list
|
||||||
systemctl enable --now dragonfly
|
apt-get update && apt-get install -y valkey
|
||||||
|
|
||||||
|
# Option 2: Direct .deb download
|
||||||
|
curl -fsSL -o /tmp/valkey_amd64.deb \
|
||||||
|
https://github.com/valkey-io/valkey/releases/download/8.1.1/valkey_8.1.1-1_amd64.deb
|
||||||
|
apt-get install -y /tmp/valkey_amd64.deb
|
||||||
|
|
||||||
|
systemctl enable --now valkey
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure
|
### Configure
|
||||||
|
|
||||||
Edit `/etc/dragonfly/dragonfly.conf`:
|
Edit `/etc/valkey/valkey.conf`:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
--bind=127.0.0.1
|
bind 127.0.0.1
|
||||||
--port=6379
|
port 6379
|
||||||
--maxmemory=2gb
|
maxmemory 2gb
|
||||||
--version_check=false
|
maxmemory-policy allkeys-lru
|
||||||
```
|
```
|
||||||
|
|
||||||
### Point the CMS at it
|
### Point the CMS at it
|
||||||
@@ -734,7 +741,7 @@ For bulk-written tables (game-data JSON, imports) a containerized **`mariadb-tur
|
|||||||
|
|
||||||
### 4. Cache layers (Redis + CDN)
|
### 4. Cache layers (Redis + CDN)
|
||||||
|
|
||||||
The CMS caches through `cached()` / `cachedQuery()` (`src/lib/cache.ts`): an in-memory fast path with a Redis (DragonflyDB-compatible) fallback and single-flight protection against cache stampedes. Public API routes (home, leaderboard, online count, radio, photos, …) fill Redis keys per route; verify with `redis-cli DBSIZE`. With Cloudflare in front, static and `/imaging/*` responses are additionally cached edge-side (`cf-cache-status`), cutting origin load further.
|
The CMS caches through `cached()` / `cachedQuery()` (`src/lib/cache.ts`): an in-memory fast path with a Redis (Valkey-compatible) fallback and single-flight protection against cache stampedes. Public API routes (home, leaderboard, online count, radio, photos, …) fill Redis keys per route; verify with `redis-cli DBSIZE`. With Cloudflare in front, static and `/imaging/*` responses are additionally cached edge-side (`cf-cache-status`), cutting origin load further.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -791,7 +798,7 @@ pm2 restart next
|
|||||||
| **View Transitions API** | Native browser transitions between page navigations |
|
| **View Transitions API** | Native browser transitions between page navigations |
|
||||||
| **Lenis Smooth Scroll** | Fluid, customizable scrolling |
|
| **Lenis Smooth Scroll** | Fluid, customizable scrolling |
|
||||||
| **Server-Sent Events** | Real-time radio now-playing & listeners via SSE |
|
| **Server-Sent Events** | Real-time radio now-playing & listeners via SSE |
|
||||||
| **DragonflyDB Caching** | Caches API responses up to 30s in DragonflyDB |
|
| **Valkey Caching** | Caches API responses up to 30s in Valkey |
|
||||||
| **RCON (TCP Socket)** | Live commands to the emulator (credits, badges, kick, ban) |
|
| **RCON (TCP Socket)** | Live commands to the emulator (credits, badges, kick, ban) |
|
||||||
| **Streaming & Suspense** | Next.js App Router streaming for fast page loads |
|
| **Streaming & Suspense** | Next.js App Router streaming for fast page loads |
|
||||||
| **Automatic Image Optimization** | `next/image` with Sharp for resizing and WebP/AVIF |
|
| **Automatic Image Optimization** | `next/image` with Sharp for resizing and WebP/AVIF |
|
||||||
@@ -826,7 +833,7 @@ pm2 restart next
|
|||||||
│ │ ├── auth/ # NextAuth, password hashing, 2FA, SSO tickets
|
│ │ ├── auth/ # NextAuth, password hashing, 2FA, SSO tickets
|
||||||
│ │ ├── services/ # RCON, email, currency, PayPal, alerts
|
│ │ ├── services/ # RCON, email, currency, PayPal, alerts
|
||||||
│ │ ├── db.ts # Drizzle connection singleton (runtime)
|
│ │ ├── db.ts # Drizzle connection singleton (runtime)
|
||||||
│ │ ├── redis.ts # Cache client (ioredis → DragonflyDB)
|
│ │ ├── redis.ts # Cache client (ioredis → Valkey)
|
||||||
│ │ └── motion.ts # Framer Motion animation variants
|
│ │ └── motion.ts # Framer Motion animation variants
|
||||||
│ ├── messages/ # i18n translations (en, nl, de, fr, es, it, pt, da, no, sv)
|
│ ├── messages/ # i18n translations (en, nl, de, fr, es, it, pt, da, no, sv)
|
||||||
│ └── env.ts # Zod-validated environment schema
|
│ └── env.ts # Zod-validated environment schema
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ services:
|
|||||||
network: host
|
network: host
|
||||||
container_name: epicnext-cms
|
container_name: epicnext-cms
|
||||||
# Runs on the host network so existing 127.0.0.1 refs in .env keep working:
|
# Runs on the host network so existing 127.0.0.1 refs in .env keep working:
|
||||||
# MariaDB (3306), DragonflyDB/Redis (6379), emulator RCON (3003) + API (3001),
|
# MariaDB (3306), Valkey/Redis (6379), emulator RCON (3003) + API (3001),
|
||||||
# and the imaging renderer (8082). The container then listens directly on the
|
# and the imaging renderer (8082). The container then listens directly on the
|
||||||
# host's 3002 (the same port the current host-side CMS uses).
|
# host's 3002 (the same port the current host-side CMS uses).
|
||||||
# NOTE: stop the host CMS (next-server on 3002) first, otherwise the port is taken.
|
# NOTE: stop the host CMS (next-server on 3002) first, otherwise the port is taken.
|
||||||
|
|||||||
Reference in new issue
Block a user