Refactor: HiveMQ (#6313)

This commit is contained in:
Slaviša Arežina 2025-07-28 18:50:33 +02:00 committed by GitHub
parent 253c4f4f5b
commit 7051dfeea7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 16 deletions

View File

@ -9,7 +9,7 @@
"updateable": false,
"privileged": false,
"interface_port": 1883,
"documentation": null,
"documentation": "https://github.com/hivemq/hivemq-community-edition/wiki",
"website": "https://www.hivemq.com/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/hivemq.webp",
"config_path": "/opt/hivemq/conf/config.xml",

View File

@ -13,34 +13,26 @@ setting_up_container
network_check
update_os
msg_info "Installing OpenJDK"
curl -fsSL "https://packages.adoptium.net/artifactory/api/gpg/key/public" | gpg --dearmor >/etc/apt/trusted.gpg.d/adoptium.gpg
echo 'deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/adoptium.gpg] https://packages.adoptium.net/artifactory/deb bookworm main' >/etc/apt/sources.list.d/adoptium.list
$STD apt-get update
$STD apt-get install -y temurin-17-jre
msg_ok "Installed OpenJDK"
JAVA_VERSION="21" setup_java
fetch_and_deploy_gh_release "hivemq" "hivemq/hivemq-community-edition" "prebuild" "latest" "/opt/hivemq" "hivemq-ce-*.zip"
msg_info "Installing HiveMQ CE"
RELEASE=$(curl -fsSL https://api.github.com/repos/hivemq/hivemq-community-edition/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
curl -fsSL "https://github.com/hivemq/hivemq-community-edition/releases/download/${RELEASE}/hivemq-ce-${RELEASE}.zip" -o "hivemq-ce-${RELEASE}.zip"
$STD unzip hivemq-ce-${RELEASE}.zip
mkdir -p /opt/hivemq
mv hivemq-ce-${RELEASE}/* /opt/hivemq
msg_info "Configuring HiveMQ CE"
useradd -d /opt/hivemq hivemq
chown -R hivemq:hivemq /opt/hivemq
chmod +x /opt/hivemq/bin/run.sh
cp /opt/hivemq/bin/init-script/hivemq.service /etc/systemd/system/hivemq.service
rm /opt/hivemq/conf/config.xml
mv /opt/hivemq/conf/examples/configuration/config-sample-tcp-and-websockets.xml /opt/hivemq/conf/config.xml
msg_ok "Configured HiveMQ CE"
msg_info "Starting service"
systemctl enable -q --now hivemq
msg_ok "Installed HiveMQ CE"
msg_ok "Service started"
motd_ssh
customize
msg_info "Cleaning up"
rm -rf hivemq-ce-${RELEASE}.zip
rm -rf ../hivemq-ce-${RELEASE}
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"