Wildfly 10. Deploy an aplication on a specific server - deployment

I need to have an ability make several applications listen on different ports, but in the certain situation some of these applications must listen on the same port. I can change all configs, but I can't reassemble WAR files.
I've read this article "Application deployment" but still perplexed. Can it be done on standalone server? If it is possible, what configs should I make?
UPD
May be I sould change the question. Is there any way to set up a specific virtual server for an application by a deployment descriptor?

To create create a different http listeners on the same wildfy instance, you will need to adjust your configuration file by adding the new http-listener.
Add, just below <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>, in the undertow subsystem your new listener <http-listener name="customerPort" socket-binding="customerPort"/>
Then in your socket-binding-group (usually at the end of the configuration file), add the socket binding referencing customerPort above <socket-binding name="customerPort" port="2323"/>
Hope this help solve your problem.

Related

Need to run Multiple JBoss applications on different web connectors

I'm running a JBoss EAP 6 instance that has 5 applications running inside. Each one needs it's own socket bindings, web connector and thread pool.
I've defined 5 web connectors that bind to each socket binding group (one for each app) as well as their corresponding thread pools. But I'm not sure how to get a distinct url / address for each app.
Here's what I'd like:
http://myapp1.servername -> app1
http://myapp2.servername -> app2
And so on..
I've scraped the web and found bits and pieces of how to do this, including virtual hosts. But I can't find anything coherent that helps me tie and app to it's corresponding connector and expose it via a separate url.
Can anyone help?
To configure virtual host add below tag in 'web' subsystem:
<virtual-server name="virtualserver1" enable-welcome-root="false" default-web-module="app1">
<alias name="app1.com"/>
</virtual-server>
Add below tag in war/WEB-INF/jboss-web.xml file:
<jboss-web>
<context-root>/application</context-root>
<virtual-host>virtualserver1</virtual-host>
</jboss-web>

Deploy application to wildfly on a certain port

By default, applications in wildfly are deployed to localhost:8080/app. How to deploy application on dedicated port, i.e. open it on localhost:8282 without application name ending?
I need to change the port for certain application, not the default port.
I have not tried this, but AFAICT it should be possible to:
run a single Wildfly instance listening on multiple HTTP ports. This is, in theory at least, possible (ref: https://developer.jboss.org/thread/233414?start=0&tstart=0)
Configure undertow subsystem as a reverse proxy, and proxy your app to the other port/location (ref: http://www.mastertheboss.com/jboss-server/wildfly-8/configuring-a-reverse-proxy-with-undertow). That said, I have never used undertow for a reverse proxy and as such cannot speak for whether this really works.
Once you have done this, you have effectively just turned your Wildfly instance into an overly complex application server and reverse proxy in one. Ultimately however, the app in question would still be running on both ports, but you redirect the traffic using the proxy the way you would like.
The same proxy configuration in an Apache (ref: https://httpd.apache.org/docs/current/mod/mod_proxy.html#forwardreverse or https://www.leaseweb.com/labs/2014/12/tutorial-apache-2-4-transparent-reverse-proxy/) or NGINX (ref: https://www.nginx.com/resources/admin-guide/reverse-proxy/) would be IMHO less complex and better tested in countless production scenarios.

Rebus and Remote queues

I'm using Rebus (https://github.com/rebus-org (v.0.83)) and until now it's been all local to a single machine. Now I need to use a remote queue from my website to an app server. It's not abundantly clear to me how to set this up with Rebus. A few questions
I guess I need MSMQ on both machines (web & app) correct? I've configured the web site to UseMsmqInOneWayClientMode;
or is there a way to specify to send it over http?
My configuration looks like this more or less. I'm guessing that inputQUeue needs to point to the local machine not the remote one right?
<rebus inputQueue="mywebqueue" errorQueue="MyErrorQueue#mymachine" workers="1" maxRetries="5">
<endpoints>
<add messages="MyLibrary.CreateMessage, MyLibrary" endpoint="MyQueue#mymachine"/>
</endpoints>
</rebus>
Help would really be appreciated.
Yes. All machines that need to use MSMQ somehow, need to have MSMQ installed. Even as a one-way client, like your webserver, because MSMQ achieves its high availability by providing outgoing queues when you send to remote machines.
I think so. I've never used MSMQ beyond its basic reliable messaging capabilities. Google around, I bet you can find something ;)
Your configuration looks right. And yes - input queues are always local, whereas queues you send to (error queue and all endpoints specified in the endpoint mappings) can be remote too.

Wildfly 8 Final - jconsole can't connect remotely

Good day, people,
I am trying to use jconsole to connect to remote Wildfly 8 Final servers. That did not work: Connection failed. After multiple tries and failures I attempted to make it connect at least to my 'localhost' jboss, but even that is not working. No errors, it simply doesn't connect and says "Connection failed".
Details:
Wildfly 8 Final server
Using jconsole from wildfly_installation/bin/jconsole.bat
Management users created. Tried with and without the username/password.
The standalone.xml is the original one, shipped with Wildfly 8 Final without changes
The url that I plug in jconsole to connect to is: service:jmx:remoting-jmx://localhost:9999
The Wildfly/jboss doesn't have anything deployed in it, no WARs/EARs.
Java version is 1.7 release 51. The latest on the moment of writing.
JAVA_HOME points to the only java 1.7 installed on the system.
JConsole can connect to local java process and works, but not remote connection.
Basically it's a brand new installation of Wildfly 8 Final with management user created and jconsole doesn't connect remotely to it.
What else I've tried: I've read many posts on people having troubles with jconsole and Jboss AS 7.x. I have tried the suggestions from those threads, but none worked. Also it seems Wildfly 8 has different JMX version (1.3 vs 1.1 in Jboss 7.x), so I assume that's why standalone.xml suggestions from Jboss 7.x didn't work for Wildfly 8 Final.
Java Mission Control JMX console and Flight Recorder profiler work on WildFly as well.
As already noted the proper JMX connection string is:
service:jmx:http-remoting-jmx://{insert server ip here}:9990
It requires a management user (details on the bottom).
As for the Flight Recorder, these should be added to the server runtime configuration in standalone.conf(.bat):
JAVA_OPTS=%JAVA_OPTS% -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true
On a workstation where you want to run Java Mission Control you need to adjust the classpath in jmc.ini (located in bin directory of your JDK):
-Xbootclasspath/a:c:\Program Files\Java\jdk1.7.0_67\lib\jconsole.jar;c:\Program Files\Java\jdk1.7.0_67\lib\tools.jar;c:\wildfly-8.1.0.Final\bin\client\jboss-cli-client.jar`
Prerequisites (you most likely already configured this):
this assumes that you have installed JDK on workstation in c:\Program Files\Java\jdk1.7.0_67\
this assumes that you have installed WildFly on workstation in c:\wildfly-8.1.0.Final
on the server you need to have proper bind.address configurations (or <any-address>) in standalone.xml:
<interfaces>
<interface name="management">
<any-address/>
</interface>
<interface name="public">
<any-address/>
</interface>
<interface name="unsecure">
<any-address/>
</interface>
</interfaces>
You need to have a management user on the server, which you can add by using \bin\add-user.bat(.sh).
To test this connect to http://{insert server ip here}:9990 with a web browser which will open the server's web UI console.
Best regards!
Alright, got it figured out. The native management port (9999) was removed in the Final version of Wildfly 8. Now there's only 1 management port (9990) and it has multiple previous ports multiplexed over it, including the JMX. It was still available in the release candidate of Wildfly 8, hence all the confusion about the online instructions and configs available elsewhere online.
So the key is to specify the proper protocol, which is not the remoting-jmx now, but http-remoting-jmx. The URL to connect to the server must be like this:
service:jmx:http-remoting-jmx://<server_host_or_ip>:9990
(this is versus service:jmx:remoting-jmx://:9999 in previous jboss/wildfly servers)
Finally, no need to mess with standalone.xml config. All config tweaks to make it work on Jboss 7.x won't work for it. It all works out of the box with proper protocol and port number. Just make sure to create a jboss user in ManagementRealm.
This was a bug in WildFly that was recently fixed and will be part of 8.0.1 release.
See jira for more details.
You have to include jboss-cli-client.jar in the jconsole classpath:
jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$WILDFLY_HOME/bin/client/jboss-cli-client.jar
Replace $JAVA_HOME to something like /usr/lib/jvm/java-8-oracle/ and $WILDFLY_HOME to /opt/wildfly/ or wherever you have it unpacked.
And then the url is in the following format:
service:jmx:remote+http://${host}:9990
Also fill in the username and password with the credentials configured using add-user.sh
Below is how to enable the old native JMX interface, removed from WildFly 8 default configuration, which is backwards compatible with JMX tools.
This is required when the new HTTP interface is not an option, e.g. to integrate with legacy tools like Bamboo's JBoss 7 add-on.
Tested with WildFly 10, it should work with WildFly 8 and WildFly 9 as well.
Since the plug in does not support the HTTP management interface, to make it work, we need to enable the native JMX interface, which used to run on port 9999.
This can be done by adding the native-interface element under the management-interfaces section:
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket-binding native="management-native"/>
</native-interface>
<http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
<socket-binding http="management-http"/>
</http-interface>
</management-interfaces>
And defining the corresponding socket-binding
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-native" interface="management"
port="${jboss.management.native.port:9999}"/>
...
If in domain mode, to use the remote endpoint, you set use-management-endpoint to false.
<subsystem xmlns="urn:jboss:domain:jmx:1.3">
<expose-resolved-model/>
<expose-expression-model/>
<remoting-connector use-management-endpoint="false"/>
</subsystem>
Hope it may help anyone...
Reference:
https://docs.jboss.org/author/display/WFLY8/Admin+Guide#AdminGuide-NativeManagementEndpoint

Is it possible to specify port-offset in JBoss domain master configuration?

I have jboss-eap-6.1 that I want to run domain. There are a few other services running on the machine that use same ports this server needs. I can't seem to find the way to specify the port-offset to shift the ports used by this installation.
I know it's possible to offset in standalone mode, but I need to set the server up in domain mode.
I appreciate any ideas.
You need to specify offset for each server which will be ran on your local machine - and this belongs to host.xml.
<servers>
<server name="server" group="main-server-group" auto-start="true">
<socket-binding-group port-offset="150"/>
</server>
</servers>
See also JBoss domain tutorial for reference.
Question is now quiet old but still unanswered, it may help someone else.
Petr was almost there. You indeed need to edit your host.xml, but as following:
<servers>
<server name="server" group="main-server-group" auto-start="true">
<socket-bindings port-offset="150"/>
</server>
</server>