From 972f375073dd2e97d28b83311eaf097aa5a3f984 Mon Sep 17 00:00:00 2001 From: daniwe4 Date: Thu, 23 Mar 2023 10:24:03 +0100 Subject: [PATCH] frh states:308 add node state for ilias instances >= 9 --- app/src/Commands/Instances/CreateCommand.php | 7 +++++++ setup/stack/config/master.cnf | 2 ++ setup/stack/states/access/access/init.sls | 9 --------- setup/stack/states/nodejs/nodejs/init.sls | 21 ++++++++++++++++++++ setup/stack/states/nodejs/top.sls | 3 +++ setup/stack/states/php7.2/php/init.sls | 1 + setup/stack/states/php7.3/php/init.sls | 1 + setup/stack/states/php7.4/php/init.sls | 1 + setup/stack/states/php8.0/php/init.sls | 1 + setup/stack/states/php8.1/php/init.sls | 2 ++ setup/stack/states/php8.2/php/init.sls | 2 ++ 11 files changed, 41 insertions(+), 9 deletions(-) create mode 100755 setup/stack/states/nodejs/nodejs/init.sls create mode 100755 setup/stack/states/nodejs/top.sls diff --git a/app/src/Commands/Instances/CreateCommand.php b/app/src/Commands/Instances/CreateCommand.php index d2077d10..bd28082e 100644 --- a/app/src/Commands/Instances/CreateCommand.php +++ b/app/src/Commands/Instances/CreateCommand.php @@ -341,6 +341,13 @@ public function execute(InputInterface $input, OutputInterface $output) : int $this->writer->endBlock(); } + // apply npm-update state + if ($ilias_version >= 9.0) { + $this->writer->beginBlock($output, "Apply nodejs state"); + $this->docker->applyState($instance_salt_name, "nodejs"); + $this->writer->endBlock(); + } + // apply enable-xdebug state if ($options['xdebug']) { $this->writer->beginBlock($output, "Apply enable-xdebug state"); diff --git a/setup/stack/config/master.cnf b/setup/stack/config/master.cnf index 132e91e5..8ee1e5a1 100755 --- a/setup/stack/config/master.cnf +++ b/setup/stack/config/master.cnf @@ -690,6 +690,8 @@ file_roots: - /srv/salt/states/mailservices proxyservices: - /srv/salt/states/proxyservices + nodejs: + - /srv/salt/states/nodejs # The master_roots setting configures a master-only copy of the file_roots dictionary, diff --git a/setup/stack/states/access/access/init.sls b/setup/stack/states/access/access/init.sls index 9ae8faf9..5cdcca2e 100755 --- a/setup/stack/states/access/access/init.sls +++ b/setup/stack/states/access/access/init.sls @@ -1,14 +1,5 @@ {% set doil_host_system = salt['grains.get']('doil_host_system', 'linux') %} -packages_check: - pkg.installed: - - pkgs: - - ftp - - curl - - imagemagick - - ghostscript - - npm - /var/www/html/: file.directory: - user: www-data diff --git a/setup/stack/states/nodejs/nodejs/init.sls b/setup/stack/states/nodejs/nodejs/init.sls new file mode 100755 index 00000000..21e62904 --- /dev/null +++ b/setup/stack/states/nodejs/nodejs/init.sls @@ -0,0 +1,21 @@ +get_npm_by_curl: + cmd.run: + - name: curl -sL https://deb.nodesource.com/setup_16.x | bash - + +install_node_js: + cmd.run: + - name: apt -y install nodejs + - watch: + - get_npm_by_curl + +update_npm: + cmd.run: + - name: npm install -g npm@9.6.2 + - watch: + - install_node_js + +install_ilias_npm_packages: + cmd.run: + - name: cd /var/www/html && npm install --ignore-scripts + - watch: + - update_npm \ No newline at end of file diff --git a/setup/stack/states/nodejs/top.sls b/setup/stack/states/nodejs/top.sls new file mode 100755 index 00000000..3237721b --- /dev/null +++ b/setup/stack/states/nodejs/top.sls @@ -0,0 +1,3 @@ +nodejs: + '*': + - nodejs \ No newline at end of file diff --git a/setup/stack/states/php7.2/php/init.sls b/setup/stack/states/php7.2/php/init.sls index 7a6a28dc..81e93215 100755 --- a/setup/stack/states/php7.2/php/init.sls +++ b/setup/stack/states/php7.2/php/init.sls @@ -57,6 +57,7 @@ php{{ version }}: - php{{ version }}-xmlrpc - php{{ version }}-xsl - php{{ version }}-zip + - php{{ version }}-imagick {% endfor %} ini_filesize_apache2: diff --git a/setup/stack/states/php7.3/php/init.sls b/setup/stack/states/php7.3/php/init.sls index 1052d97c..3263c285 100755 --- a/setup/stack/states/php7.3/php/init.sls +++ b/setup/stack/states/php7.3/php/init.sls @@ -57,6 +57,7 @@ php{{ version }}: - php{{ version }}-xmlrpc - php{{ version }}-xsl - php{{ version }}-zip + - php{{ version }}-imagick {% endfor %} ini_filesize_apache2: diff --git a/setup/stack/states/php7.4/php/init.sls b/setup/stack/states/php7.4/php/init.sls index db3daf1d..343058f7 100755 --- a/setup/stack/states/php7.4/php/init.sls +++ b/setup/stack/states/php7.4/php/init.sls @@ -57,6 +57,7 @@ php{{ version }}: - php{{ version }}-xmlrpc - php{{ version }}-xsl - php{{ version }}-zip + - php{{ version }}-imagick {% endfor %} ini_filesize_apache2: diff --git a/setup/stack/states/php8.0/php/init.sls b/setup/stack/states/php8.0/php/init.sls index 32494071..ddd09eeb 100755 --- a/setup/stack/states/php8.0/php/init.sls +++ b/setup/stack/states/php8.0/php/init.sls @@ -57,6 +57,7 @@ php{{ version }}: - php{{ version }}-xmlrpc - php{{ version }}-xsl - php{{ version }}-zip + - php{{ version }}-imagick {% endfor %} ini_filesize_apache2: diff --git a/setup/stack/states/php8.1/php/init.sls b/setup/stack/states/php8.1/php/init.sls index e4ca352b..1f40c89e 100755 --- a/setup/stack/states/php8.1/php/init.sls +++ b/setup/stack/states/php8.1/php/init.sls @@ -33,6 +33,7 @@ php8.1: - php8.1-xmlrpc - php8.1-xsl - php8.1-zip + - php8.1-imagick {% for version in ['7.0','7.1','7.2','7.3','7.4','8.0','8.2'] %} php{{ version }}: @@ -57,6 +58,7 @@ php{{ version }}: - php{{ version }}-xmlrpc - php{{ version }}-xsl - php{{ version }}-zip + - php{{ version }}-imagick {% endfor %} ini_filesize_apache2: diff --git a/setup/stack/states/php8.2/php/init.sls b/setup/stack/states/php8.2/php/init.sls index 88a6f2f6..e319fe41 100755 --- a/setup/stack/states/php8.2/php/init.sls +++ b/setup/stack/states/php8.2/php/init.sls @@ -33,6 +33,7 @@ php8.2: - php8.2-xmlrpc - php8.2-xsl - php8.2-zip + - php8.2-imagick {% for version in ['7.0','7.1','7.2','7.3','7.4','8.0','8.1'] %} php{{ version }}: @@ -57,6 +58,7 @@ php{{ version }}: - php{{ version }}-xmlrpc - php{{ version }}-xsl - php{{ version }}-zip + - php{{ version }}-imagick {% endfor %} ini_filesize_apache2: