diff --git a/app/Http/Livewire/Project/Service/Application.php b/app/Http/Livewire/Project/Service/Application.php
index 9bebb84e8..44538278e 100644
--- a/app/Http/Livewire/Project/Service/Application.php
+++ b/app/Http/Livewire/Project/Service/Application.php
@@ -15,6 +15,7 @@ class Application extends Component
'application.human_name' => 'nullable',
'application.description' => 'nullable',
'application.fqdn' => 'nullable',
+ 'application.image_tag' => 'required',
'application.ignore_from_status' => 'required|boolean',
];
public function render()
diff --git a/app/Http/Livewire/Project/Service/Database.php b/app/Http/Livewire/Project/Service/Database.php
index 1a6ce772a..36dd96d36 100644
--- a/app/Http/Livewire/Project/Service/Database.php
+++ b/app/Http/Livewire/Project/Service/Database.php
@@ -2,7 +2,6 @@
namespace App\Http\Livewire\Project\Service;
-use App\Models\ServiceApplication;
use App\Models\ServiceDatabase;
use Livewire\Component;
@@ -12,6 +11,7 @@ class Database extends Component
protected $rules = [
'database.human_name' => 'nullable',
'database.description' => 'nullable',
+ 'database.image_tag' => 'required',
'database.ignore_from_status' => 'required|boolean',
];
diff --git a/app/Models/Service.php b/app/Models/Service.php
index 864251260..f6c12ccff 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -139,6 +139,7 @@ class Service extends BaseModel
$image = data_get($service, 'image');
if ($image) {
$imageName = Str::of($image)->before(':');
+ $imageTag = Str::of($image)->after(':') ?? 'latest';
if (collect(DATABASE_DOCKER_IMAGES)->contains($imageName)) {
$isDatabase = true;
data_set($service, 'is_database', true);
@@ -159,12 +160,14 @@ class Service extends BaseModel
if ($isDatabase) {
$savedService = ServiceDatabase::create([
'name' => $serviceName,
+ 'image_tag' => $imageTag,
'service_id' => $this->id
]);
} else {
$savedService = ServiceApplication::create([
'name' => $serviceName,
'fqdn' => $this->generateFqdn($serviceVariables, $serviceName),
+ 'image_tag' => $imageTag,
'service_id' => $this->id
]);
}
@@ -182,6 +185,8 @@ class Service extends BaseModel
$savedService->save();
}
}
+
+ // Set image tag
$fqdns = data_get($savedService, 'fqdn');
if ($fqdns) {
$fqdns = collect(Str::of($fqdns)->explode(','));
@@ -495,6 +500,8 @@ class Service extends BaseModel
$labels = $labels->merge(fqdnLabelsForTraefik($fqdns, $container_name, true));
}
}
+
+
data_set($service, 'labels', $labels->toArray());
data_forget($service, 'is_database');
data_set($service, 'restart', RESTART_MODE);
diff --git a/database/migrations/2023_09_23_111811_update_service_applications_table.php b/database/migrations/2023_09_23_111811_update_service_applications_table.php
index 9d241aec2..68ddab8d5 100644
--- a/database/migrations/2023_09_23_111811_update_service_applications_table.php
+++ b/database/migrations/2023_09_23_111811_update_service_applications_table.php
@@ -13,6 +13,7 @@ return new class extends Migration
{
Schema::table('service_applications', function (Blueprint $table) {
$table->boolean('ignore_from_status')->default(false);
+ $table->string('image_tag')->nullable();
});
}
@@ -23,6 +24,7 @@ return new class extends Migration
{
Schema::table('service_applications', function (Blueprint $table) {
$table->dropColumn('ignore_from_status');
+ $table->dropColumn('image_tag');
});
}
};
diff --git a/database/migrations/2023_09_23_111812_update_service_databases_table.php b/database/migrations/2023_09_23_111812_update_service_databases_table.php
index 659cbd2a3..bcf42abfd 100644
--- a/database/migrations/2023_09_23_111812_update_service_databases_table.php
+++ b/database/migrations/2023_09_23_111812_update_service_databases_table.php
@@ -13,7 +13,7 @@ return new class extends Migration
{
Schema::table('service_databases', function (Blueprint $table) {
$table->boolean('ignore_from_status')->default(false);
-
+ $table->string('image_tag')->nullable();
});
}
@@ -24,6 +24,7 @@ return new class extends Migration
{
Schema::table('service_databases', function (Blueprint $table) {
$table->dropColumn('ignore_from_status');
+ $table->dropColumn('image_tag');
});
}
};
diff --git a/resources/views/livewire/project/service/application.blade.php b/resources/views/livewire/project/service/application.blade.php
index 282995acb..69f47fc5d 100644
--- a/resources/views/livewire/project/service/application.blade.php
+++ b/resources/views/livewire/project/service/application.blade.php
@@ -16,7 +16,11 @@
placeholder="Human readable name">