Skip to content

Conversation

@andrasbacsai
Copy link
Member

@andrasbacsai andrasbacsai commented Oct 30, 2025

Add support for Valkey database, thats it.

Integrates Valkey as a new standalone database type. This includes adding the necessary model, updating actions to handle Valkey instances, and documenting the integration process.
@andrasbacsai andrasbacsai changed the title Valkey Int Add support for Valkey database Oct 30, 2025
@andrasbacsai
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added Valkey as a new database type with full lifecycle management support
    • Enabled Valkey database creation, configuration, and deployment via UI and API
    • Added SSL/TLS, public access, port mapping, and password management for Valkey databases
  • Documentation

    • Added comprehensive guide for integrating new database types into Coolify

Valkey Database Integration for Coolify

Walkthrough

Adds comprehensive Valkey database support to Coolify by introducing a new StandaloneValkey model, lifecycle management actions (start, stop, restart, proxy), database configuration UI components, API endpoints, migrations, and helpers. Integrates Valkey as a first-class standalone database type alongside Redis, PostgreSQL, and others across ~45 files.

Changes

Cohort / File(s) Summary
Documentation & Guides
.cursor/rules/adding-new-database.mdc, CLAUDE.md
Comprehensive guide for adding new database types; updated docs with "Implementation Guides" section linking Valkey integration reference.
Database Lifecycle Actions
app/Actions/Database/StartValkey.php, app/Actions/Database/Start...php, app/Actions/Database/Stop...php, app/Actions/Database/Restart...php
New StartValkey action orchestrating Valkey Docker Compose setup with SSL, volumes, environment vars, and custom config; updated Start/Stop/Restart/Proxy actions to accept StandaloneValkey type.
Core Models & Relationships
app/Models/StandaloneValkey.php, app/Models/Environment.php, app/Models/Project.php, app/Models/Server.php, app/Models/StandaloneDocker.php
New StandaloneValkey model with lifecycle hooks, attributes, relationships (environment, destination, storages, backups, tags, SSL certs), status/URL computation, and metrics; added valkeys relationship to Environment, Project, Server, and StandaloneDocker.
Enums & Constants
app/Enums/NewDatabaseTypes.php, app/Enums/NewResourceTypes.php, bootstrap/helpers/constants.php
Added VALKEY enum cases and 'valkey' string to DATABASE_TYPES constant.
Livewire Components & Configuration
app/Livewire/Project/Database/Valkey/General.php, app/Livewire/Project/New/Select.php, app/Livewire/Project/Resource/Create.php, app/Livewire/Project/Resource/Index.php
New Valkey General component for configuration (SSL, public access, passwords, ports, validation); updated Select/Create/Index to recognize and provision Valkey type.
Shared Livewire Components
app/Livewire/Project/Service/FileStorage.php, app/Livewire/Project/Shared/ConfigurationChecker.php, app/Livewire/Project/Shared/GetLogs.php, app/Livewire/Project/Shared/Logs.php, app/Livewire/Project/Database/Configuration.php, app/Livewire/Project/Database/Import.php
Extended resource type unions to include StandaloneValkey; updated Configuration to eager-load valkeys and Import to mark unsupported imports.
Blade Views
resources/views/livewire/project/database/valkey/general.blade.php, resources/views/livewire/project/database/configuration.blade.php, resources/views/livewire/project/resource/index.blade.php
New Valkey General configuration view with sections for general settings, network, SSL, proxy, custom config, and advanced options; added conditional rendering in Configuration and Index views.
API & Routes
app/Http/Controllers/Api/DatabasesController.php, routes/api.php, openapi.json, openapi.yaml
New POST /databases/valkey API endpoint for creating Valkey databases with full OpenAPI spec; registered route with API ability middleware.
Policies & Authorization
app/Policies/ResourceCreatePolicy.php, app/Providers/AuthServiceProvider.php
Added StandaloneValkey to CREATABLE_RESOURCES and registered DatabasePolicy governance.
Helpers
bootstrap/helpers/databases.php, bootstrap/helpers/shared.php
New create_standalone_valkey helper; updated queryDatabaseByUuidWithinTeam, queryResourcesByUuid, and add_coolify_default_environment_variables to handle StandaloneValkey.
Background Jobs & Utilities
app/Jobs/DeleteResourceJob.php, app/Actions/Docker/GetContainersStatus.php
Extended DeleteResourceJob resource union to include StandaloneValkey; added debug ray() logging to GetContainersStatus.
Database Schema
database/migrations/2025_10_30_000000_create_standalone_valkey_table.php, database/seeders/StandaloneValkeySeeder.php
New migration creating standalone_valkeys table with metadata, Docker config, resource limits, SSL, status tracking; new seeder for test data.
Service Templates
templates/service-templates-latest.json, templates/service-templates.json
Updated activepieces compose field (likely version bump); templates structure updated.

