mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Switching an external volume from the old <uuid>_<name> volume to the declared external volume on redeploy could make an app look as if it lost its data (for example a database that initializes a new, empty data directory). - If a resource already has the storage entry with the old generated name, the parsers keep using that volume and show a warning in the deployment log and the service start log, with the steps to switch. - Without that entry (new resources, or external volumes added later) the external volume is used as declared. - Deleting the old storage entry (storage page) switches to the external volume on the next deployment; the storage entry shows a note about it. - Legacy Compose applications (parser versions 1 and 2) never stored their volumes, so they keep the old volume names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
827 B
PHP
34 lines
827 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
/**
|
|
* Keeps the Compose volume warnings of the last parse on the model instance. The warnings are not
|
|
* saved to the database. The deployment job and the service start actions show them to the user.
|
|
*/
|
|
trait HasComposeVolumeWarnings
|
|
{
|
|
/** @var list<string> */
|
|
private array $composeVolumeWarnings = [];
|
|
|
|
public function resetComposeVolumeWarnings(): void
|
|
{
|
|
$this->composeVolumeWarnings = [];
|
|
}
|
|
|
|
public function addComposeVolumeWarning(string $warning): void
|
|
{
|
|
if (! in_array($warning, $this->composeVolumeWarnings, true)) {
|
|
$this->composeVolumeWarnings[] = $warning;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return list<string>
|
|
*/
|
|
public function composeVolumeWarnings(): array
|
|
{
|
|
return $this->composeVolumeWarnings;
|
|
}
|
|
}
|