Immutant and Wildfly root context

131 views
Skip to first unread message

Webdev Tory Anderson

unread,
Oct 20, 2016, 1:33:27 PM10/20/16
to Immutant
Having failed to get any response in the past month on all the Wildfly channels I can find,  I'm hoping you can help me. I have a shared server that hosts several apps via immutant war (using stand-alone deployments in Wildfly). Most of them are at <apps.server>/<app-name> and this is fine. However, I need some to work in this scenario via <one-app.com> (while other apps are still running at the old paths). If you have any wisdom on how this can be accomplished, I would be most appreciative!

Webdev Tory Anderson

unread,
Oct 20, 2016, 1:36:34 PM10/20/16
to Immutant
As a follow-up, I'm fronting Wildfly with Nginx doing reverse proxy; I can point requests to <app.com> but Wildfly can't seem to handle them with my default war files.

Jim Crossley

unread,
Oct 21, 2016, 10:04:09 AM10/21/16
to Immutant
Well, dammit! I just realized Tory and I have been corresponding privately instead of on the group. Completely my fault, so I'm posting our exchange here for completeness.

Tory, if you have further questions, please post here, and remind me if I do that again. :)

Our exchange, in reverse chronological order (sorry) begins now...

$ lein help immutant war
$ lein help immutant deployment

On Fri, Oct 21, 2016 at 9:39 AM, Tory S. Anderson wrote:
Ah! Insight! So, my WF instance is just listening on the default port (8080; that's where nginx comes in) but I think that's irrelevant here.

4) Your service3 war file was created with the following options:
    $ lein immutant war --context-path / --virtual-host
service3.server

I had no idea that was possible! Where can I learn more about these lein immutant flags? 
Jim Crossley writes:

Ok, given your examples:

my.web.server/service1
my.web.server/service2
service3.server/

I'm assuming nginx is not in the picture (yet), so from those urls, I
deduce the following:

1) Your WF instance is listening on port 80 (not the default) 
2) Your name resolution (DNS) configuration maps both "my.web.server"
and "service3.server" to the IP address of the host on which your WF
instance is running
3) Your service1 and service2 war files are named service1.war and
service2.war
4) Your service3 war file was created with the following options:
    $ lein immutant war --context-path / --virtual-host
service3.server

If any of my assumptions are wrong, that may explain some of your
troubles. If my assumptions are right, then we may have a problem. :)

So hopefully I got something wrong! What'd I miss?

Jim


On Thu, Oct 20, 2016 at 5:04 PM, Tory S. Anderson wrote:

    Thanks Jim!
       I am building luminus apps but, as per recent instructions,     using
    the correct immutant (not luminus-immutant) reqs. I produce     an
    uberwar with lein immutant war. I use no non-default     options, to
    the best of my knowledge. Wildfly is version 10.1 , running     with
    out-of-the-box settings and using standalone-full.xml.
    I have a wildfly server hosting several web     services. Generally,
    these are at my.web.server/service . However, a few of these     are
    prime enough examples that they need to be available via     their
    own address: service.host.edu. I want to keep the 0-downtime     and
    automatically restarting benefits of Wildfly, but can't seem     to
    figure out whether it's possible to have a mixed environment
    with:
       my.web.server/service1
    my.web.server/service2
    service3.server/
       Again, forwarding requests for those isn't a problem, but     having
    them handled properly by Wildfly seems to be hanging things     up.
       - Tory
          Jim Crossley writes:
              Hi Webdev Tory, 
               Sorry you're having trouble getting a response. As you         might
        imagine,
        very few people are experts in WildFly, Immutant, *and*
        Nginx. I'm
        not either, of course, but maybe I can help get you a         little
        farther.
               First, I'm confused about exactly what you're trying to         do.
        It sounds
        like you're trying to deploy multiple apps to a single         WF
        instance,
        all at the root context. I'm pretty sure that's         impossible.
        From the
        Web guide [1], "Multiple applications can run on the
        same :host and 
        :port as long as each has a unique combination
        of:virtual-host and 
        :path."
               Can you list exactly what options you're using to deploy         the
        apps and
        at which context paths and virtual hosts you expect them         to
        be
        available? Can you verify that they are in fact         available
        without
        going through nginx?
               Jim
               [1] http://immutant.org/documentation/2.1.5/apidoc/guide-
        web.html#
        h5411
               --
            You received this message because you are subscribed         to
        the
            Google Groups "Immutant" group.
            To unsubscribe from this group and stop receiving         emails 
           from it,
            send an email to         immutant+unsubscribe@googlegroups.com.
            To post to this group, send email to     
        immu...@googlegroups.com.
            To view this discussion on the web visit https://
            groups.google.com/d/msgid/immutant/4b926022-5dcb-
            4198-868e-f0ec526ed564%40googlegroups.com.
               For more options, visit         https://groups.google.com/d/op
        tout.
   