Sequence Diagram

sequenceDiagram
    participant User
    participant Livewire as Valkey General<br/>(Livewire Component)
    participant StartValkey as StartValkey<br/>(Action)
    participant Docker as Docker<br/>Daemon
    participant Sentinel as Sentinel API<br/>(Metrics)
    
    User->>Livewire: Submit form (password, SSL, config)
    Livewire->>Livewire: Validate & sync data
    Livewire->>StartValkey: handle(StandaloneValkey)
    
    rect rgb(200, 220, 255)
        Note over StartValkey: Docker Compose Setup
        StartValkey->>StartValkey: Generate environment vars
        StartValkey->>StartValkey: Compute persistent volumes
        StartValkey->>StartValkey: Build valkey-server command
        StartValkey->>StartValkey: Build docker-compose.yml
    end
    
    rect rgb(220, 255, 220)
        Note over StartValkey,Docker: SSL Handling (if enabled)
        StartValkey->>StartValkey: Generate/load SSL certs
        StartValkey->>StartValkey: Mount CA & cert volumes
    end
    
    StartValkey->>Docker: docker-compose up -d
    Docker->>Docker: Start Valkey container
    Docker-->>StartValkey: Container running
    
    StartValkey->>StartValkey: Dispatch GetContainersStatus
    StartValkey-->>Livewire: Update status
    
    Livewire->>Sentinel: getCpuMetrics / getMemoryMetrics
    Sentinel-->>Livewire: Metrics data
    Livewire-->>User: Display configuration & status
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Areas requiring extra attention:

  • app/Actions/Database/StartValkey.php: Dense logic managing SSL certificates, environment variable composition, volume management, custom Valkey config deployment, and docker-compose generation. Verify SSL cert generation/mounting, environment variable handling (especially VALKEY_PASSWORD), and volume persistence logic.
  • app/Models/StandaloneValkey.php: Extensive lifecycle hooks (boot, creating, forceDeleting, saving), computed attributes, status parsing, metrics retrieval from Sentinel API, and relationship configuration. Ensure cascade deletion logic is correct and status parsing handles edge cases.
  • app/Livewire/Project/Database/Valkey/General.php: Complex form state management with SSL, public access toggling, proxy start/stop, validation rules, and component synchronization. Verify syncData bidirectional flow, SSL regeneration logic, and public exposure port handling.
  • Duplicate API endpoint: app/Http/Controllers/Api/DatabasesController.php appears to have the create_database_valkey method duplicated; confirm this is intentional or requires deduplication.
  • Helper functions: Verify create_standalone_valkey and updates to add_coolify_default_environment_variables properly handle all required fields and relationships consistent with other database helpers.

Possibly related PRs


Alright, listen up. You just added Valkey to Coolify? That's self-hosted database excellence—no serverless nonsense with VC-funded marketing claims about "zero ops." Real servers, real control, real performance. This is the way. 🖥️

I scanned through ~45 files getting woven together here, and it's solid infrastructure work. The type system changes are repetitive (good—less mental load per file), but that StartValkey orchestration and the StandaloneValkey model? That's where the neurons light up. SSL handling, volume management, environment vars—all the gluten-free-friendly details that make self-hosting work. Come with me if you want to live... in production with actual uptime. 💪

