Fixes

  • #7738

Summary

Adds server-scoped shared environment variables, enabling users to define per-server variables and reference them in application configurations using {{server.VARIABLE_NAME}} syntax.

This solves the multi-server deployment problem where applications cannot distinguish which server they are running on. Each server automatically gets COOLIFY_SERVER_UUID and COOLIFY_SERVER_NAME predefined variables, and users can add custom server-level variables for any use case (e.g., GPU availability, region identifiers, etc.).

Changes

Database

  • Migration to add server_id foreign key and server type to shared_environment_variables table
  • Migration to create predefined COOLIFY_SERVER_UUID and COOLIFY_SERVER_NAME for all existing servers
  • Unique constraint on (key, server_id, team_id) for data integrity

Models

  • Server: Added environment_variables() relationship; auto-creates predefined server variables on server creation
  • SharedEnvironmentVariable: Added server() belongsTo relationship
  • EnvironmentVariable: Added getResolvedValueWithServer() method for deployment-time resolution of {{server.VAR}} placeholders; refactored internal resolution to support server override context
  • Team/Project/Environment: Scoped environment_variables() relationships by type for consistency

Deployment

  • ApplicationDeploymentJob: Updated generate_runtime_environment_variables(), generate_nixpacks_env_variables(), and generate_env_variables() to use getResolvedValueWithServer($this->server) so server variables resolve correctly per deployment target

UI

  • New Livewire components: SharedVariables\Server\Index and SharedVariables\Server\Show
  • New blade views for listing servers and managing server variables
  • Updated shared variables index page to include “Server wide” option
  • Updated EnvVarInput component to support server scope in autocomplete dropdown
  • Updated env variable Add/Show components to include server variables in available shared variables

Other

  • Added 'server' to SHARED_VARIABLE_TYPES constant
  • Updated seeder with server variable support
  • Added routes: /shared-variables/servers and /shared-variables/server/{server_uuid}

How It Works

  1. Users navigate to Shared Variables > Server wide to manage server-level variables
  2. Each server automatically has COOLIFY_SERVER_UUID and COOLIFY_SERVER_NAME
  3. Users can add custom variables per server (e.g., HAS_GPU=true)
  4. In any application’s environment variables, use {{server.HAS_GPU}} to reference the server variable
  5. During deployment, the variable resolves to the value from the specific server being deployed to
  6. App-level variables take precedence over server-level variables (standard override behavior)

Backward Compatibility

  • No changes for existing deployments – default behavior is preserved
  • Server variables are opt-in: only used when explicitly referenced via {{server.VAR}}
  • Existing shared variable types (team, project, environment) continue to work unchanged

/claim #7738

Claim

Total prize pool $111
Total paid $0
Status Pending
Submitted February 09, 2026
Last updated February 09, 2026

Contributors

BU

buildingvibes

@buildingvibes

100%

Sponsors

PR

Praveen Pendyala

@pkpio

$111