-
Notifications
You must be signed in to change notification settings - Fork 0
Add Valkey (GLIDE) connection configuration #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 13.x
Are you sure you want to change the base?
Changes from all commits
9a86031
895126b
6a39edc
5b8ca51
c15392e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,4 +191,124 @@ | |
|
|
||
| ], | ||
|
|
||
| /* | ||
| |-------------------------------------------------------------------------- | ||
| | Valkey Databases | ||
| |-------------------------------------------------------------------------- | ||
| | | ||
| | Valkey is a BSD-licensed, high performance key-value store that is fully | ||
| | wire-compatible with Redis. Each option falls back to its "REDIS_*" | ||
| | equivalent, so existing Redis applications may adopt Valkey without any | ||
| | additional configuration by setting the "VALKEY_FROM_REDIS" option. | ||
| | | ||
| | The GLIDE client also exposes a handful of Valkey-native options: | ||
| | | ||
| | VALKEY_READ_FROM primary, prefer_replica, az_affinity, any | ||
| | VALKEY_TLS true to enable TLS/SSL for every connection | ||
| | VALKEY_AZ_AFFINITY availability zone used when read_from is "az_affinity" | ||
| | | ||
| | Further GLIDE capabilities (IAM auth, reconnect strategy, client-side | ||
| | caching, compression, clustering, and OpenTelemetry) may be enabled via | ||
| | the commented options shown below. | ||
| | | ||
| */ | ||
|
|
||
| 'valkey' => [ | ||
|
|
||
| 'from_redis' => env('VALKEY_FROM_REDIS', false), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand what this config does or what is it intended for? |
||
|
|
||
| 'client' => env('VALKEY_CLIENT', 'valkey_glide'), | ||
|
|
||
| 'options' => [ | ||
| 'cluster' => env('VALKEY_CLUSTER', env('REDIS_CLUSTER', 'valkey')), | ||
| 'prefix' => env('VALKEY_PREFIX', env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-')), | ||
| 'persistent' => env('VALKEY_PERSISTENT', env('REDIS_PERSISTENT', false)), | ||
| 'use_tls' => env('VALKEY_TLS', false), | ||
| 'read_from' => env('VALKEY_READ_FROM', 'primary'), | ||
| 'az_affinity' => env('VALKEY_AZ_AFFINITY'), | ||
| ], | ||
|
|
||
| 'default' => [ | ||
| 'url' => env('VALKEY_URL', env('REDIS_URL')), | ||
| 'host' => env('VALKEY_HOST', env('REDIS_HOST', '127.0.0.1')), | ||
| 'username' => env('VALKEY_USERNAME', env('REDIS_USERNAME')), | ||
| 'password' => env('VALKEY_PASSWORD', env('REDIS_PASSWORD')), | ||
| 'port' => env('VALKEY_PORT', env('REDIS_PORT', '6379')), | ||
| 'database' => env('VALKEY_DB', env('REDIS_DB', '0')), | ||
| 'max_retries' => env('VALKEY_MAX_RETRIES', env('REDIS_MAX_RETRIES', 3)), | ||
| 'backoff_algorithm' => env('VALKEY_BACKOFF_ALGORITHM', env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter')), | ||
| 'backoff_base' => env('VALKEY_BACKOFF_BASE', env('REDIS_BACKOFF_BASE', 100)), | ||
| 'backoff_cap' => env('VALKEY_BACKOFF_CAP', env('REDIS_BACKOFF_CAP', 1000)), | ||
| ], | ||
|
|
||
| 'cache' => [ | ||
| 'url' => env('VALKEY_URL', env('REDIS_URL')), | ||
| 'host' => env('VALKEY_HOST', env('REDIS_HOST', '127.0.0.1')), | ||
| 'username' => env('VALKEY_USERNAME', env('REDIS_USERNAME')), | ||
| 'password' => env('VALKEY_PASSWORD', env('REDIS_PASSWORD')), | ||
| 'port' => env('VALKEY_PORT', env('REDIS_PORT', '6379')), | ||
| 'database' => env('VALKEY_CACHE_DB', env('REDIS_CACHE_DB', '1')), | ||
| 'max_retries' => env('VALKEY_MAX_RETRIES', env('REDIS_MAX_RETRIES', 3)), | ||
| 'backoff_algorithm' => env('VALKEY_BACKOFF_ALGORITHM', env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter')), | ||
| 'backoff_base' => env('VALKEY_BACKOFF_BASE', env('REDIS_BACKOFF_BASE', 100)), | ||
| 'backoff_cap' => env('VALKEY_BACKOFF_CAP', env('REDIS_BACKOFF_CAP', 1000)), | ||
| ], | ||
|
|
||
| // The options below expose additional GLIDE capabilities. They are | ||
| // optional and disabled by default — uncomment any you wish to use. | ||
|
|
||
| // 'request_timeout' => env('VALKEY_REQUEST_TIMEOUT', 250), | ||
| // 'connection_timeout' => env('VALKEY_CONNECTION_TIMEOUT', 250), | ||
| // 'client_name' => env('VALKEY_CLIENT_NAME'), | ||
| // 'lazy_connect' => env('VALKEY_LAZY_CONNECT', false), | ||
| // 'inflight_requests_limit' => env('VALKEY_INFLIGHT_LIMIT', 1000), | ||
| // 'register_phpredis_aliases' => env('VALKEY_REGISTER_ALIASES', true), | ||
|
|
||
| // AWS ElastiCache / MemoryDB IAM authentication. | ||
| // 'iam_config' => null, | ||
|
|
||
| // Reconnect / backoff strategy. | ||
| // 'reconnect_strategy' => [ | ||
| // 'num_of_retries' => env('VALKEY_RECONNECT_RETRIES', 3), | ||
| // 'factor' => env('VALKEY_RECONNECT_FACTOR', 2), | ||
| // 'exponent_base' => env('VALKEY_RECONNECT_EXP_BASE', 2), | ||
| // ], | ||
|
|
||
| // Client-side caching (server-assisted invalidation). | ||
| // 'client_side_cache' => [ | ||
| // 'enabled' => env('VALKEY_CSC_ENABLED', false), | ||
| // 'max_size' => env('VALKEY_CSC_MAX_SIZE', 10000), | ||
| // ], | ||
|
|
||
| // Native payload compression (experimental). | ||
| // 'compression' => [ | ||
| // 'enabled' => env('VALKEY_COMPRESSION', false), | ||
| // 'algorithm' => env('VALKEY_COMPRESSION_ALGO', 'lz4'), | ||
| // ], | ||
|
|
||
| // Cluster node definitions for multi-node deployments. | ||
| // 'clusters' => [ | ||
| // 'default' => [ | ||
| // ['host' => '10.0.0.1', 'port' => 7000], | ||
| // ['host' => '10.0.0.2', 'port' => 7001], | ||
| // ['host' => '10.0.0.3', 'port' => 7002], | ||
| // ], | ||
| // 'options' => [ | ||
| // 'read_from' => 'prefer_replica', | ||
| // 'use_tls' => true, | ||
| // 'az_affinity' => 'us-east-1a', | ||
| // ], | ||
| // ], | ||
|
|
||
| // OpenTelemetry tracing and metrics export. | ||
| // 'otel' => [ | ||
| // 'enabled' => env('VALKEY_OTEL_ENABLED', false), | ||
| // 'endpoint' => env('VALKEY_OTEL_ENDPOINT'), | ||
| // 'traces' => ['enabled' => true, 'sample_percentage' => env('VALKEY_OTEL_SAMPLE_PCT', 1)], | ||
| // 'metrics' => ['enabled' => true], | ||
| // 'flush_interval_ms' => env('VALKEY_OTEL_FLUSH_MS', 5000), | ||
| // ], | ||
|
|
||
| ], | ||
|
|
||
| ]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,24 +10,24 @@ services: | |
| ports: | ||
| - "11211:11211" | ||
| restart: always | ||
| mysql: | ||
| image: mysql/mysql-server:5.7 | ||
| environment: | ||
| MYSQL_ALLOW_EMPTY_PASSWORD: 1 | ||
| MYSQL_ROOT_PASSWORD: "" | ||
| MYSQL_DATABASE: "forge" | ||
| MYSQL_ROOT_HOST: "%" | ||
| ports: | ||
| - "3306:3306" | ||
| restart: always | ||
| # postgres: | ||
| # image: postgres:15 | ||
| # mysql: | ||
| # image: mysql/mysql-server:5.7 | ||
| # environment: | ||
| # POSTGRES_PASSWORD: "secret" | ||
| # POSTGRES_DB: "forge" | ||
| # MYSQL_ALLOW_EMPTY_PASSWORD: 1 | ||
| # MYSQL_ROOT_PASSWORD: "" | ||
| # MYSQL_DATABASE: "forge" | ||
| # MYSQL_ROOT_HOST: "%" | ||
| # ports: | ||
| # - "5432:5432" | ||
| # - "3306:3306" | ||
| # restart: always | ||
| postgres: | ||
| image: postgres:18-alpine | ||
| environment: | ||
| POSTGRES_PASSWORD: "secret" | ||
| POSTGRES_DB: "forge" | ||
| ports: | ||
| - "5432:5432" | ||
| restart: always | ||
|
Comment on lines
+23
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This PR's stated scope is adding Valkey support, but it also replaces the active MySQL service with PostgreSQL. Contributors relying on this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .ditto Any reason why we are modifying the defaults? We should be making additive changes not forcing to use |
||
| # mariadb: | ||
| # image: mariadb:11 | ||
| # environment: | ||
|
|
@@ -46,11 +46,11 @@ services: | |
| # ports: | ||
| # - "1433:1433" | ||
| # restart: always | ||
| redis: | ||
| image: redis:7.0-alpine | ||
| ports: | ||
| - "6379:6379" | ||
| restart: always | ||
| # redis: | ||
| # image: redis:7.0-alpine | ||
| # ports: | ||
| # - "6379:6379" | ||
| # restart: always | ||
| # redis-cluster-0: | ||
| # image: redis:7.0-alpine | ||
| # ports: | ||
|
|
@@ -77,3 +77,34 @@ services: | |
| # - redis-cluster-2 | ||
| # command: sh -c 'redis-cli --cluster create redis-cluster-0:7000 redis-cluster-1:7001 redis-cluster-2:7002 --cluster-replicas 0 --cluster-yes || true' | ||
| # restart: no | ||
| valkey: | ||
| image: valkey/valkey:9-alpine | ||
| ports: | ||
| - "6380:6379" | ||
| restart: always | ||
|
Comment on lines
+80
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== docker-compose.yml excerpt ==\n'
nl -ba docker-compose.yml | sed -n '70,95p'
printf '\n== config/database.php excerpt ==\n'
nl -ba config/database.php | sed -n '1,220p'
printf '\n== valkey/redis env references ==\n'
rg -n "VALKEY_PORT|REDIS_PORT|valkey|redis" .env* config docker-compose.yml README* -g '!vendor'Repository: opensource-for-valkey/php-laravel-framework Length of output: 255 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== docker-compose.yml excerpt ==\n'
awk 'NR>=70 && NR<=95 { printf "%4d %s\n", NR, $0 }' docker-compose.yml
printf '\n== config/database.php excerpt ==\n'
awk 'NR>=1 && NR<=220 { printf "%4d %s\n", NR, $0 }' config/database.php
printf '\n== valkey/redis env references ==\n'
rg -n "VALKEY_PORT|REDIS_PORT|valkey|redis" .env* config docker-compose.yml README* -g '!vendor'Repository: opensource-for-valkey/php-laravel-framework Length of output: 14969 Align the Valkey host port with the default config 🤖 Prompt for AI Agents
Comment on lines
+80
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The |
||
| # valkey-cluster-0: | ||
| # image: valkey/valkey:9-alpine | ||
| # ports: | ||
| # - "7100:7100" | ||
| # restart: always | ||
| # command: valkey-server --port 7100 --appendonly yes --cluster-enabled yes | ||
| # valkey-cluster-1: | ||
| # image: valkey/valkey:9-alpine | ||
| # ports: | ||
| # - "7101:7101" | ||
| # restart: always | ||
| # command: valkey-server --port 7101 --appendonly yes --cluster-enabled yes | ||
| # valkey-cluster-2: | ||
| # image: valkey/valkey:9-alpine | ||
| # ports: | ||
| # - "7102:7102" | ||
| # restart: always | ||
| # command: valkey-server --port 7102 --appendonly yes --cluster-enabled yes | ||
| # valkey-cluster-creator: | ||
| # image: valkey/valkey:9-alpine | ||
| # depends_on: | ||
| # - valkey-cluster-0 | ||
| # - valkey-cluster-1 | ||
| # - valkey-cluster-2 | ||
| # command: sh -c 'valkey-cli --cluster create valkey-cluster-0:7100 valkey-cluster-1:7101 valkey-cluster-2:7102 --cluster-replicas 0 --cluster-yes || true' | ||
| # restart: no | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from_redisplacement may be silently ignored by the driverfrom_redislives at the top level of thevalkeyconfig array, sibling toclient,options,default, andcache. If the GLIDE driver reads driver-level flags from theoptionssub-array (as most Laravel connection drivers do), this key will never be seen and the fallback behaviour will silently not work. It may belong insideoptionsalongside the other driver flags (use_tls,read_from, etc.), or the driver's config-reading path should be confirmed to look one level up.