mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-21 21:35:08 +02:00
681d4f6255
Explicitly bind Elasticsearch to 127.0.0.1 instead of relying on localhost resolution. Updates elasticsearch.yml, health check curl, and Zammad ES URL setting to use 127.0.0.1 for consistency and to avoid potential IPv6 resolution issues.
74 lines
2.1 KiB
Bash
74 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: Michel Roegl-Brunner (michelroegl-brunner)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://zammad.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 \
|
|
git \
|
|
nginx \
|
|
apt-transport-https
|
|
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" \
|
|
"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
|
|
cat <<EOF >/etc/elasticsearch/elasticsearch.yml
|
|
discovery.type: single-node
|
|
network.host: 127.0.0.1
|
|
xpack.security.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
|
|
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
|
|
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" \
|
|
"$(get_os_info version_id)" \
|
|
"main"
|
|
$STD apt install -y zammad
|
|
$STD zammad run rails r "Setting.set('es_url', 'http://127.0.0.1:9200')"
|
|
$STD zammad run rake zammad:searchindex:rebuild
|
|
msg_ok "Installed Zammad"
|
|
|
|
msg_info "Setup Services"
|
|
cp /opt/zammad/contrib/nginx/zammad.conf /etc/nginx/sites-available/zammad.conf
|
|
sed -i "s/server_name localhost;/server_name $LOCAL_IP;/g" /etc/nginx/sites-available/zammad.conf
|
|
ln -sf /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/
|
|
rm -f /etc/nginx/sites-enabled/default
|
|
$STD systemctl reload nginx
|
|
msg_ok "Created Service"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|