One heads-up: duplicate API endpoint in DatabasesController might be a copy-paste artifact. Also, grab yourself a nice gluten-free taco while reviewing the metric retrieval logic—if Sentinel is unreachable, that needs graceful handling. I'll be back.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is largely incomplete and fails to follow the required template structure. The provided description consists of only a single informal sentence ("Add support for Valkey database, thats it.") without proper organization. The template mandates key sections including a structured "Changes" list and an "Issues" section referencing relevant issue links, neither of which are present. While the raw_summary reveals this PR contains extensive, well-organized changes across numerous files, the actual PR description provides no structured breakdown of what was modified or why, making it difficult for reviewers to understand the scope and intent from the description alone. The author should expand the description to follow the repository template by adding a detailed "Changes" section that lists the major modifications (e.g., new StandaloneValkey model, migration, actions, Livewire components, API endpoints, etc.), and an "Issues" section that references any related GitHub issues or discussions. The casual tone of "thats it" should be replaced with professional, descriptive language that would help reviewers quickly understand the scope. For a PR of this magnitude—adding an entirely new database type with dozens of file modifications—a bare-minimum description does a disservice to code review.
Docstring Coverage ⚠️ Warning Docstring coverage is 3.09% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Add support for Valkey database" is concise, clear, and directly reflects the primary objective of this changeset. The extensive modifications across models, actions, Livewire components, API endpoints, and database migrations all align with implementing Valkey as a new standalone database type. The title accurately captures the core change without unnecessary noise and is specific enough that a teammate scanning the history would immediately understand the addition of database support for Valkey.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch valkey-int

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
templates/service-templates-latest.json (1)

2-192: Hasta la vista, baby. This PR just got TERMINATED. 💥

CRITICAL FINDING: Your Valkey PR is like ordering a gluten-free taco shell with no actual taco inside it—all promise, zero delivery.

Here's the damage assessment:

✓ Valkey code infrastructure:      PRESENT (models, migrations, actions, UI)
✓ Valkey database logic:           PRESENT (StartValkey.php, StandaloneValkey model)
✓ Valkey API endpoints:            PRESENT (DatabasesController updated)
✗ Valkey service templates:        MISSING (0 entries found)
✗ User-facing deployment config:   MISSING

The situation:

  • Your code commits to the Valkey infrastructure are legit server-level stuff ✓
  • But the templates/service-templates-latest.json file doesn't contain a single "valkey" service block
  • This means users can't actually deploy Valkey through the UI—they have the code, but no template to instantiate it
  • The PR title says "Add support for Valkey database" but that support is incomplete

What's broken:

  • Someone can create a StandaloneValkey model in the database layer
  • But the service template orchestration is MIA—like a Terminator who showed up without the shooting
  • Result: failed deployments, confused users, abandoned self-hosted infrastructure dreams

You need to:

  1. Add the Valkey service template entry to templates/service-templates-latest.json
  2. Include the compose configuration, health checks, and environment variables
  3. Ensure consistency with other service definitions (Redis, PostgreSQL, etc.)

This is real infrastructure code, and it deserves real completion. No half-measures on the self-hosting front.

**** — Add missing Valkey service template configuration to complete the integration.

app/Models/StandaloneDocker.php (1)

86-95: Your databases are incomplete. They will be missing in action.

I'm detecting a serious problem here, soldier. You've defined the valkeys() relationship method above, but line 94 doesn't include it in the concatenation. This is like building a T-800 and forgetting to install the targeting system.

Looking at this closely, you're only concatenating 5 database types: postgresqls, redis, mongodbs, mysqls, and mariadbs. But you've defined relationships for 9 database types! You're also missing:

  • valkeys (the new one you just added)
  • keydbs
  • dragonflies
  • clickhouses

Meanwhile, over in Server::databases() (line 776) and Environment::databases() (line 125), they correctly include all database types including valkeys. This inconsistency is more dangerous than a malfunctioning neural net processor.

Your Valkey databases will be invisible when accessed through StandaloneDocker destinations. That's not the kind of stealth mode we want on self-hosted servers. We need full visibility on our infrastructure, not serverless-style "mystery meat" deployments.

Apply this diff to complete the mission:

 public function databases()
 {
     $postgresqls = $this->postgresqls;
     $redis = $this->redis;
+    $valkeys = $this->valkeys;
     $mongodbs = $this->mongodbs;
     $mysqls = $this->mysqls;
     $mariadbs = $this->mariadbs;
+    $keydbs = $this->keydbs;
+    $dragonflies = $this->dragonflies;
+    $clickhouses = $this->clickhouses;
 
-    return $postgresqls->concat($redis)->concat($mongodbs)->concat($mysqls)->concat($mariadbs);
+    return $postgresqls->concat($redis)->concat($valkeys)->concat($mongodbs)->concat($mysqls)->concat($mariadbs)->concat($keydbs)->concat($dragonflies)->concat($clickhouses);
 }

Now all your databases will be accounted for, just like a proper inventory of tacos at a gluten-free taco stand. No database left behind!

app/Actions/Database/StartDatabase.php (1)

28-56: Optional mission: Refactor the switch for lower complexity.

If you want to silence that PHPMD warning and make future database additions even easier, consider the Strategy pattern. But honestly? This switch statement works fine. Don't over-engineer what doesn't need engineering - save your energy for fighting serverless evangelists.

Here's a potential refactor if you're feeling ambitious (like building a time machine ambitious):

public function handle(StandaloneRedis|StandaloneValkey|... $database)
{
    $server = $database->destination->server;
    if (!$server->isFunctional()) {
        return 'Server is not functional';
    }
    
    $actionMap = [
        \App\Models\StandalonePostgresql::class => StartPostgresql::class,
        \App\Models\StandaloneRedis::class => StartRedis::class,
        \App\Models\StandaloneValkey::class => StartValkey::class,
        // ... rest of mappings
    ];
    
    $actionClass = $actionMap[$database->getMorphClass()] ?? null;
    if (!$actionClass) {
        throw new \Exception("No start action for " . $database->getMorphClass());
    }
    
    $activity = $actionClass::run($database);
    
    if ($database->is_public && $database->public_port) {
        StartDatabaseProxy::dispatch($database);
    }
    
    return $activity;
}

But again - current code is totally fine. "If it ain't broke, don't fix it" - a lesson I learned after being reprogrammed too many times.

app/Actions/Database/StopDatabase.php (1)

22-45: Add explicit return type and tame the boolean flag, I'll be back otherwise.

  • handle() returns strings but lacks a declared return type. Add : string.
  • The $dockerCleanup boolean flag is a smell; consider splitting into two methods (with/without cleanup) or passing an options DTO.

Diff:

-    public function handle(StandaloneRedis|StandaloneValkey|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database, bool $dockerCleanup = true)
+    public function handle(StandaloneRedis|StandaloneValkey|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database, bool $dockerCleanup = true): string
app/Actions/Database/StartDatabaseProxy.php (1)

18-124: Extract helpers to cut method length; make the proxy code more… terminated.

handle() is 100+ lines. Extract:

  • resolveNetworkAndNames($database): array
  • resolveInternalPort($type, $ssl): int
  • renderNginxConf(...): string
  • buildComposeSpec(...): array

Also optionally import Exception and drop leading backslash.

Diff (imports and throw):

 use Lorisleiva\Actions\Concerns\AsAction;
+use Exception;
 ...
-            default => throw new \Exception("Unsupported database type: $databaseType"),
+            default => throw new Exception("Unsupported database type: $databaseType"),
app/Actions/Database/StopDatabaseProxy.php (1)

28-31: Fix server path for ServiceDatabase, or your proxy stops on the wrong host. Hasta la vista, bug.

Use service.destination.server (as in StartDatabaseProxy) to target the correct machine.

