feat(docker): limit container name prefixes to 30 characters

This commit is contained in:
peaklabs-dev
2026-09-09 15:01:57 +02:00
committed by 🏔️ Peak
parent 0d8ef9411f
commit 6ad739a53c
4 changed files with 10 additions and 3 deletions
@@ -70,7 +70,7 @@ class Advanced extends Component
#[Validate(['string', 'nullable'])]
public ?string $customInternalName = null;
#[Validate(['string', 'nullable', 'max:47'])]
#[Validate(['string', 'nullable', 'max:'.ApplicationSetting::MAX_CONTAINER_NAME_PREFIX_LENGTH])]
public ?string $customContainerNamePrefix = null;
#[Validate(['boolean'])]
+6
View File
@@ -50,6 +50,12 @@ use OpenApi\Attributes as OA;
)]
class ApplicationSetting extends Model
{
/**
* Keeps generated names (prefix, timestamp and for compose apps the service name) well below the
* 63 character DNS label limit, with room for a longer suffix in the future.
*/
public const MAX_CONTAINER_NAME_PREFIX_LENGTH = 30;
protected $casts = [
'is_static' => 'boolean',
'is_spa' => 'boolean',
+2 -1
View File
@@ -4,6 +4,7 @@ use App\Actions\Shared\MigrateResourceToDestination;
use App\Enums\BuildPackTypes;
use App\Enums\RedirectTypes;
use App\Enums\StaticImageTypes;
use App\Models\ApplicationSetting;
use App\Models\Environment;
use App\Models\StandaloneDocker;
use App\Models\SwarmDocker;
@@ -141,7 +142,7 @@ function sharedDataApplications()
'gpu_options' => 'string|nullable',
'is_consistent_container_name_enabled' => 'boolean',
'custom_internal_name' => 'string|nullable',
'custom_container_name_prefix' => 'string|nullable|max:47',
'custom_container_name_prefix' => 'string|nullable|max:'.ApplicationSetting::MAX_CONTAINER_NAME_PREFIX_LENGTH,
'preview_url_template' => 'string',
'max_restart_count' => 'integer|min:0',
'stop_grace_period' => 'nullable|integer|min:'.MIN_STOP_GRACE_PERIOD_SECONDS.'|max:'.MAX_STOP_GRACE_PERIOD_SECONDS,
@@ -56,7 +56,7 @@
<form wire:submit="saveCustomNamePrefix" class="w-full">
<x-unsaved-bar action="saveCustomNamePrefix" targets="customContainerNamePrefix" />
<x-forms.input
helper="Optional prefix for generated container names. Containers are named <span class='font-bold'>prefix-timestamp</span>, for example <span class='font-bold'>shop-api-20260908T141530</span>, instead of starting with <span class='font-bold'>{{ $application->uuid }}</span>.<br><br>The prefix is converted to slug format when saved, can be up to 47 characters and must be unique on this server. Rolling updates keep working."
helper="Optional prefix for generated container names. Containers are named <span class='font-bold'>prefix-timestamp</span>, for example <span class='font-bold'>shop-api-20260908T141530</span>, instead of starting with <span class='font-bold'>{{ $application->uuid }}</span>.<br><br>The prefix is converted to slug format when saved, can be up to {{ \App\Models\ApplicationSetting::MAX_CONTAINER_NAME_PREFIX_LENGTH }} characters and must be unique on this server. Rolling updates keep working."
id="customContainerNamePrefix" label="Container name prefix" placeholder="e.g. my-api"
canGate="update" :canResource="$application" />
</form>