diff --git a/app/src/App.php b/app/src/App.php index 0986237b..6110fd69 100644 --- a/app/src/App.php +++ b/app/src/App.php @@ -9,7 +9,7 @@ class App extends Application { - const NAME = "Doil Version 20260624 - build 2026-06-24"; + const NAME = "Doil Version 20260707 - build 2026-07-07"; public function __construct(Command ...$commands) { diff --git a/app/src/Commands/Instances/CreateCommand.php b/app/src/Commands/Instances/CreateCommand.php index 376155ff..0d668d0b 100644 --- a/app/src/Commands/Instances/CreateCommand.php +++ b/app/src/Commands/Instances/CreateCommand.php @@ -354,21 +354,21 @@ public function execute(InputInterface $input, OutputInterface $output) : int if ($keycloak) { $samlpass = $this->generatePassword(33); - $this->docker->setGrain($instance_salt_name, "samlpass", "$samlpass"); + $this->docker->setGrain($instance_salt_name, "samlpass", "${samlpass}"); sleep(1); $samlsalt = $this->generatePassword(33); - $this->docker->setGrain($instance_salt_name, "samlsalt", "$samlsalt"); + $this->docker->setGrain($instance_salt_name, "samlsalt", "${samlsalt}"); sleep(1); } - $this->docker->setGrain($instance_salt_name, "mpass", "$mysql_password"); + $this->docker->setGrain($instance_salt_name, "mpass", "${mysql_password}"); sleep(1); - $this->docker->setGrain($instance_salt_name, "cpass", "$cron_password"); + $this->docker->setGrain($instance_salt_name, "cpass", "${cron_password}"); sleep(1); - $this->docker->setGrain($instance_salt_name, "cron_path", "$cron_path"); + $this->docker->setGrain($instance_salt_name, "cron_path", "${cron_path}"); sleep(1); if ($update_token) { - $this->docker->setGrain($instance_salt_name, "update_token", "${$update_token}"); + $this->docker->setGrain($instance_salt_name, "update_token", "${update_token}"); sleep(1); } $this->docker->setGrain($instance_salt_name, "doil_domain", $http_scheme . $host . "/" . $options["name"]); @@ -747,8 +747,13 @@ protected function gatherOptionData(InputInterface $input, OutputInterface $outp } $options["skip_readme"] = $skip_readme; + $office = false; + if (array_key_exists("enable_office", $doil_conf)) { + $office = $doil_conf['enable_office']; + } + // Enable office support - if (!$enable_office && $one_option_missed && $doil_conf['enable_office']) { + if (!$enable_office && $one_option_missed && $office) { $question = new ConfirmationQuestion( "Enable office support? [yN]: ", false diff --git a/app/src/Commands/Pack/ExportCommand.php b/app/src/Commands/Pack/ExportCommand.php index 4a57851a..1b44956d 100644 --- a/app/src/Commands/Pack/ExportCommand.php +++ b/app/src/Commands/Pack/ExportCommand.php @@ -143,14 +143,6 @@ public function execute(InputInterface $input, OutputInterface $output) : int $this->filesystem->makeDirectoryRecursive($name . "/var/www/html/.git"); $this->filesystem->makeDirectoryRecursive($name . "/conf"); - $idea_paths = $this->filesystem->find_dirs($path, ".idea", 3); - if (count($idea_paths) > 0) { - $idea_path = $idea_paths[0]; - $idea_base_path = substr($idea_path, strlen($path)); - $this->filesystem->makeDirectoryRecursive($name . "/conf" . $idea_base_path); - $this->filesystem->copyDirectory($idea_path, $name . "/conf" . $idea_base_path); - } - $this->docker->copy($instance . "_" . $suffix, "/var/ilias", $name . "/var/"); $this->docker->copy($instance . "_" . $suffix, "/var/www/html/.git/config", $name . "/var/www/html/.git/config"); if ($this->ilias_info->getIliasVersion($path) >= 10) { diff --git a/app/src/Commands/Pack/ImportCommand.php b/app/src/Commands/Pack/ImportCommand.php index 627cbb10..2884ecc1 100644 --- a/app/src/Commands/Pack/ImportCommand.php +++ b/app/src/Commands/Pack/ImportCommand.php @@ -228,16 +228,6 @@ public function execute(InputInterface $input, OutputInterface $output) : int ); } - $idea_paths = $this->filesystem->find_dirs($unpacked . "/conf", ".idea", 3); - if (count($idea_paths) > 0) { - $idea_path = $idea_paths[0]; - $idea_base_path = substr($idea_path, strlen($unpacked . "/conf")); - $this->filesystem->copyDirectory( - $idea_path, - $path . $idea_base_path) - ; - } - if ($this->filesystem->exists($unpacked . "/var/www/html/data")) { $this->filesystem->copyDirectory( $unpacked . "/var/www/html/data", @@ -292,6 +282,13 @@ public function execute(InputInterface $input, OutputInterface $output) : int "-c", "mysql -e 'CREATE DATABASE ilias;'" ); + $this->docker->executeCommand( + $path, + $instance, + "bash", + "-c", + "sed -i '1d' /var/ilias/data/ilias.sql" + ); $this->docker->executeCommand( $path, $instance, diff --git a/app/src/Commands/Pack/PackCreateCommand.php b/app/src/Commands/Pack/PackCreateCommand.php index f3839656..140faaa5 100644 --- a/app/src/Commands/Pack/PackCreateCommand.php +++ b/app/src/Commands/Pack/PackCreateCommand.php @@ -361,17 +361,17 @@ public function execute(InputInterface $input, OutputInterface $output) : int if ($keycloak) { $samlpass = $this->generatePassword(33); $samlsalt = $this->generatePassword(33); - $this->docker->setGrain($instance_salt_name, "samlpass", "$samlpass"); - $this->docker->setGrain($instance_salt_name, "samlsalt", "$samlsalt"); + $this->docker->setGrain($instance_salt_name, "samlpass", "${samlpass}"); + $this->docker->setGrain($instance_salt_name, "samlsalt", "${samlsalt}"); sleep(1); } $this->docker->setGrain($instance_salt_name, "mpass", "${mysql_password}"); sleep(1); - $this->docker->setGrain($instance_salt_name, "cpass", "$cron_password"); + $this->docker->setGrain($instance_salt_name, "cpass", "${cron_password}"); sleep(1); - $this->docker->setGrain($instance_salt_name, "cron_path", "$cron_path"); + $this->docker->setGrain($instance_salt_name, "cron_path", "${cron_path}"); sleep(1); if ($update_token) { $this->docker->setGrain($instance_salt_name, "update_token", "${update_token}"); diff --git a/app/src/Lib/FileSystem/Filesystem.php b/app/src/Lib/FileSystem/Filesystem.php index f8b639e2..a29473db 100644 --- a/app/src/Lib/FileSystem/Filesystem.php +++ b/app/src/Lib/FileSystem/Filesystem.php @@ -36,5 +36,4 @@ public function grepMysqlPasswordFromFile(string $path) : string; public function addToGitConfig(string $path, string $section, string $line) : void; public function parseIniFile(string $path) : array; public function getContent(string $path) : string; - public function find_dirs(string $path, string $name, int $depth = 0) : array; } \ No newline at end of file diff --git a/app/src/Lib/FileSystem/FilesystemShell.php b/app/src/Lib/FileSystem/FilesystemShell.php index 776e4d0b..e33012e2 100644 --- a/app/src/Lib/FileSystem/FilesystemShell.php +++ b/app/src/Lib/FileSystem/FilesystemShell.php @@ -257,12 +257,4 @@ public function getContent(string $path) : string { return file_get_contents($path); } - - public function find_dirs(string $path, string $name, int $depth = 0) : array - { - $output = []; - exec("find -L $path -maxdepth $depth -iname $name -type d", $output); - - return $output; - } } \ No newline at end of file diff --git a/setup/stack/states/dev/devtools/install-sass.sh b/setup/stack/states/dev/devtools/install-sass.sh index 9947bfe7..340455b5 100644 --- a/setup/stack/states/dev/devtools/install-sass.sh +++ b/setup/stack/states/dev/devtools/install-sass.sh @@ -1,4 +1,4 @@ #!/bin/bash npm update -g npm -npm install -g sass \ No newline at end of file +npm install -g sass@1.77.5 \ No newline at end of file diff --git a/setup/templates/mail/docker-compose.yml b/setup/templates/mail/docker-compose.yml index ad04db5a..345dd4b2 100755 --- a/setup/templates/mail/docker-compose.yml +++ b/setup/templates/mail/docker-compose.yml @@ -7,6 +7,13 @@ services: container_name: doil_mail hostname: doil domainname: mail + healthcheck: + test: "doveadm service status || exit 1" + interval: 10s + timeout: 5s + retries: 3 + start_period: 40s + start_interval: 5s networks: doil_proxy: ipv4_address: 172.24.0.253 diff --git a/setup/templates/minion/docker-compose.yml b/setup/templates/minion/docker-compose.yml index 10ed9813..16a25497 100755 --- a/setup/templates/minion/docker-compose.yml +++ b/setup/templates/minion/docker-compose.yml @@ -49,6 +49,13 @@ services: - type: bind source: ./conf/salt-minion.conf target: /etc/supervisor/conf.d/salt-minion.conf + healthcheck: + test: "curl -f http://localhost && mysql -u root --execute \"SHOW DATABASES;\" || exit 1" + interval: 10s + timeout: 5s + retries: 3 + start_period: 40s + start_interval: 5s environment: - ILIAS_INI_PATH=/var/www/html/ilias.ini.php - TZ=Europe/Berlin diff --git a/setup/templates/proxy/docker-compose.yml b/setup/templates/proxy/docker-compose.yml index 9a47b8de..f15c5169 100755 --- a/setup/templates/proxy/docker-compose.yml +++ b/setup/templates/proxy/docker-compose.yml @@ -7,6 +7,13 @@ services: container_name: doil_proxy hostname: doil domainname: proxy + healthcheck: + test: ["CMD", "service", "nginx", "status"] + interval: 10s + timeout: 5s + retries: 3 + start_period: 40s + start_interval: 5s networks: doil_proxy: ipv4_address: 172.24.0.254 diff --git a/setup/templates/salt/docker-compose.yml b/setup/templates/salt/docker-compose.yml index 5cd1e826..6daec295 100755 --- a/setup/templates/salt/docker-compose.yml +++ b/setup/templates/salt/docker-compose.yml @@ -13,6 +13,13 @@ services: networks: saltnet: ipv4_address: 172.20.0.254 + healthcheck: + test: "salt-master --version || exit 1" + interval: 10s + timeout: 5s + retries: 3 + start_period: 40s + start_interval: 5s networks: saltnet: ipam: diff --git a/setup/updates/update-20260707.sh b/setup/updates/update-20260707.sh new file mode 100644 index 00000000..20434c0f --- /dev/null +++ b/setup/updates/update-20260707.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +doil_update_20260707() { + cp -r ${SCRIPT_DIR}/../app/src/* /usr/local/lib/doil/app/src/ + cp -r ${SCRIPT_DIR}/../setup/stack/states/dev/* /usr/local/share/doil/stack/states/dev/ + cp -r ${SCRIPT_DIR}/../setup/templates/salt/docker-compose.yml /usr/local/lib/doil/server/salt/ + cp -r ${SCRIPT_DIR}/../setup/templates/mail/docker-compose.yml /usr/local/lib/doil/server/mail/ + cp -r ${SCRIPT_DIR}/../setup/templates/proxy/docker-compose.yml /usr/local/lib/doil/server/proxy/ + + apt-get install yq -y >/var/log/doil/stream.log 2>&1 + + for DIR in /home/$SUDO_USER/.doil/instances/* + do + if [[ -d "$DIR" ]] + then + yq -S '.services.[].healthcheck |= . + {"test": "curl -f http://localhost && mysql -u root --execute \"SHOW DATABASES;\" || exit 1", "interval": "10s", "timeout": "5s", "retries": "3", "start_period": "40s", "start_interval": "5s"}' "${DIR}"/docker-compose.yml > "${DIR}"/tmp.yml && mv "${DIR}"/tmp.yml "${DIR}"/docker-compose.yml >/var/log/doil/stream.log 2>&1 + fi + done + + for DIR in $(doil_get_conf global_instances_path=)/* + do + if [[ -d "$DIR" ]] + then + yq -S '.services.[].healthcheck |= . + {"test": "curl -f http://localhost && mysql -u root --execute \"SHOW DATABASES;\" || exit 1", "interval": "10s", "timeout": "5s", "retries": "3", "start_period": "40s", "start_interval": "5s"}' "${DIR}"/docker-compose.yml > "${DIR}"/tmp.yml && mv "${DIR}"/tmp.yml "${DIR}"/docker-compose.yml >/var/log/doil/stream.log 2>&1 + fi + done + + apt-get remove yq -y >/var/log/doil/stream.log 2>&1 + + return $? +} \ No newline at end of file