diff --git a/app/src/App.php b/app/src/App.php index 4505a737..d476909a 100644 --- a/app/src/App.php +++ b/app/src/App.php @@ -9,7 +9,7 @@ class App extends Application { - const NAME = "Doil Version 20240930 - build 2024-09-30"; + const NAME = "Doil Version 20241010 - build 2024-10-10"; public function __construct(Command ...$commands) { diff --git a/app/src/Commands/Instances/DeleteCommand.php b/app/src/Commands/Instances/DeleteCommand.php index 2a25decf..72cbffa2 100644 --- a/app/src/Commands/Instances/DeleteCommand.php +++ b/app/src/Commands/Instances/DeleteCommand.php @@ -139,10 +139,12 @@ protected function deleteInstance( $this->docker->removeContainer($instance . "_" . $suffix); $this->docker->executeCommand(self::SALT_MAIN, "doil_saltmain", "salt-key", "-d", "$instance.$suffix", "-y", "-q"); - $this->docker->executeDockerCommand( - "doil_proxy", - "rm -f /etc/nginx/conf.d/sites/$instance.conf && /root/generate_index_html.sh" - ); + if ($this->docker->isInstanceUp($path)) { + $this->docker->executeDockerCommand( + "doil_proxy", + "rm -f /etc/nginx/conf.d/sites/$instance.conf && /root/generate_index_html.sh" + ); + } if ($this->docker->hasVolume($instance)) { $this->docker->removeVolume($instance); diff --git a/app/tests/Commands/Instances/DeleteCommandTest.php b/app/tests/Commands/Instances/DeleteCommandTest.php index 487d1c15..27d22399 100644 --- a/app/tests/Commands/Instances/DeleteCommandTest.php +++ b/app/tests/Commands/Instances/DeleteCommandTest.php @@ -180,6 +180,12 @@ public function test_execute() : void ["/usr/local/lib/doil/server/mail/", "doil_mail", "/bin/bash", "-c", "/root/delete-postbox-configuration.sh $instance &>/dev/null"] ) ; + $docker + ->expects($this->once()) + ->method("isInstanceUp") + ->with("/usr/local/share/doil/instances/master") + ->willReturn(true) + ; $docker ->expects($this->once()) ->method("executeDockerCommand") diff --git a/setup/stack/states/apache/apache/default b/setup/stack/states/apache/apache/default index 389f2192..f7260198 100755 --- a/setup/stack/states/apache/apache/default +++ b/setup/stack/states/apache/apache/default @@ -7,6 +7,7 @@ AllowOverride All + Options -Indexes Require all granted diff --git a/setup/updates/update-20241010.sh b/setup/updates/update-20241010.sh new file mode 100644 index 00000000..ae6231c8 --- /dev/null +++ b/setup/updates/update-20241010.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +doil_update_20241010() { + cp -r ${SCRIPT_DIR}/../app/src/* /usr/local/lib/doil/app/src/ + cp -r ${SCRIPT_DIR}/../setup/stack/* /usr/local/share/doil/stack/ + docker exec -i doil_saltmain bash -c "salt -C '*.local or *.global' state.highstate saltenv=apache" + return $? +} \ No newline at end of file