mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-09-26 16:44:52 +08:00
improve is_backup_container_running check
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
3e5ab69512
commit
e3826f85b9
3 changed files with 28 additions and 19 deletions
|
@ -74,13 +74,14 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
|
||||||
return $view->render($response, 'containers.twig', [
|
return $view->render($response, 'containers.twig', [
|
||||||
'domain' => $configurationManager->GetDomain(),
|
'domain' => $configurationManager->GetDomain(),
|
||||||
'borg_backup_host_location' => $configurationManager->GetBorgBackupHostLocation(),
|
'borg_backup_host_location' => $configurationManager->GetBorgBackupHostLocation(),
|
||||||
'borg_backup_mode' => $configurationManager->GetBorgBackupMode(),
|
|
||||||
'nextcloud_password' => $configurationManager->GetSecret('NEXTCLOUD_PASSWORD'),
|
'nextcloud_password' => $configurationManager->GetSecret('NEXTCLOUD_PASSWORD'),
|
||||||
'containers' => (new \AIO\ContainerDefinitionFetcher($container->get(\AIO\Data\ConfigurationManager::class), $container))->FetchDefinition(),
|
'containers' => (new \AIO\ContainerDefinitionFetcher($container->get(\AIO\Data\ConfigurationManager::class), $container))->FetchDefinition(),
|
||||||
'borgbackup_password' => $configurationManager->GetSecret('BORGBACKUP_PASSWORD'),
|
'borgbackup_password' => $configurationManager->GetSecret('BORGBACKUP_PASSWORD'),
|
||||||
'is_mastercontainer_update_available' => $dockerActionManger->IsMastercontainerUpdateAvailable(),
|
'is_mastercontainer_update_available' => $dockerActionManger->IsMastercontainerUpdateAvailable(),
|
||||||
'has_backup_run_once' => $configurationManager->hasBackupRunOnce(),
|
'has_backup_run_once' => $configurationManager->hasBackupRunOnce(),
|
||||||
|
'is_backup_container_running' => $dockerActionManger->isBackupContainerRunning(),
|
||||||
'backup_exit_code' => $dockerActionManger->GetBackupcontainerExitCode(),
|
'backup_exit_code' => $dockerActionManger->GetBackupcontainerExitCode(),
|
||||||
|
'borg_backup_mode' => $configurationManager->GetBorgBackupMode(),
|
||||||
'was_start_button_clicked' => $configurationManager->wasStartButtonClicked(),
|
'was_start_button_clicked' => $configurationManager->wasStartButtonClicked(),
|
||||||
'has_update_available' => $dockerActionManger->isAnyUpdateAvailable(),
|
'has_update_available' => $dockerActionManger->isAnyUpdateAvailable(),
|
||||||
'last_backup_time' => $configurationManager->GetLastBackupTime(),
|
'last_backup_time' => $configurationManager->GetLastBackupTime(),
|
||||||
|
|
|
@ -600,4 +600,13 @@ class DockerActionManager
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isBackupContainerRunning() : bool {
|
||||||
|
$id = 'nextcloud-aio-borgbackup';
|
||||||
|
$backupContainer = $this->containerDefinitionFetcher->GetContainerById($id);
|
||||||
|
if ($this->GetContainerRunningState($backupContainer) instanceof RunningState) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,19 @@
|
||||||
{% set isAnyRunning = false %}
|
{% set isAnyRunning = false %}
|
||||||
{% set isAnyRestarting = false %}
|
{% set isAnyRestarting = false %}
|
||||||
{% set isWatchtowerRunning = false %}
|
{% set isWatchtowerRunning = false %}
|
||||||
{% set isBackupContainerRunning = false %}
|
|
||||||
{% set isRestoreRunning = false %}
|
{% set isRestoreRunning = false %}
|
||||||
{% set isBackupOrRestoreRunning = false %}
|
{% set isBackupOrRestoreRunning = false %}
|
||||||
{% set isApacheStarting = false %}
|
{% set isApacheStarting = false %}
|
||||||
|
|
||||||
|
{% if is_backup_container_running == true %}
|
||||||
|
{% if borg_backup_mode == 'restore' %}
|
||||||
|
{% set isRestoreRunning = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% if borg_backup_mode == 'backup' or borg_backup_mode == 'restore' %}
|
||||||
|
{% set isBackupOrRestoreRunning = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for container in containers %}
|
{% for container in containers %}
|
||||||
{% if container.GetIdentifier() not in ['nextcloud-aio-domaincheck', 'nextcloud-aio-borgbackup', 'nextcloud-aio-watchtower'] and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
|
{% if container.GetIdentifier() not in ['nextcloud-aio-domaincheck', 'nextcloud-aio-borgbackup', 'nextcloud-aio-watchtower'] and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
|
||||||
{% set isAnyRunning = true %}
|
{% set isAnyRunning = true %}
|
||||||
|
@ -40,22 +48,13 @@
|
||||||
{% if container.GetIdentifier() == 'nextcloud-aio-apache' and class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %}
|
{% if container.GetIdentifier() == 'nextcloud-aio-apache' and class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %}
|
||||||
{% set isApacheStarting = true %}
|
{% set isApacheStarting = true %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if container.GetIdentifier() == 'nextcloud-aio-borgbackup' and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
|
|
||||||
{% set isBackupContainerRunning = true %}
|
|
||||||
{% if borg_backup_mode == 'restore' %}
|
|
||||||
{% set isRestoreRunning = true %}
|
|
||||||
{% endif %}
|
|
||||||
{% if borg_backup_mode == 'backup' or borg_backup_mode == 'restore' %}
|
|
||||||
{% set isBackupOrRestoreRunning = true %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if isWatchtowerRunning == true %}
|
{% if isWatchtowerRunning == true %}
|
||||||
<span class="status running"></span> Mastercontainer update currently running. It will restart the mastercontainer soon which will make it unavailable for a moment. Please wait until that's done. (<a href="/api/docker/logs?id=nextcloud-aio-mastercontainer">Logs</a>)<br /><br />
|
<span class="status running"></span> Mastercontainer update currently running. It will restart the mastercontainer soon which will make it unavailable for a moment. Please wait until that's done. (<a href="/api/docker/logs?id=nextcloud-aio-mastercontainer">Logs</a>)<br /><br />
|
||||||
<a href="" class="button reload">Reload ↻</a><br/>
|
<a href="" class="button reload">Reload ↻</a><br/>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if isBackupContainerRunning == false and domain == "" %}
|
{% if is_backup_container_running == false and domain == "" %}
|
||||||
{% if is_mastercontainer_update_available == true %}
|
{% if is_mastercontainer_update_available == true %}
|
||||||
<h2>Mastercontainer update</h2>
|
<h2>Mastercontainer update</h2>
|
||||||
⚠ A mastercontainer update is available. Please click on the button below to update it. Afterwards, you will be able to proceed with the setup.<br><br>
|
⚠ A mastercontainer update is available. Please click on the button below to update it. Afterwards, you will be able to proceed with the setup.<br><br>
|
||||||
|
@ -145,7 +144,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if isBackupContainerRunning == true %}
|
{% if is_backup_container_running == true %}
|
||||||
<span class="status running"></span> Backup container is currently running. (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
|
<span class="status running"></span> Backup container is currently running. (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
|
||||||
<a href="" class="button reload">Reload ↻</a><br/><br>
|
<a href="" class="button reload">Reload ↻</a><br/><br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -264,7 +263,7 @@
|
||||||
|
|
||||||
{% if was_start_button_clicked == true %}
|
{% if was_start_button_clicked == true %}
|
||||||
|
|
||||||
{% if isBackupContainerRunning == false and borg_backup_host_location == "" and isApacheStarting != true %}
|
{% if is_backup_container_running == false and borg_backup_host_location == "" and isApacheStarting != true %}
|
||||||
<h2>Backup and restore</h2>
|
<h2>Backup and restore</h2>
|
||||||
Please type in the directory where backups will get created on the host system:<br><br>
|
Please type in the directory where backups will get created on the host system:<br><br>
|
||||||
<form method="POST" action="/api/configuration" class="xhr">
|
<form method="POST" action="/api/configuration" class="xhr">
|
||||||
|
@ -278,7 +277,7 @@
|
||||||
|
|
||||||
{% if borg_backup_host_location != "" %}
|
{% if borg_backup_host_location != "" %}
|
||||||
<h2>Backup and restore</h2>
|
<h2>Backup and restore</h2>
|
||||||
{% if isBackupContainerRunning == false %}
|
{% if is_backup_container_running == false %}
|
||||||
{% if backup_exit_code > 0 %}
|
{% if backup_exit_code > 0 %}
|
||||||
<span class="status error"></span> Last {{ borg_backup_mode }} failed! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
|
<span class="status error"></span> Last {{ borg_backup_mode }} failed! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
|
||||||
{% elseif backup_exit_code == 0 %}
|
{% elseif backup_exit_code == 0 %}
|
||||||
|
@ -290,7 +289,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if isBackupContainerRunning == false %}
|
{% if is_backup_container_running == false %}
|
||||||
{% if has_backup_run_once == true %}
|
{% if has_backup_run_once == true %}
|
||||||
<details>
|
<details>
|
||||||
<summary>Click here to reveal all backup options</summary><br />
|
<summary>Click here to reveal all backup options</summary><br />
|
||||||
|
@ -343,7 +342,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if isBackupContainerRunning == false %}
|
{% if is_backup_container_running == false %}
|
||||||
{% if isApacheStarting == false %}
|
{% if isApacheStarting == false %}
|
||||||
<h2>AIO password change</h2>
|
<h2>AIO password change</h2>
|
||||||
You can change your AIO password below:<br><br />
|
You can change your AIO password below:<br><br />
|
||||||
|
@ -358,7 +357,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if isBackupContainerRunning == false %}
|
{% if is_backup_container_running == false %}
|
||||||
<h2>Optional addons</h2>
|
<h2>Optional addons</h2>
|
||||||
In this section, you can find optional addons.<br>
|
In this section, you can find optional addons.<br>
|
||||||
You can enable or disaable them when your containers are stopped.<br><br>
|
You can enable or disaable them when your containers are stopped.<br><br>
|
||||||
|
@ -400,7 +399,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if isApacheStarting == true or isBackupContainerRunning == true or isWatchtowerRunning == true %}
|
{% if isApacheStarting == true or is_backup_container_running == true or isWatchtowerRunning == true %}
|
||||||
<script type="text/javascript" src="automatic_reload.js"></script>
|
<script type="text/javascript" src="automatic_reload.js"></script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<script type="text/javascript" src="before-unload.js"></script>
|
<script type="text/javascript" src="before-unload.js"></script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue