JBoss Wildfly 8.1上的HawtIO
HawtIO為基于JVM的中間件提供了令人贊嘆的視覺效果。 它是應用程序的統一控制臺,否則將不得不構建自己的糟糕的Web控制臺。 老實說,它們的構建方式各不相同,技術不同,用戶體驗不同,并且都圍繞一種可怕的方式來嘗試在QA / PROD環境中管理中間件……我能聽到有人說“ amen brotha”。
因此, HawtIO是解決此問題的理想方法。 它是開源的 , Apache 2.0許可的 ,并且具有強大的社區支持。使用AngularJS和良好的插件體系結構編寫而成,您可以將其擴展到自己的個人應用程序中。
您可能已經注意到,它也是Fabric8的絕佳控制臺,它是JVM中間件的開放DevOps平臺 -它使中間件的管理,部署,配置,版本控制,發現,負載平衡等工作變得更加輕松。
但是,今天使用HawtIO有什么選擇?
許多!
HawtIO實際上只是在JVM中運行的Web應用程序。 所以這是您的選擇:
- 將其作為WAR部署到您喜歡的servlet容器(Tomcat,Jetty,JBoss Wildfly / EAP)中
- 作為可執行的Java應用程序獨立部署
- 使用HawtIO Chrome擴展程序直接從瀏覽器插入應用程序
查看“ 入門”頁面,以獲取有關使用在不同配置中部署的HawtIO的更多詳細信息。
HawtIO具有出色的插件,可用于配置,管理和可視化Apache ActiveMQ代理, Apache Camel路由, Apache Karaf OSGI捆綁/服務/配置以及Tomcat,Wildfly,Jetty,ElasticSearch,jclouds等等等 。 例如,要管理ActiveMQ經紀人, 請查看我的好友Dejan的博客文章 。
當我們在Red Hat推出JBoss Fuse和JBoss Fuse Serviceworks時 ,我們在集成各個組件方面變得越來越好。 例如,通過Fuse Service Works訂閱,您可以完全訪問A-MQ,Fuse及其所有組件,包括HawtIO。 不幸的是,到目前為止,EAP尚未“正式”支持HawtIO,但是在下一發行版中將對此進行修復。 這不是技術的局限性,而是存在著太多的東西,并且Red Hat具有嚴格的測試/兼容性要求,因此我們需要在完全“支持”它之前完成所有測試/認證。
但是……在我們等待支持的過程中,實際上沒有理由不使用它(至少是Development和QA)。 而且已經有很多人這樣做了。 請記住,它尚未得到官方支持!
因此,本博客的其余部分是逐步指南,其中包含有關如何在您的JBoss Wildfly 8.1應用程序服務器上部署和保護HawtIO的最佳實踐。 下一個條目(第二部分)將顯示與JBoss EAP 6.2發行版相同的條目。 本指南將使用HawtIO 1.4.11(社區的最新版本)。
入門
首先,假設您知道從何處下載Wildfly 8.1 。 但是從這里開始,我們將想要獲得最新的HawtIO發行版 (在撰寫本文時為1.4.11) 。 我們將使用hawtio-default-1.4.11.war進行具體說明。 下載發行版后,請考慮以下步驟:
1.刪??除log4j.properties文件
我們將要刪除發行版隨附的log4j.properties文件,因為我們將要使用JBoss Wildfly的內置日志記錄工具,該工具會自動插入到HawtIO寫入的log4j日志中。 如果不刪除log4j.properties,則希望將每個部署的日志記錄設置為false。 。 但是,因為這并不困難,所以我們只需刪除log4j.properties(注意:您應該在其日志記錄組件上查看wildfly文檔,以獲取有關日志記錄子系統靈活性的更多信息 )
ceposta@postamachat(renamed) $ ll total 50936 -rw-r--r--@ 1 ceposta staff 25M Jul 25 14:00 hawtio-default-1.4.11.warceposta@postamachat(renamed) $ unzip -l hawtio-default-1.4.11.war | grep log4j.properties1268 07-13-14 17:23 WEB-INF/classes/log4j.propertiesceposta@postamachat(renamed) $ zip -d hawtio-default-1.4.11.war WEB-INF/classes/log4j.properties deleting: WEB-INF/classes/log4j.properties2.重命名發行版
我們將要重命名發行版,以便在部署Web應用程序后更輕松地使用它。 請注意,這不是必須執行的步驟,而是可以輕松使用的妙處:
ceposta@postamachat(renamed) $ mv hawtio-default-1.4.11.war hawtio.war現在,當我們部署WAR文件時,我們將能夠像這樣訪問上下文:http:// localhost:8080 / hawtio
而不用擔心版本號。
3.放松CDI子系統
HawtIO確實使用了一些CDI注釋(例如@Inject),但是默認情況下不包含beans.xml文件。 根據引入隱式bean檔案的CDI 1.1規范,Wildfly 8.1默認情況下不喜歡這樣做。 我們可以告訴Wildfly忽略這個web應用的CDI應用程序,因為它沒有包括beans.xml中 ,我們可以有效地禁用隱豆檔案。 為此,請編輯您的配置文件(我們將使用standalone.xml,但如果使用域模式,請為此編輯相應的配置文件):
353 .... 354 <subsystem xmlns="urn:jboss:domain:weld:2.0" require-bean-descriptor="true"/> 355 </profile>4.故意禁用安全性
We want to make sure the webapp deployed correctly and you can access all of the HawtIO goodies. So we'll temporarily _disable_ security on the webapp so we can access it. To do this, add this section after the `<extensions/>` section:31 <system-properties>32 <property name="hawtio.authenticationEnabled" value="false" />33 </system-properties>我們將在后面的部分中恢復安全性
5.部署HawtIO
現在您可以部署HawtIO了!
如果您剛剛打開Wildfly發行版的包裝,則需要在管理和應用程序領域中添加一些用戶:
ceposta@postamachat(wildfly-8.1.0.Final) $ ./bin/add-user.shWhat type of user do you wish to add?a) Management User (mgmt-users.properties)b) Application User (application-users.properties) (a):Enter the details of the new user to add. Using realm 'ManagementRealm' as discovered from the existing property files. Username : admin The username 'admin' is easy to guess Are you sure you want to add user 'admin' yes/no? yes Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.- The password should not be one of the following restricted values {root, admin, administrator}- The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)- The password should be different from the username Password : Re-enter Password : What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: admin About to add user 'admin' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'admin' to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/standalone/configuration/mgmt-users.properties' Added user 'admin' to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/domain/configuration/mgmt-users.properties' Added user 'admin' with groups admin to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/standalone/configuration/mgmt-groups.properties' Added user 'admin' with groups admin to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/domain/configuration/mgmt-groups.properties' Is this new user going to be used for one AS process to connect to another AS process? e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls. yes/no? no您現在可以啟動Wildfly并部署HawtIO! 啟動Wildfly:
ceposta@postamachat(wildfly-8.1.0.Final) $ ./bin/standalone.sh并導航到Web控制臺。 使用您在上面的添加用戶部分中設置的用戶名和密碼來訪問Web控制臺。 您可以通過導航到http:// localhost:9990 /來訪問Web控制臺。 現在,單擊“ 運行時”選項卡,然后單擊“ 管理部署” 。 單擊“添加”,導航到HawtIO發行版的下載位置并重命名。 添加后,您應點擊“啟用”按鈕以啟用它。 您應該有一個如下所示的屏幕:
6.使用HawtIO!
現在您應該可以訪問http:// localhost:8080 / hawtio并開始使用HawtIO!
注意:在Mac上的Safari上,似乎存在一些與安全性/登錄有關的問題。 似乎提示您輸入un / pw。 只需嘗試使用Chrome或其他網絡瀏覽器即可。
7.設置安全性
因此,在企業環境中,無論是開發環境還是QA環境,我們都希望保護HawtIO。 為此,我們需要綁定到Widlfly的安全子系統 。
首先,讓我們首先停止Wildfly,然后再次編輯獨立配置文件。 在禁用安全性的同一位置,讓我們重新啟用它并添加更多其他選項。 您的<system-properties>部分應如下所示:
31 <system-properties> 32 <property name="hawtio.authenticationEnabled" value="true" /> 33 <property name="hawtio.realm" value="jboss-web-policy" /> 34 <property name="hawtio.role" value="admin" /> 35 </system-properties>太棒了! 現在讓我們添加一個能夠登錄的用戶。 我們將在本指南中再次使用./bin/add-user.sh,但是最有可能在您的環境中使用比默認使用的屬性文件更復雜的安全性機制(數據庫,LDAP等)。 但是,盡管如此,讓我們向ApplicationRealm添加一個新用戶:
ceposta@postamachat(wildfly-8.1.0.Final) $ ./bin/add-user.sh What type of user do you wish to add?a) Management User (mgmt-users.properties)b) Application User (application-users.properties) (a): bEnter the details of the new user to add. Using realm 'ApplicationRealm' as discovered from the existing property files. Username : ceposta Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.- The password should not be one of the following restricted values {root, admin, administrator}- The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)- The password should be different from the username Password : Re-enter Password : What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: admin About to add user 'ceposta' for realm 'ApplicationRealm' Is this correct yes/no? yes Added user 'ceposta' to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/standalone/configuration/application-users.properties' Added user 'ceposta' to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/domain/configuration/application-users.properties' Added user 'ceposta' with groups admin to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/standalone/configuration/application-roles.properties' Added user 'ceposta' with groups admin to file '/Users/ceposta/dev/eap/wildfly-8.1.0.Final/domain/configuration/application-roles.properties' Is this new user going to be used for one AS process to connect to another AS process? e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls. yes/no? no現在,讓我們再次啟動應用服務器:
ceposta@postamachat(wildfly-8.1.0.Final) $ ./bin/standalone.sh當我們再次導航到http:// localhost:8080 / hawtio端點時,應該看到一個登錄頁面:
EAP呢?
你有它! 您已經在Wildfly上運行并保護了HawtIO! 現在,您可以檢查使用HawtIO可以完成的所有令人敬畏的事情 ,尤其是可以管理,調試,跟蹤,分析和監視Apache Camel路由的事情。
但是在JBoss EAP上做同樣的事情呢? 請繼續關注下一部分……我將向您確切演示如何做到這一點!
翻譯自: https://www.javacodegeeks.com/2014/08/hawtio-on-jboss-wildfly-8-1.html
總結
以上是生活随笔為你收集整理的JBoss Wildfly 8.1上的HawtIO的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 国内ddos攻击(ddos攻击国家网站)
- 下一篇: 自定义Cassandra数据类型