From b749119a1c3b7a8b5997ab9f41cff4bebe88166e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Thu, 20 Feb 2025 09:51:32 +0100 Subject: [PATCH] New Script: Dolibarr (#2502) * Add Dolibarr script * Moved mariadb into dependencies * Fixed updatable to true --- ct/dolibarr.sh | 41 ++++++++++++++++++++++++++++ install/dolibarr-install.sh | 53 +++++++++++++++++++++++++++++++++++++ json/dolibarr.json | 39 +++++++++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 ct/dolibarr.sh create mode 100644 install/dolibarr-install.sh create mode 100644 json/dolibarr.json diff --git a/ct/dolibarr.sh b/ct/dolibarr.sh new file mode 100644 index 000000000..ab8ef73ea --- /dev/null +++ b/ct/dolibarr.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/Dolibarr/dolibarr/ + +APP="Dolibarr" +var_tags="erp;accounting" +var_cpu="1" +var_ram="2048" +var_disk="6" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /usr/share/dolibarr ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_error "To update ${APP}, use the applications web interface." + 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}/dolibarr/install${CL}" diff --git a/install/dolibarr-install.sh b/install/dolibarr-install.sh new file mode 100644 index 000000000..cc09e54aa --- /dev/null +++ b/install/dolibarr-install.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/Dolibarr/dolibarr/ + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + php-imap \ + debconf-utils \ + mariadb-server +msg_ok "Installed Dependencies" + +msg_info "Setting up Database" +ROOT_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD sudo mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$ROOT_PASS'); flush privileges;" +{ + echo "Dolibarr DB Credentials" + echo "MariaDB Root Password: $ROOT_PASS" +} >> ~/dolibarr.creds +msg_ok "Set up database" + +msg_info "Setup Dolibarr" +BASE="https://sourceforge.net/projects/dolibarr/files/Dolibarr%20installer%20for%20Debian-Ubuntu%20(DoliDeb)/" +RELEASE=$(curl -s "$BASE" | grep -oP '(?<=/Dolibarr%20installer%20for%20Debian-Ubuntu%20%28DoliDeb%29/)[^/"]+' | head -n1) +FILE=$(curl -s "${BASE}${RELEASE}/" | grep -oP 'dolibarr_[^"]+_all.deb' | head -n1) +wget -q "https://netcologne.dl.sourceforge.net/project/dolibarr/Dolibarr%20installer%20for%20Debian-Ubuntu%20(DoliDeb)/${RELEASE}/${FILE}?viasf=1" -O "$FILE" +echo "dolibarr dolibarr/reconfigure-webserver multiselect apache2" | debconf-set-selections +$STD apt-get install ./$FILE -y +$STD apt install -f +echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" +msg_ok "Setup Dolibarr" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf ~/$FILE +$STD apt-get autoremove +$STD apt-get autoclean +msg_ok "Cleaned" diff --git a/json/dolibarr.json b/json/dolibarr.json new file mode 100644 index 000000000..5396d95f8 --- /dev/null +++ b/json/dolibarr.json @@ -0,0 +1,39 @@ +{ + "name": "Dolibarr", + "slug": "dolibarr", + "categories": [ + 25 + ], + "date_created": "2025-02-20", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://wiki.dolibarr.org/index.php?title=Home", + "website": "https://www.dolibarr.org/", + "logo": "https://wiki.dolibarr.org/images/5/51/Dolibarr_124x124_white.svg", + "description": "Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.", + "install_methods": [ + { + "type": "default", + "script": "ct/dolibarr.sh", + "resources": { + "cpu": 1, + "ram": 2048, + "hdd": 6, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Database credentials: `cat ~/dolibarr.creds`", + "type": "info" + } + ] + }