-        if ($database->getMorphClass() === \App\Models\ServiceDatabase::class) {
-            $uuid = $database->service->uuid;
-            $server = data_get($database, 'service.server');
-        }
+        if ($database->getMorphClass() === \App\Models\ServiceDatabase::class) {
+            $uuid = $database->service->uuid;
+            $server = data_get($database, 'service.destination.server');
+        }
app/Http/Controllers/Api/DatabasesController.php (1)

1625-2143: Critical: Valkey create route currently always fails

Hasta la vista, deploy. The shiny new create_database_valkey() endpoint still routes straight into create_database(), but there’s no VALKEY branch in that switch and the base $allowedFields list doesn’t include valkey_password / valkey_conf. Result: any Valkey payload trips the “field not allowed” guard or falls through to the “Invalid database type” 400. Self-hosters trying to avoid serverless hype will get nada. Please add Valkey-specific validation/field handling just like Redis/Dragonfly, plus base64 decoding for the conf, and call the helper that actually provisions the container. For example:

-        $allowedFields = [..., 'redis_password', 'redis_conf', ...];
+        $allowedFields = [..., 'redis_password', 'redis_conf', 'valkey_password', 'valkey_conf'];

         ...
-        } elseif ($type === NewDatabaseTypes::REDIS) {
+        } elseif ($type === NewDatabaseTypes::VALKEY) {
+            $allowedFields = [..., 'valkey_password', 'valkey_conf'];
+            $validator = customApiValidator($request->all(), [
+                'valkey_password' => 'string',
+                'valkey_conf' => 'string',
+            ]);
+            $extraFields = array_diff(array_keys($request->all()), $allowedFields);
+            if ($validator->fails() || ! empty($extraFields)) { /* mirror existing pattern */ }
+            removeUnnecessaryFieldsFromRequest($request);
+            if ($request->has('valkey_conf')) { /* base64 validation & decode */ }
+            $database = create_standalone_valkey($environment->id, $destination->uuid, $request->all());
+            if ($instantDeploy) {
+                StartDatabase::dispatch($database);
+            }
+            $database->refresh();
+            return response()->json(serializeApiResponse([
+                'uuid' => $database->uuid,
+                'internal_db_url' => $database->internal_db_url,
+                'external_db_url' => $database->is_public ? $database->external_db_url : null,
+            ]))->setStatusCode(201);
+        } elseif ($type === NewDatabaseTypes::REDIS) {
             ...

Without this, Valkey support is a mirage and my tacos remain sad.

Comment on lines +296 to +308
if ($this->database->enable_ssl) {
$sslArgs = [
'--tls-port 6380',
'--tls-cert-file /etc/valkey/certs/server.crt',
'--tls-key-file /etc/valkey/certs/server.key',
'--tls-ca-cert-file /etc/valkey/certs/coolify-ca.crt',
'--tls-auth-clients optional',
];
}

if (! empty($sslArgs)) {
$command .= ' '.implode(' ', $sslArgs);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Initialize $sslArgs before use

You’re accessing $sslArgs outside the SSL branch without defining it first. In PHP 8+, that raises runtime warnings and will be promoted to hard errors in upcoming versions—no good for our lovingly self-hosted rigs.(wiki.php.net) Drop a $sslArgs = []; before the if ($this->database->enable_ssl) block (or wrap the later check) so the command build doesn’t reference an undefined variable.

🤖 Prompt for AI Agents
In app/Actions/Database/StartValkey.php around lines 296 to 308, $sslArgs is
referenced outside the if-block without being initialized which can produce
undefined variable errors; initialize $sslArgs as an empty array before the if
($this->database->enable_ssl) block (e.g. $sslArgs = [];), or alternatively
change the later check to only append when the variable is set, so the command
concatenation never references an undefined variable.


public function __construct(
public Application|ApplicationPreview|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource,
public Application|ApplicationPreview|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|StandaloneValkey $resource,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Hasta la vista, type safety!

The union type is correct, but this line is longer than a taco Tuesday queue at a gluten-free restaurant! While you've correctly added StandaloneValkey to the parameter union type (maintaining type safety - good!), this line is now approaching 400 characters. It's harder to read than assembly code written by Skynet.

The logic is sound and the addition is necessary, but consider refactoring this to improve readability. Perhaps a base interface or contract that all these resource types implement? Something like DeletableResource that these models could implement? This would turn that monster union into a clean single interface type.

But for now, the functionality is correct - all database types are properly supported for deletion, including our new self-hosted Valkey friend!

Consider extracting a shared interface to replace this massive union type:

// In a new file: app/Contracts/DeletableResource.php
interface DeletableResource
{
    public function type(): string;
    public function deleteConfigurations(): void;
    public function deleteVolumes(): void;
    // ... other shared methods
}

Then simplify the constructor:

 public function __construct(
-    public Application|ApplicationPreview|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|StandaloneValkey $resource,
+    public DeletableResource $resource,
     public bool $deleteVolumes = true,
🤖 Prompt for AI Agents
In app/Jobs/DeleteResourceJob.php around line 35, the constructor parameter uses
an unwieldy long union type spanning many model classes; refactor by introducing
a new DeletableResource contract/interface (e.g.,
app/Contracts/DeletableResource.php) declaring the shared methods used by the
job (type(), deleteConfigurations(), deleteVolumes(), etc.), have each resource
model implement this interface, and then replace the massive union in the job
signature with the single DeletableResource type; update any typehints/usages in
the job to rely on the interface methods and run tests/static analysis to ensure
no breakages.

Comment on lines +4586 to +4666
"server_uuid": {
"type": "string",
"description": "UUID of the server"
},
"project_uuid": {
"type": "string",
"description": "UUID of the project"
},
"environment_name": {
"type": "string",
"description": "Name of the environment. You need to provide at least one of environment_name or environment_uuid."
},
"environment_uuid": {
"type": "string",
"description": "UUID of the environment. You need to provide at least one of environment_name or environment_uuid."
},
"destination_uuid": {
"type": "string",
"description": "UUID of the destination if the server has multiple destinations"
},
"valkey_password": {
"type": "string",
"description": "Valkey password"
},
"valkey_conf": {
"type": "string",
"description": "Valkey conf"
},
"name": {
"type": "string",
"description": "Name of the database"
},
"description": {
"type": "string",
"description": "Description of the database"
},
"image": {
"type": "string",
"description": "Docker Image of the database"
},
"is_public": {
"type": "boolean",
"description": "Is the database public?"
},
"public_port": {
"type": "integer",
"description": "Public port of the database"
},
"limits_memory": {
"type": "string",
"description": "Memory limit of the database"
},
"limits_memory_swap": {
"type": "string",
"description": "Memory swap limit of the database"
},
"limits_memory_swappiness": {
"type": "integer",
"description": "Memory swappiness of the database"
},
"limits_memory_reservation": {
"type": "string",
"description": "Memory reservation of the database"
},
"limits_cpus": {
"type": "string",
"description": "CPU limit of the database"
},
"limits_cpuset": {
"type": "string",
"description": "CPU set of the database"
},
"limits_cpu_shares": {
"type": "integer",
"description": "CPU shares of the database"
},
"instant_deploy": {
"type": "boolean",
"description": "Instant deploy the database"
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Add request examples for DX (one JSON example is enough).

Developers love tacos and examples. Add a small example payload showing typical fields (server_uuid, project_uuid, valkey_password, is_public/public_port), mirroring Redis/KeyDB conventions.

Example shape:

{
  "server_uuid": "srv-123",
  "project_uuid": "prj-456",
  "environment_name": "production",
  "environment_uuid": "env-789",
  "destination_uuid": "dst-000",
  "name": "valkey-cache",
  "description": "Low-latency cache",
  "image": "valkey/valkey:latest",
  "is_public": true,
  "public_port": 6380,
  "valkey_password": "use-a-secret-manager",
  "valkey_conf": "maxmemory 256mb\nmaxmemory-policy allkeys-lru",
  "limits_memory": "512m",
  "limits_cpus": "0.5",
  "instant_deploy": true
}
🤖 Prompt for AI Agents
In openapi.json around lines 4586-4666, the schema defining the database
creation fields is missing a request example; add a single JSON example
(matching the suggested shape: server_uuid, project_uuid, environment_name/uuid,
destination_uuid, name, description, image, is_public, public_port,
valkey_password, valkey_conf, limits_memory, limits_cpus, instant_deploy) to the
schema. Insert it as an "example" property on the object schema (or as a single
entry in "examples" under the requestBody -> content -> application/json media
type) so tooling and docs show the payload; ensure the example uses realistic
placeholder values and valid types (strings, booleans, integers).

Comment on lines +4673 to +4685
"200": {
"description": "Database updated"
},
"401": {
"$ref": "#\/components\/responses\/401"
},
"400": {
"$ref": "#\/components\/responses\/400"
},
"422": {
"$ref": "#\/components\/responses\/422"
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Use 201 Created for POST (and return a body).

POST currently returns 200 "Database updated". Prefer 201 "created" with a minimal response schema for the new resource. If you don’t want to ripple other endpoints now, it’s fine to scope this improvement to Valkey and align others later.

Apply:

-                "responses": {
-                    "200": {
-                        "description": "Database updated"
-                    },
+                "responses": {
+                    "201": {
+                        "description": "Database created.",
+                        "content": {
+                            "application/json": {
+                                "schema": {
+                                    "type": "object",
+                                    "properties": {
+                                        "uuid": { "type": "string" }
+                                    }
+                                }
+                            }
+                        }
+                    },

As per coding guidelines.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In openapi.json around lines 4673 to 4685, the POST response currently uses HTTP
200 "Database updated"; change this to HTTP 201 "Created" and return a minimal
response body describing the created resource (e.g., id and location/href).
Update the response entry so status code "201" replaces "200", set description
to "Created", and add a response schema (application/json) referencing or
defining a small object with the new resource identifier and optional link; keep
other error refs (401/400/422) as-is. Ensure this change is applied to the
Valkey POST operation only for now to avoid wider ripples.

Comment on lines +108 to +124
<x-slide-over fullScreen>
<x-slot:title>Proxy Logs</x-slot:title>
<x-slot:content>
<livewire:project.shared.get-logs :server="$server" :resource="$database"
container="{{ data_get($database, 'uuid') }}-proxy" lazy />
</x-slot:content>
<x-forms.button disabled="{{ !$isPublic }}"
@click="slideOverOpen=true">Logs</x-forms.button>
</x-slide-over>
@endif
</div>
<x-forms.checkbox instantSave id="isPublic" label="Make it publicly available"
canGate="update" :canResource="$database" />
</div>
<x-forms.input placeholder="5432" disabled="{{ $isPublic }}"
id="publicPort" label="Public Port" canGate="update" :canResource="$database" />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Public controls stuck disabled

I’ll be back… but this button won’t. The disabled="{{ !$isPublic }}" (and similar) outputs the attribute even when the condition is false, so the Logs button and Public Port field stay disabled forever. That’s a total buzzkill for on-prem heroes. Please swap to the component binding form so the attribute disappears when false, e.g. :disabled="! $isPublic" (or remove it entirely when not needed).

🤖 Prompt for AI Agents
resources/views/livewire/project/database/valkey/general.blade.php lines
108-124: the template uses literal attribute interpolation like disabled="{{
!$isPublic }}" which renders the disabled attribute even when false; change
these to Blade component bindings so the attribute is removed when false (e.g.
use the bound form :disabled="! $isPublic" for the Logs button and
:disabled="$isPublic" or :disabled="! $isPublic" as appropriate for the Public
Port input), and update any similar occurrences in this block to use :disabled
binding or remove the attribute entirely when not needed.

The `custom_network_aliases` field was being displayed as an array, which caused rendering issues. This change converts the array to a comma-separated string when syncing from the model to ensure it's displayed correctly in the UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants