mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-10-13 19:40:25 -04:00
zammad: Debian 13, new apt repo, Elasticsearch 8 (#17836)
- Default to Debian 13 - Switch Zammad repo from dl.packager.io (frozen at 7.0.x) to go.packager.io - Install Elasticsearch 8.x instead of EOL 7.x; drop ingest-attachment plugin (built in) - Update migrates old containers: Zammad repo, ES 7 -> 8, search index rebuild
This commit is contained in:
66
ct/zammad.sh
66
ct/zammad.sh
@@ -12,7 +12,7 @@ var_disk="${var_disk:-8}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-4096}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-12}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-no}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
@@ -34,6 +34,64 @@ function update_script() {
|
||||
systemctl stop zammad
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
if grep -qs "dl.packager.io" /etc/apt/sources.list.d/zammad*; then
|
||||
msg_info "Migrating Zammad Repository"
|
||||
rm -f /etc/apt/keyrings/pkgr-zammad.gpg
|
||||
setup_deb822_repo \
|
||||
"zammad" \
|
||||
"https://go.packager.io/srv/deb/zammad/zammad/gpg-key.asc" \
|
||||
"https://go.packager.io/srv/deb/zammad/zammad/stable/debian" \
|
||||
"$(get_os_info version_id)" \
|
||||
"main"
|
||||
msg_ok "Migrated Zammad Repository"
|
||||
fi
|
||||
|
||||
REBUILD_INDEX=false
|
||||
if [[ "$(dpkg-query -W -f='${Version}' elasticsearch 2>/dev/null)" == 7.* ]]; then
|
||||
msg_info "Upgrading Elasticsearch to 8.x"
|
||||
systemctl stop elasticsearch
|
||||
if /usr/share/elasticsearch/bin/elasticsearch-plugin list 2>/dev/null | grep -q "ingest-attachment"; then
|
||||
$STD /usr/share/elasticsearch/bin/elasticsearch-plugin remove ingest-attachment
|
||||
fi
|
||||
rm -f /etc/apt/sources.list.d/elastic-7.x.list /usr/share/keyrings/elasticsearch-keyring.gpg
|
||||
setup_deb822_repo \
|
||||
"elasticsearch" \
|
||||
"https://artifacts.elastic.co/GPG-KEY-elasticsearch" \
|
||||
"https://artifacts.elastic.co/packages/8.x/apt" \
|
||||
"stable" \
|
||||
"main"
|
||||
ES_JAVA_OPTS="-Xms1g -Xmx1g" $STD apt install -y elasticsearch
|
||||
if [[ -f /etc/elasticsearch/jvm.options.dpkg-dist ]]; then
|
||||
mv /etc/elasticsearch/jvm.options.dpkg-dist /etc/elasticsearch/jvm.options
|
||||
fi
|
||||
rm -f /etc/elasticsearch/elasticsearch.yml.dpkg-dist
|
||||
rm -rf /var/lib/elasticsearch/*
|
||||
cat <<EOF >/etc/elasticsearch/jvm.options.d/heap.options
|
||||
-Xms2g
|
||||
-Xmx2g
|
||||
EOF
|
||||
cat <<EOF >/etc/elasticsearch/elasticsearch.yml
|
||||
path.data: /var/lib/elasticsearch
|
||||
path.logs: /var/log/elasticsearch
|
||||
discovery.type: single-node
|
||||
network.host: 127.0.0.1
|
||||
xpack.security.enabled: false
|
||||
xpack.security.transport.ssl.enabled: false
|
||||
xpack.security.http.ssl.enabled: false
|
||||
bootstrap.memory_lock: false
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl restart -q elasticsearch
|
||||
for i in $(seq 1 30); do
|
||||
if curl -s http://127.0.0.1:9200 >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
REBUILD_INDEX=true
|
||||
msg_ok "Upgraded Elasticsearch to 8.x"
|
||||
fi
|
||||
|
||||
msg_info "Updating Zammad"
|
||||
apt_update_safe
|
||||
$STD apt-mark hold zammad
|
||||
@@ -42,6 +100,12 @@ function update_script() {
|
||||
$STD apt upgrade -y
|
||||
msg_ok "Updated Zammad"
|
||||
|
||||
if [[ "$REBUILD_INDEX" == true ]]; then
|
||||
msg_info "Rebuilding Search Index"
|
||||
$STD zammad run rake zammad:searchindex:rebuild
|
||||
msg_ok "Rebuilt Search Index"
|
||||
fi
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start zammad
|
||||
msg_ok "Started Service"
|
||||
|
||||
@@ -16,29 +16,31 @@ update_os
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
git \
|
||||
nginx \
|
||||
apt-transport-https
|
||||
nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up Elasticsearch"
|
||||
setup_deb822_repo \
|
||||
"elasticsearch" \
|
||||
"https://artifacts.elastic.co/GPG-KEY-elasticsearch" \
|
||||
"https://artifacts.elastic.co/packages/7.x/apt" \
|
||||
"https://artifacts.elastic.co/packages/8.x/apt" \
|
||||
"stable" \
|
||||
"main"
|
||||
$STD apt install -y elasticsearch
|
||||
sed -i 's/^#\{0,2\} *-Xms[0-9]*g.*/-Xms2g/' /etc/elasticsearch/jvm.options
|
||||
sed -i 's/^#\{0,2\} *-Xmx[0-9]*g.*/-Xmx2g/' /etc/elasticsearch/jvm.options
|
||||
ES_JAVA_OPTS="-Xms1g -Xmx1g" $STD apt install -y elasticsearch
|
||||
cat <<EOF >/etc/elasticsearch/jvm.options.d/heap.options
|
||||
-Xms2g
|
||||
-Xmx2g
|
||||
EOF
|
||||
cat <<EOF >/etc/elasticsearch/elasticsearch.yml
|
||||
path.data: /var/lib/elasticsearch
|
||||
path.logs: /var/log/elasticsearch
|
||||
discovery.type: single-node
|
||||
network.host: 127.0.0.1
|
||||
xpack.security.enabled: false
|
||||
xpack.security.transport.ssl.enabled: false
|
||||
xpack.security.http.ssl.enabled: false
|
||||
bootstrap.memory_lock: false
|
||||
EOF
|
||||
$STD /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment -b
|
||||
systemctl daemon-reload
|
||||
systemctl enable -q elasticsearch
|
||||
systemctl restart -q elasticsearch
|
||||
@@ -53,8 +55,8 @@ msg_ok "Setup Elasticsearch"
|
||||
msg_info "Installing Zammad"
|
||||
setup_deb822_repo \
|
||||
"zammad" \
|
||||
"https://dl.packager.io/srv/zammad/zammad/key" \
|
||||
"https://dl.packager.io/srv/deb/zammad/zammad/stable/debian" \
|
||||
"https://go.packager.io/srv/deb/zammad/zammad/gpg-key.asc" \
|
||||
"https://go.packager.io/srv/deb/zammad/zammad/stable/debian" \
|
||||
"$(get_os_info version_id)" \
|
||||
"main"
|
||||
$STD apt install -y zammad
|
||||
|
||||
Reference in New Issue
Block a user