Use ULID for app IDs and Docker label for container lookup

- Replace UUID with ULID for app ID generation (lexicographically sortable)
- Remove container_id column from apps table (migration 002)
- Add upaas.id Docker label to identify containers by app ID
- Implement FindContainerByAppID in Docker client to query by label
- Update handlers and deploy service to use label-based container lookup
- Show system-managed upaas.id label in UI with editing disabled

Container association is now determined dynamically via Docker label
rather than stored in the database, making the system more resilient
to container recreation or external changes.
This commit is contained in:
2025-12-29 16:06:40 +07:00
parent c13fd8c746
commit 5fb0b111fc
11 changed files with 142 additions and 91 deletions

View File

@@ -122,7 +122,6 @@
<!-- Labels -->
<div class="card p-6 mb-6">
<h2 class="section-title mb-4">Docker Labels</h2>
{{if .Labels}}
<div class="overflow-x-auto mb-4">
<table class="table">
<thead class="table-header">
@@ -133,6 +132,14 @@
</tr>
</thead>
<tbody class="table-body">
<!-- System-managed upaas.id label -->
<tr class="bg-gray-50">
<td class="font-mono font-medium text-gray-600">upaas.id</td>
<td class="font-mono text-gray-500">{{.App.ID}}</td>
<td class="text-right">
<span class="text-xs text-gray-400">System</span>
</td>
</tr>
{{range .Labels}}
<tr>
<td class="font-mono font-medium">{{.Key}}</td>
@@ -147,7 +154,6 @@
</tbody>
</table>
</div>
{{end}}
<form method="POST" action="/apps/{{.App.ID}}/labels" class="flex flex-col sm:flex-row gap-2">
<input type="text" name="key" placeholder="label.key" required class="input flex-1 font-mono text-sm">
<input type="text" name="value" placeholder="value" required class="input flex-1 font-mono text-sm">