Webdev Tory Anderson

unread,
Oct 21, 2016, 11:15:59 AM10/21/16
to Immutant
I think I'm almost there, between your suggestions and where they led me at http://www.mastertheboss.com/jboss-web/jbosswebserver/jboss-as-virtual-host-configuration . To extend the question (I hope trivially), I'm trying to put the pieces together to allow multiple hosted apps to have their own root context. The immutant flags help, but I'm confused about the wildfly configuration. Suppose I want:

service3.server
service4.server

both to behave as root context (you were correct about assuming multiple host names are coming in to this same box). Then in my standalone.xml do I add another <host> entry to the <server> block, with the handler being my .war file? Do I need to add entries to my /etc/hosts file for the alias, or am I good to keep "localhost" as the alias?

For reference, the block in question in standalone.xml looks like this (default):

            <server name="default-server">
               
<http-listener name="default" proxy-address-forwarding="true" socket-binding="http" redirect-socket="https"/>
               
<host name="default-host" alias="localhost">
                   
<location name="/" handler="welcome-content"/>
                   
<filter-ref name="server-header"/>
                   
<filter-ref name="x-powered-by-header"/>
               
</host>
           
</server>
Enter code here...
Jim Crossley writes:

            send an email to         immutant+u...@googlegroups.com.

Jim Crossley

unread,
Oct 21, 2016, 11:20:02 AM10/21/16
to Immutant
As I understand things, no changes to your standalone.xml should be necessary. The `WEB-INF/jboss-web.xml` created by the 'immutant war' task should be enough. And it should take precedence over what's in standalone.xml regardless.

Is that not what you're seeing?

Jim Crossley

unread,
Oct 21, 2016, 11:21:46 AM10/21/16
to Immutant
Of course, you probably will need to bind to a public interface, e.g. 'bin/standalone.sh -b 0.0.0.0`

Webdev Tory Anderson

unread,
Oct 21, 2016, 11:26:40 AM10/21/16
to Immutant
In that case I guess I'm misreading your instructions:
4) Your service3 war file was created with the following options:
    $ lein immutant war --context-path / --virtual-host
service3.server

The --virtual-host has to specify something I've defined in my standalone.xml, doesn't it?

Jim Crossley

unread,
Oct 21, 2016, 11:30:34 AM10/21/16
to Webdev Tory Anderson, Immutant

No, just a valid hostname.


To unsubscribe from this group and stop receiving emails from it, send an email to immutant+unsubscribe@googlegroups.com.

To post to this group, send email to immu...@googlegroups.com.

Webdev Tory Anderson

unread,
Oct 21, 2016, 12:22:30 PM10/21/16
to Immutant, web...@toryanderson.com
I ran:
lein immutant war --context-path / --virtual-host hpf.byu.edu

I then dropped it in to Wildfly but its deployment failed. From the console.log:


[0m [0m09:48:43,567 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "hpf.war" (runtime-name : "hpf.war")
[0m [0m09:48:43,568 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.undertow.server.default-server."hpf.byu.edu" (missing) dependents: [service jboss.undertow.deployment.default-server."hpf.byu.edu"./, service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
...
 
[0m [0m09:48:44,030 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 11) WFLYCLINF0003: Stopped hpf.war cache from web container
[0m [0m09:48:44,053 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-2) HV000001: Hibernate Validator 5.2.3.Final
[0m [0m09:48:44,147 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0028: Stopped deployment hpf.war (runtime-name: hpf.war) in 133ms
[0m [0m09:48:44,216 INFO  [org.jboss.as.repository] (DeploymentScanner-threads - 1) WFLYDR0002: Content removed from location /srv/wildfly/standalone/data/content/38/42d62d71f9a77fb842601df4bd68ca9d540d61/content
[0m [0m09:48:44,222 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "hpf.war" (runtime-name: "hpf.war")
[0m [0m09:48:44,224 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.deployment.unit."hpf.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.deployment.unit."hpf.war".deploymentCompleteService, service jboss.undertow.deployment.default-server."hpf.byu.edu"./, service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service jboss.deployment.unit."hpf.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.deployment.unit."hpf.war".deploymentCompleteService, service jboss.undertow.deployment.default-server."hpf.byu.edu"./, service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service jboss.deployment.unit."hpf.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.deployment.unit."hpf.war".deploymentCompleteService, service jboss.undertow.deployment.default-server."hpf.byu.edu"./, service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service jboss.deployment.unit."hpf.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.deployment.unit."hpf.war".deploymentCompleteService, service jboss.undertow.deployment.default-server."hpf.byu.edu"./, service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service jboss.deployment.unit."hpf.war".component."org.projectodd.wunderboss.as.ServletListener".START (missing) dependents: [service jboss.deployment.unit."hpf.war".deploymentCompleteService, service jboss.undertow.deployment.default-server."hpf.byu.edu"./, service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service jboss.deployment.unit."hpf.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service jboss.undertow.deployment.default-server."hpf.byu.edu"./ (missing) dependents: [service jboss.deployment.unit."hpf.war".deploymentCompleteService]
      service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService (missing) dependents: [service jboss.undertow.deployment.default-server."hpf.byu.edu"./]
      service jboss.undertow.deployment.default-server."hpf.byu.edu"./.codec (missing) dependents: [service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service jboss.undertow.deployment.default-server."hpf.byu.edu"./.session (missing) dependents: [service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]
      service org.wildfly.request-controller.control-point."hpf.war".undertow (missing) dependents: [service jboss.undertow.deployment.default-server."hpf.byu.edu"./.UndertowDeploymentInfoService]

 
This seems to be in agreement with what is indicated here:

lein help immutant deployment
...
* `:virtual-host` - The name of a host defined in the WildFly
  configuration that has virtual aliases assigned. This likely *won't*
  be the actual hostname. See the
  [WildFly docs](https://docs.jboss.org/author/display/WFLY8/Undertow+subsystem+configuration)
  for more detail.

  This value is written to `WEB-INF/jboss-web.xml` inside the war, and
  a copy of the file is written to `:target-path`.

  The host can be specified on the command line as `-v
  HOST` or `--virtual-host HOST`.
...

Jim Crossley

unread,
Oct 21, 2016, 1:47:56 PM10/21/16
to Immutant, web...@toryanderson.com
Sorry, I'm wrong, you're right. I was thinking of a non-wildfly deployment. And the lein-immutant docs make it quite clear.

Jim Crossley

unread,
Oct 21, 2016, 2:22:35 PM10/21/16
to Immutant, web...@toryanderson.com
Tory, I just confirmed the following worked locally for me,

I added this entry to my /etc/hosts:
  127.0.0.1 foo.crossleys.edu

I built my war file like so:
  $ lein immutant war -c / -v barfko -o ~/local/wildfly

I added the following entry to my standalone-full.xml
  <host name="barfko" alias="foo.crossleys.edu"/>

So the whole <server> element looks like this:
            <server name="default-server">
                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                </host>
                <host name="barfko" alias="foo.crossleys.edu"/>
            </server>

And that enabled http://foo.crossleys.edu:8080 to work for me. Can you confirm that works for you?

Thanks,
Jim
Reply all
Reply to author
Forward
0 new messages