From 2ff8b9e82ff725ed85b10893611b44658d3af813 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 2 Dec 2024 14:48:44 +0100 Subject: [PATCH 1/6] New Script: Zammad --- ct/zammad.sh | 75 +++++++++++++++++++++++++++++++++++++++ install/zammad-install.sh | 61 +++++++++++++++++++++++++++++++ json/zammad.json | 34 ++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 ct/zammad.sh create mode 100644 install/zammad-install.sh create mode 100644 json/zammad.json diff --git a/ct/zammad.sh b/ct/zammad.sh new file mode 100644 index 00000000..4e7f8709 --- /dev/null +++ b/ct/zammad.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/michelroegl-brunner/ProxmoxVE/refs/heads/zammad/misc/build.func) + +#Copyright (c) 2021-2024 community-scripts ORG +# Author: Michel Roegl-Brunner (michelroegl-brunner) +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +function header_info { +clear +cat <<"EOF" + _____ __ +/__ / ____ _____ ___ ____ ___ ____ _____/ / + / / / __ `/ __ `__ \/ __ `__ \/ __ `/ __ / + / /__/ /_/ / / / / / / / / / / / /_/ / /_/ / +/____/\__,_/_/ /_/ /_/_/ /_/ /_/\__,_/\__,_/ +EOF +} +header_info +echo -e "Loading..." +APP="Zammad" +var_disk="8" +var_cpu="2" +var_ram="4096" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +check_container_storage +check_container_resources +if [[ ! -d /opt/zamad ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +systemctl stop zammad &>/dev/null +apt-get update &>/dev/null +apt-mark hold zammad &>/dev/null +apt-get -y upgrade &>/dev/null +apt-mark unhold zammad &>/dev/null +apt-get -y upgrade &>/dev/null +systemctl start zammad &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/install/zammad-install.sh b/install/zammad-install.sh new file mode 100644 index 00000000..0ec827d9 --- /dev/null +++ b/install/zammad-install.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +#Copyright (c) 2021-2024 community-scripts ORG +# Author: Michel Roegl-Brunner (michelroegl-brunner) +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +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 \ + git \ + sudo \ + gpg \ + wget \ + nginx + +echo "deb [signed-by=/etc/apt/trusted.gpg.d/elasticsearch.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main"| tee -a /etc/apt/sources.list.d/elastic-7.x.list > /dev/null +curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor | tee /etc/apt/trusted.gpg.d/elasticsearch.gpg> /dev/null +$STD apt-get update +$STD apt-get -y install elasticsearch +echo "-Xms2g" >> /etc/elasticsearch/jvm.options +echo "-Xmx2g" >> /etc/elasticsearch/jvm.options +$STD /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment -b +$STD systemctl restart elasticsearch +msg_ok "Installed Dependencies" + +msg_info "Install Zammad" + +curl -fsSL https://dl.packager.io/srv/zammad/zammad/key | gpg --dearmor | sudo tee /etc/apt/keyrings/pkgr-zammad.gpg> /dev/null +echo "deb [signed-by=/etc/apt/keyrings/pkgr-zammad.gpg] https://dl.packager.io/srv/deb/zammad/zammad/stable/debian 12 main"| sudo tee /etc/apt/sources.list.d/zammad.list > /dev/null +$STD apt-get update +$STD apt-get -y install zammad + +msg_ok "Installed Zammad" + +msg_info "Configuring Servcie" +$STD zammad run rails r "Setting.set('es_url', 'http://localhost:9200')" +$STD zammad run rake zammad:searchindex:rebuild + +cp /opt/zammad/contrib/nginx/zammad.conf /etc/nginx/sites-available/zammad.conf +IPADDRESS=$(hostname -I | awk '{print $1}') +sed -i "s/server_name localhost;/server_name $IPADDRESS;/g" /etc/nginx/sites-available/zammad.conf +$STD systemctl reload nginx + +msg_ok "Configured Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/json/zammad.json b/json/zammad.json new file mode 100644 index 00000000..7b7a07ab --- /dev/null +++ b/json/zammad.json @@ -0,0 +1,34 @@ +{ + "name": "Zammad", + "slug": "zammad", + "categories": [ + 11 + ], + "date_created": "2024-11-29", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": null, + "documentation": null, + "website": "www.zammad.com", + "logo": "https://raw.githubusercontent.com/zammad/zammad/refs/heads/develop/public/assets/images/logo.svg", + "description": "Zammad is a web based open source helpdesk/customer support system with many features to manage customer communication via several channels like telephone, facebook, twitter, chat and emails. It is distributed under version 3 of the GNU AFFERO General Public License (GNU AGPLv3).", + "install_methods": [ + { + "type": "default", + "script": "/ct/zammad.sh", + "resources": { + "cpu": 2, + "ram": 4096, + "hdd": 8, + "os": null, + "version": null + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} From a40da284c92e578474ece69f2a11f804aa5d4ad0 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 3 Dec 2024 09:11:38 +0100 Subject: [PATCH 2/6] Implement changes --- ct/zammad.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ct/zammad.sh b/ct/zammad.sh index 4e7f8709..b292f330 100644 --- a/ct/zammad.sh +++ b/ct/zammad.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/michelroegl-brunner/ProxmoxVE/refs/heads/zammad/misc/build.func) - -#Copyright (c) 2021-2024 community-scripts ORG +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2024 community-scripts ORG # Author: Michel Roegl-Brunner (michelroegl-brunner) # License: MIT # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + function header_info { clear cat <<"EOF" From f800cc1f68921e9f840a9b0b953f0501cf145e14 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 3 Dec 2024 09:28:13 +0100 Subject: [PATCH 3/6] Changes after review --- install/zammad-install.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/install/zammad-install.sh b/install/zammad-install.sh index 0ec827d9..d97eff6f 100644 --- a/install/zammad-install.sh +++ b/install/zammad-install.sh @@ -21,36 +21,34 @@ $STD apt-get install -y \ gpg \ wget \ nginx +msg_ok "Installed Dependencies" -echo "deb [signed-by=/etc/apt/trusted.gpg.d/elasticsearch.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main"| tee -a /etc/apt/sources.list.d/elastic-7.x.list > /dev/null -curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor | tee /etc/apt/trusted.gpg.d/elasticsearch.gpg> /dev/null +msg_info "Setting up Elasticsearch" +echo "deb [signed-by=/etc/apt/trusted.gpg.d/elasticsearch.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main"| tee -a /etc/apt/sources.list.d/elastic-7.x.list +curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg $STD apt-get update $STD apt-get -y install elasticsearch echo "-Xms2g" >> /etc/elasticsearch/jvm.options echo "-Xmx2g" >> /etc/elasticsearch/jvm.options $STD /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment -b $STD systemctl restart elasticsearch -msg_ok "Installed Dependencies" - -msg_info "Install Zammad" +msg_ok "Setup Elasticsearch" +msg_info "Installing Zammad" curl -fsSL https://dl.packager.io/srv/zammad/zammad/key | gpg --dearmor | sudo tee /etc/apt/keyrings/pkgr-zammad.gpg> /dev/null echo "deb [signed-by=/etc/apt/keyrings/pkgr-zammad.gpg] https://dl.packager.io/srv/deb/zammad/zammad/stable/debian 12 main"| sudo tee /etc/apt/sources.list.d/zammad.list > /dev/null $STD apt-get update $STD apt-get -y install zammad - -msg_ok "Installed Zammad" - -msg_info "Configuring Servcie" $STD zammad run rails r "Setting.set('es_url', 'http://localhost:9200')" $STD zammad run rake zammad:searchindex:rebuild +msg_ok "Installed Zammad" +msg_info "Set up web services" cp /opt/zammad/contrib/nginx/zammad.conf /etc/nginx/sites-available/zammad.conf IPADDRESS=$(hostname -I | awk '{print $1}') sed -i "s/server_name localhost;/server_name $IPADDRESS;/g" /etc/nginx/sites-available/zammad.conf $STD systemctl reload nginx - -msg_ok "Configured Service" +msg_ok "Created Service" motd_ssh customize From c6947a3720a77e5ba3bc014fa3fb8f6a50d87fbc Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Wed, 4 Dec 2024 09:56:23 +0100 Subject: [PATCH 4/6] Added changes --- install/zammad-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/zammad-install.sh b/install/zammad-install.sh index d97eff6f..e08b2d43 100644 --- a/install/zammad-install.sh +++ b/install/zammad-install.sh @@ -31,7 +31,7 @@ $STD apt-get -y install elasticsearch echo "-Xms2g" >> /etc/elasticsearch/jvm.options echo "-Xmx2g" >> /etc/elasticsearch/jvm.options $STD /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment -b -$STD systemctl restart elasticsearch +systemctl -q restart elasticsearch msg_ok "Setup Elasticsearch" msg_info "Installing Zammad" @@ -43,7 +43,7 @@ $STD zammad run rails r "Setting.set('es_url', 'http://localhost:9200')" $STD zammad run rake zammad:searchindex:rebuild msg_ok "Installed Zammad" -msg_info "Set up web services" +msg_info "Setup Services" cp /opt/zammad/contrib/nginx/zammad.conf /etc/nginx/sites-available/zammad.conf IPADDRESS=$(hostname -I | awk '{print $1}') sed -i "s/server_name localhost;/server_name $IPADDRESS;/g" /etc/nginx/sites-available/zammad.conf From c2f5f33807119600fa718b9315c5d03e610073f3 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Wed, 4 Dec 2024 09:59:42 +0100 Subject: [PATCH 5/6] Added changes --- ct/zammad.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ct/zammad.sh b/ct/zammad.sh index b292f330..093bf60c 100644 --- a/ct/zammad.sh +++ b/ct/zammad.sh @@ -56,13 +56,15 @@ header_info check_container_storage check_container_resources if [[ ! -d /opt/zamad ]]; then msg_error "No ${APP} Installation Found!"; exit; fi -msg_info "Updating ${APP} LXC" +msg_info "Stopping Service" systemctl stop zammad &>/dev/null +msg_info "Updating ${APP}" apt-get update &>/dev/null apt-mark hold zammad &>/dev/null apt-get -y upgrade &>/dev/null apt-mark unhold zammad &>/dev/null apt-get -y upgrade &>/dev/null +msg_info "Starting Service" systemctl start zammad &>/dev/null msg_ok "Updated ${APP} LXC" exit From 143b31b87fbd391d4d44c8f35bbb3a6d8c5d2524 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Fri, 6 Dec 2024 12:27:47 +0100 Subject: [PATCH 6/6] Change to new System --- ct/zammad.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ct/zammad.sh b/ct/zammad.sh index 093bf60c..b4b56564 100644 --- a/ct/zammad.sh +++ b/ct/zammad.sh @@ -2,27 +2,24 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2024 community-scripts ORG # Author: Michel Roegl-Brunner (michelroegl-brunner) -# License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://zammad.com -function header_info { -clear -cat <<"EOF" - _____ __ -/__ / ____ _____ ___ ____ ___ ____ _____/ / - / / / __ `/ __ `__ \/ __ `__ \/ __ `/ __ / - / /__/ /_/ / / / / / / / / / / / /_/ / /_/ / -/____/\__,_/_/ /_/ /_/_/ /_/ /_/\__,_/\__,_/ -EOF -} -header_info -echo -e "Loading..." +#App Default Values APP="Zammad" +TAGS="webserver;ticket-system" var_disk="8" var_cpu="2" var_ram="4096" var_os="debian" var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core variables color catch_errors @@ -75,3 +72,6 @@ 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}"