Fix: DB image cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ class StopDatabase
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database, bool $isDeleteOperation = false)
|
||||
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database, bool $isDeleteOperation = false, bool $dockerCleanup = true)
|
||||
{
|
||||
$server = $database->destination->server;
|
||||
if (!$server->isFunctional()) {
|
||||
@@ -28,8 +28,10 @@ class StopDatabase
|
||||
$this->stopContainer($database, $database->uuid, 300);
|
||||
if (!$isDeleteOperation) {
|
||||
$this->deleteConnectedNetworks($database->uuid, $server); //Probably not needed as DBs do not have a network normally
|
||||
if ($dockerCleanup) {
|
||||
CleanupDocker::run($server, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($database->is_public) {
|
||||
StopDatabaseProxy::run($database);
|
||||
|
||||
@@ -14,6 +14,8 @@ class Heading extends Component
|
||||
|
||||
public array $parameters;
|
||||
|
||||
public $docker_cleanup = true;
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
$userId = auth()->user()->id;
|
||||
@@ -54,7 +56,7 @@ class Heading extends Component
|
||||
|
||||
public function stop()
|
||||
{
|
||||
StopDatabase::run($this->database);
|
||||
StopDatabase::run($this->database, false, $this->docker_cleanup);
|
||||
$this->database->status = 'exited';
|
||||
$this->database->save();
|
||||
$this->check_status();
|
||||
@@ -71,4 +73,13 @@ class Heading extends Component
|
||||
$activity = StartDatabase::run($this->database);
|
||||
$this->dispatch('activityMonitor', $activity->id);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.database.heading', [
|
||||
'checkboxes' => [
|
||||
['id' => 'docker_cleanup', 'label' => 'Docker cleanup will be run on the server which removes builder cache and unused images (the next deployment will take longer as the images have to be pulled again)'],
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,11 @@
|
||||
title="Confirm Database Stopping?"
|
||||
buttonTitle="Stop"
|
||||
submitAction="stop"
|
||||
:checkboxes="$checkboxes"
|
||||
:actions="['This database will be stopped.', 'If the database is currently in use data could be lost.', 'All non-persistent data of this database (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the database again).']"
|
||||
:confirmWithText="false"
|
||||
:confirmWithPassword="false"
|
||||
step1ButtonText="Continue Stopping Database"
|
||||
step2ButtonText="Stop Database"
|
||||
:dispatchEvent="true"
|
||||
dispatchEventType="stopEvent"
|
||||
|
||||
Reference in New Issue
Block a user