From 61444a05ff21fae5a9d5f6690d1b1f5b0332e135 Mon Sep 17 00:00:00 2001 From: Florian <51517706+Florianb63@users.noreply.github.com> Date: Fri, 20 Jun 2025 10:14:03 +0200 Subject: [PATCH 1/5] add itsmng app script --- ct/headers/itsmng | 6 +++ ct/itsmng.sh | 47 +++++++++++++++++++++++ install/itsmng-install.sh | 81 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 ct/headers/itsmng create mode 100644 ct/itsmng.sh create mode 100644 install/itsmng-install.sh diff --git a/ct/headers/itsmng b/ct/headers/itsmng new file mode 100644 index 00000000..04c32327 --- /dev/null +++ b/ct/headers/itsmng @@ -0,0 +1,6 @@ + _ _ +(_) |_ ___ _ __ ___ _ __ __ _ +| | __/ __| '_ ` _ \| '_ \ / _` | +| | |_\__ \ | | | | | | | | (_| | +|_|\__|___/_| |_| |_|_| |_|\__, | + |___/ diff --git a/ct/itsmng.sh b/ct/itsmng.sh new file mode 100644 index 00000000..4ef853ac --- /dev/null +++ b/ct/itsmng.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/Florianb63/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://itsm-ng.com/ + +APP="itsmng" +var_tags="${var_tags:-asset-management;foss}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-10}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /etc/itsm-ng/config_db.php ]]; then + msg_error "No ${APP} Installation Found!" + exit 1 + fi + + msg_info "Updating ${APP} LXC" + $STD apt-get update + $STD apt-get -y upgrade + msg_ok "Updated Successfully" + + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" diff --git a/install/itsmng-install.sh b/install/itsmng-install.sh new file mode 100644 index 00000000..e9403fd7 --- /dev/null +++ b/install/itsmng-install.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: NĂ­colas Pastorello (opastorello) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://itsm-ng.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + curl \ + gnupg +msg_ok "Installed Dependencies" + +msg_info "Installing Repository" +curl -fsSL http://deb.itsm-ng.org/pubkey.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/itsm-ng-keyring.gpg +echo "deb http://deb.itsm-ng.org/$(. /etc/os-release && echo "$ID")/ $(. /etc/os-release && echo "$VERSION_CODENAME") main" > /etc/apt/sources.list.d/itsm-ng.list +$STD apt update +msg_ok "Installed Repository" + +msg_info "Installing ITSM-NG" +$STD apt install -y itsm-ng +msg_ok "Installed ITSM-NG" + +msg_info "Setting up database" +DB_NAME=itsmng_db +DB_USER=itsmng +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +mariadb-tzinfo-to-sql /usr/share/zoneinfo | mysql mysql +mariadb -u root -e "CREATE DATABASE $DB_NAME;" +mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" +mariadb -u root -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost';" +mariadb -u root -e "GRANT SELECT ON \`mysql\`.\`time_zone_name\` TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" +{ + echo "ITSM-NG Database Credentials" + echo "Database: $DB_NAME" + echo "Username: $DB_USER" + echo "Password: $DB_PASS" +} >>~/itsmng_db.creds +msg_ok "Set up database" + +msg_info "Installing ITSM-NG" +cd /usr/share/itsm-ng +$STD php bin/console db:install --db-name=$DB_NAME --db-user=$DB_USER --db-password=$DB_PASS --no-interaction +msg_ok "Installed ITSM-NG" + +msg_info "Configuring webserver" +$STD a2dissite 000-default.conf +msg_ok "Setup Service" + +msg_info "Setup Cronjob" +echo "* * * * * php /usr/share/itsm-ng/front/cron.php" | crontab - +msg_ok "Setup Cronjob" + +msg_info "Update PHP Params" +PHP_VERSION=$(ls /etc/php/ | grep -E '^[0-9]+\.[0-9]+$' | head -n 1) +PHP_INI="/etc/php/$PHP_VERSION/apache2/php.ini" +sed -i 's/^upload_max_filesize = .*/upload_max_filesize = 20M/' $PHP_INI +sed -i 's/^post_max_size = .*/post_max_size = 20M/' $PHP_INI +sed -i 's/^max_execution_time = .*/max_execution_time = 60/' $PHP_INI +sed -i 's/^max_input_vars = .*/max_input_vars = 5000/' $PHP_INI +sed -i 's/^memory_limit = .*/memory_limit = 256M/' $PHP_INI +sed -i 's/^;\?\s*session.cookie_httponly\s*=.*/session.cookie_httponly = On/' $PHP_INI +systemctl restart apache2 +msg_ok "Update PHP Params" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf /usr/share/itsm-ng/install +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From 8e5b9167a0cf7a9722fa433c95c4c0deabdb40bd Mon Sep 17 00:00:00 2001 From: Florian <51517706+Florianb63@users.noreply.github.com> Date: Fri, 20 Jun 2025 10:21:49 +0200 Subject: [PATCH 2/5] add itsmng script --- frontend/public/json/itsmng.json | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 frontend/public/json/itsmng.json diff --git a/frontend/public/json/itsmng.json b/frontend/public/json/itsmng.json new file mode 100644 index 00000000..fe7339b0 --- /dev/null +++ b/frontend/public/json/itsmng.json @@ -0,0 +1,35 @@ +{ + "name": "ITSMNG", + "slug": "itsmng", + "categories": [ + 25 + ], + "date_created": "2025-06-20", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://wiki.itsm-ng.org/en/home", + "website": "https://itsm-ng.com", + "logo": "https://itsm-ng.com/web/image/website/1/logo/ITSM-NG", + "config_path": "/etc/itsm-ng", + "description": "ITSM-NG is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.", + "install_methods": [ + { + "type": "default", + "script": "ct/itsmng.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 10, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": "itsm", + "password": "itsm" + }, + "notes": [] +} From e078572cb4a9a04fcfa0a3c9fd2f27e3245e2db1 Mon Sep 17 00:00:00 2001 From: Florian <51517706+Florianb63@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:00:09 +0200 Subject: [PATCH 3/5] fix: remove unneeded task, and add setup_mariadb --- install/itsmng-install.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/install/itsmng-install.sh b/install/itsmng-install.sh index e9403fd7..fc202966 100644 --- a/install/itsmng-install.sh +++ b/install/itsmng-install.sh @@ -13,11 +13,7 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - curl \ - gnupg -msg_ok "Installed Dependencies" +setup_mariadb msg_info "Installing Repository" curl -fsSL http://deb.itsm-ng.org/pubkey.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/itsm-ng-keyring.gpg From 50b94ddc88e8aec8c7261800008f6421ef571010 Mon Sep 17 00:00:00 2001 From: Florian <51517706+Florianb63@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:04:08 +0200 Subject: [PATCH 4/5] fix: remove header --- ct/headers/itsmng | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 ct/headers/itsmng diff --git a/ct/headers/itsmng b/ct/headers/itsmng deleted file mode 100644 index 04c32327..00000000 --- a/ct/headers/itsmng +++ /dev/null @@ -1,6 +0,0 @@ - _ _ -(_) |_ ___ _ __ ___ _ __ __ _ -| | __/ __| '_ ` _ \| '_ \ / _` | -| | |_\__ \ | | | | | | | | (_| | -|_|\__|___/_| |_| |_|_| |_|\__, | - |___/ From 595d05cc0a4f6e144d216001b5c085ec461ebad0 Mon Sep 17 00:00:00 2001 From: Florian <51517706+Florianb63@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:36:43 +0200 Subject: [PATCH 5/5] fix author and source --- ct/itsmng.sh | 4 ++-- install/itsmng-install.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ct/itsmng.sh b/ct/itsmng.sh index 4ef853ac..b0117b05 100644 --- a/ct/itsmng.sh +++ b/ct/itsmng.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/Florianb63/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG -# Author: MickLesk (CanbiZ) +# Author: Florianb63 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://itsm-ng.com/ diff --git a/install/itsmng-install.sh b/install/itsmng-install.sh index fc202966..2879d1ca 100644 --- a/install/itsmng-install.sh +++ b/install/itsmng-install.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Copyright (c) 2021-2025 community-scripts ORG -# Author: NĂ­colas Pastorello (opastorello) +# Author: Florianb63 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://itsm-ng.com/