Just wanted to reach out and say I just figured this out and it had nothing
to do with openshift whatsoever.

The lab system that I'm running openshift on to develop a proof of concept
is running on a libvirt host with NAT based networking. In order to get to
the application that I have deployed to the openshift cluster from outside
that host, I'm using an Apache reverse proxy. Apache mod_proxy does not
play nicely with websockets as I have found out before and it just never
even dawned on me that that was in play because I was doing a whole bunch
of other testing before I even got to implementing the websocket. It wasn't
until this evening when I was trying to debug the issue with a new tool
that someone pointed me to at a docker meetup that I realized that that was
likely the issue. I was trying to do it from a new machine and realized I
needed to add the IP and hostname to my hosts file to get to it and it hit
me. Super frustrating, but finally got it figured out. Just wanted to say
thanks for all the help!

On Thu, Sep 15, 2016 at 5:10 PM, Tony Saxon <tony.sa...@gmail.com> wrote:

> I don't think that the websocket requests are even hitting the tomcat
> application. The access logs show hitting the main page, but nothing
> against the websocket itself. It's like it's not getting past the router.
>
> On Thu, Sep 15, 2016 at 4:56 PM, Tony Saxon <tony.sa...@gmail.com> wrote:
>
>> I'll see what I can turn on. Right now I don't see anything showing up in
>> the standard catalina.out.
>>
>> On Thu, Sep 15, 2016 at 4:54 PM, Clayton Coleman <ccole...@redhat.com>
>> wrote:
>>
>>> Ben, Ram, any ideas?  We test web sockets frequently so I assume there's
>>> something slightly different about how this app works in docker vs being
>>> behind the router.  Maybe the headers we send getting misinterpreted via
>>> Tomcat?
>>>
>>> Tony, any errors showing up in tomcat logs (or can you turn on verbose
>>> logging and verify that you see the incoming websocket attempt)?
>>>
>>> On Thu, Sep 15, 2016 at 4:50 PM, Tony Saxon <tony.sa...@gmail.com>
>>> wrote:
>>>
>>>> I ended up adding the port to the route configuration, and now i don't
>>>> even get the error immediately. It's almost like it hangs trying to
>>>> establish the websocket connection and only shows the error briefly if I
>>>> navigate to another page. Here's the route configuration:
>>>>
>>>> [root@os-master ~]# oc get route -o yaml
>>>> apiVersion: v1
>>>> items:
>>>> - apiVersion: v1
>>>>   kind: Route
>>>>   metadata:
>>>>     creationTimestamp: 2016-08-16T19:34:58Z
>>>>     labels:
>>>>       app: testwebapp
>>>>     name: testwebapp
>>>>     namespace: testwebapp
>>>>     resourceVersion: "1823387"
>>>>     selfLink: /oapi/v1/namespaces/testwebapp/routes/testwebapp
>>>>     uid: 843470f8-63e8-11e6-95e9-525400f41cdb
>>>>   spec:
>>>>     host: testwebapp.example.net
>>>>     port:
>>>>       targetPort: 8080
>>>>     to:
>>>>       kind: Service
>>>>       name: testwebapp
>>>>   status:
>>>>     ingress:
>>>>     - conditions:
>>>>       - lastTransitionTime: 2016-08-16T19:34:58Z
>>>>         status: "True"
>>>>         type: Admitted
>>>>       host: testwebapp.example.net
>>>>       routerName: ha-router-east
>>>> kind: List
>>>> metadata: {}
>>>>
>>>> On Wed, Sep 14, 2016 at 11:25 PM, Tony Saxon <tony.sa...@gmail.com>
>>>> wrote:
>>>>
>>>>> Not directly in the browser. If I bring up the web developer section
>>>>> of my browser and view the console I see an error about being unable to
>>>>> connect to the websocket for both my application and the built in tomcat
>>>>> examples.
>>>>>
>>>>> On Wed, Sep 14, 2016 at 11:21 PM, Clayton Coleman <ccole...@redhat.com
>>>>> > wrote:
>>>>>
>>>>>> The router should support transparent connection upgrade in that
>>>>>> case.  Are you getting any errors in your browser?
>>>>>>
>>>>>> On Wed, Sep 14, 2016 at 11:15 PM, Tony Saxon <tony.sa...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> When I deploy it manually (standalone tomcat or non openshift docker
>>>>>>> container) the websocket port is 8080 since it's just a context path in
>>>>>>> tomcat. This works perfectly fine. When I deploy to openshift and expose
>>>>>>> port 8080, I'm able to hit port 80 on the router with the name that I
>>>>>>> mapped to the application and get the page and content I expect, but the
>>>>>>> websocket doesn't connect like it does when I deploy manually. I also 
>>>>>>> get
>>>>>>> the same behavior with the example websocket applications included with
>>>>>>> Tomcat which work under normal conditions. So basically, the main page 
>>>>>>> of
>>>>>>> my application is at http://testapp.example.com/testwebapp/ and the
>>>>>>> javascript loaded connects to a websocket at ws://
>>>>>>> testapp.example.com/testwebapp/websocket. Since I get the page to
>>>>>>> load when I hit the application I know it's exposing the right port, but
>>>>>>> form some reason the websocket can't connect.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Sep 14, 2016 at 10:49 PM, Clayton Coleman <
>>>>>>> ccole...@redhat.com> wrote:
>>>>>>>
>>>>>>>> If you're using openshift v3 make sure your websocket port is also
>>>>>>>> listed in your service (services list the ports they expose).  You can
>>>>>>>> alter your route to point directly at your websocket port by setting 
>>>>>>>> the
>>>>>>>> port field:
>>>>>>>>
>>>>>>>> $ oc explain route.spec.port
>>>>>>>> RESOURCE: port <Object>
>>>>>>>>
>>>>>>>> DESCRIPTION:
>>>>>>>>      If specified, the port to be used by the router. Most routers
>>>>>>>> will use all
>>>>>>>>      endpoints exposed by the service by default - set this value
>>>>>>>> to instruct
>>>>>>>>      routers which port to use.
>>>>>>>>
>>>>>>>>     RoutePort defines a port mapping from a router to an endpoint
>>>>>>>> in the service endpoints.
>>>>>>>>
>>>>>>>> FIELDS:
>>>>>>>>    targetPort   <string> -required-
>>>>>>>>      The target port on pods selected by the service this route
>>>>>>>> points to. If
>>>>>>>>      this is a string, it will be looked up as a named port in the
>>>>>>>> target
>>>>>>>>      endpoints port list. Required
>>>>>>>>
>>>>>>>> Set it to "8000".
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Sep 14, 2016 at 10:54 AM, Tony Saxon <tony.sa...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> I have an application that runs on tomcat and uses websockets. I'm
>>>>>>>>> able to build it and test it in a standalone docker container and it 
>>>>>>>>> works
>>>>>>>>> fine. When I deploy that same image to my openshift instance the
>>>>>>>>> application can not connect to the websocket. After doing some 
>>>>>>>>> research
>>>>>>>>> I've found some conflicting information. Older articles that i've read
>>>>>>>>> mention that you can only connect to websockets on openshift through 
>>>>>>>>> port
>>>>>>>>> 8000 or 8443. However, the documentation at
>>>>>>>>> https://docs.openshift.org/latest/architecture/core_concepts
>>>>>>>>> /routes.html#routers seems to indicate that websockets are no
>>>>>>>>> different then the other protocols handled by the openshift router. 
>>>>>>>>> Is this
>>>>>>>>> the case or does it need to be port 8000? If it's port 8000, do I 
>>>>>>>>> need to
>>>>>>>>> configure a separate connect in tomcat in my docker container for 
>>>>>>>>> port 8000?
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> users mailing list
>>>>>>>>> users@lists.openshift.redhat.com
>>>>>>>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
_______________________________________________
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to