immutant

http://immutant.org Note: dev discussion happens in #immutant on FreeNode IRC.
trancehime 2016-02-03T03:17:20.000053Z

Damn.

trancehime 2016-02-03T03:17:27.000054Z

cURL didn't return anything...

trancehime 2016-02-03T03:24:59.000055Z

It connected, but the content-length of the response is 0.

2016-02-03T11:01:25.000056Z

@trancehime: what is the status code?

2016-02-03T11:01:41.000057Z

how is the app deployed? are you overriding the context-path at all? or using the default?

2016-02-03T11:02:17.000058Z

if the default, and you're deploying some-app.war, are you hitting /some-app/?

trancehime 2016-02-03T12:59:04.000059Z

@tcrawley: I'm using scanner in the Wildfly; status code is HTTP1.1 302

trancehime 2016-02-03T12:59:27.000060Z

context-path is set to /crowd and I am deploying crowd.war

trancehime 2016-02-03T12:59:35.000061Z

I do to /crowd/

trancehime 2016-02-03T13:02:29.000062Z

So basically, cURL gives me a response of HTTP1.1 302 but when I try to access the URL normally, it gives me 403

2016-02-03T13:03:31.000063Z

the 302 is a redirect, where is it redirecting you to?

2016-02-03T13:03:53.000064Z

and by accessing normally, do you mean in a browser directly against WildFly, or against nginx?

trancehime 2016-02-03T13:05:29.000065Z

the cURL response just regurgitated the same URL as normal <the domain>/crowd/ And as for accessing normally, I meant the latter

2016-02-03T13:07:24.000066Z

where <the domain> is the domain where nginx is listening? do you have something in the app itself that explicitly redirects to that?

2016-02-03T13:07:42.000067Z

you can try setting a host header to <the domain> on the curl request

trancehime 2016-02-03T13:07:48.000068Z

Well right now the domain is set to localhost on the remote server

2016-02-03T13:08:19.000069Z

do you have something that is ensuring https? is the redirect to https://?

trancehime 2016-02-03T13:08:27.000070Z

It is not

trancehime 2016-02-03T13:08:44.000071Z

And, as far as I am concerned, I do not force https either.

2016-02-03T13:09:37.000072Z

so, when you curl directly against http://localhost:8080/crowd/, it redirects you to http://localhost/crowd/?

trancehime 2016-02-03T13:12:10.000073Z

It redirects to http://localhost:8080/crowd/ ...

2016-02-03T13:12:44.000074Z

so it's a redirect loop?

2016-02-03T13:12:56.000075Z

or is the ... a subcontext?

trancehime 2016-02-03T13:13:43.000076Z

I don't know where the redirect loop comes from because lein run seems to not have any issues

2016-02-03T13:14:33.000078Z

any way you can share a project with me that recreates this?

trancehime 2016-02-03T13:14:34.000079Z

And nah. "..." isn't subcontext

trancehime 2016-02-03T13:15:26.000080Z

Actually, would the fact my project's using -main to initialize the web handler have anything to do with it

2016-02-03T13:15:49.000081Z

no, that is the proper way to do it with immutant

2016-02-03T13:16:01.000082Z

that will get called both inside and outside the container

2016-02-03T13:16:10.000083Z

assuming that main is calling immutant.web/run

trancehime 2016-02-03T13:16:24.000084Z

Yeah. I'm using immutant.web/run

trancehime 2016-02-03T13:16:55.000085Z

And I guess :port is overriden right?

2016-02-03T13:17:17.000086Z

maybe you are using something in your ring middleware stack that doesn't like being at a subcontext. Would it be possible to deploy this at the root context in WildFly?

2016-02-03T13:17:38.000087Z

the simplest way to do that is to rename the war to ROOT.war (case is important)

trancehime 2016-02-03T13:17:45.000088Z

No, it has to be in some other context as that is a requirement I was given

2016-02-03T13:18:03.000089Z

yes, the :host and :port options are ignored when in-container, yes

trancehime 2016-02-03T13:18:13.000090Z

OK, good, just checking

2016-02-03T13:18:14.000091Z

can you run WildFly locally on your dev macnine?

trancehime 2016-02-03T13:18:26.000092Z

I suppose I'll need to try that

trancehime 2016-02-03T13:19:39.000093Z

Would there be any kind of general causes for this problem though that I could look into?

trancehime 2016-02-03T13:19:57.000094Z

Similar to what you suggested about something in my ring middleware stack not playing nicely with subcontexts

2016-02-03T13:20:10.000095Z

I don't know what would cause this, generally.

trancehime 2016-02-03T13:20:11.000096Z

(Which is weird because my ring middleware stack is basically the same as my other non-Immutant web app)

2016-02-03T13:20:24.000097Z

That's the only guidance I have, really

2016-02-03T13:20:32.000098Z

does the non-Immutant app run in WF?

2016-02-03T13:20:41.000099Z

ah, right, it does

trancehime 2016-02-03T13:20:47.000100Z

Yep, that's the one you gave me the fix for

2016-02-03T13:20:48.000101Z

that's the one with the :vfs issue

trancehime 2016-02-03T13:20:58.000102Z

Which is now perfectly fine thanks to the fix you gave me

trancehime 2016-02-03T13:21:26.000103Z

What a strange problem...

2016-02-03T13:22:00.000104Z

I'd try the immutant app locally in WildFly at the /crowd context, see if it redirects. if so, try it at /

2016-02-03T13:22:31.000105Z

if it doesn't redirect at either, I would suspect something in the wildfly config (though I don't know what that would be)

2016-02-03T13:23:01.000106Z

but if you don't mind checking locally, let me know what you find and we'll go from there

trancehime 2016-02-03T13:23:18.000107Z

OK, reminder to self I will use Wildfly 9.0.2.Final locally as that is what was set up on the remote server

trancehime 2016-02-03T13:23:56.000108Z

And really, I don't have any other options but to take this approach to try and uncover potential reasons for this problem. It's quite mindboggling

trancehime 2016-02-03T13:24:09.000109Z

I'd think if it was really a problem with my project code, I'd have gotten log complaints...

trancehime 2016-02-03T13:30:06.000110Z

For the mean time, I'll try doing some further investigation Z_Z

2016-02-03T13:30:31.000111Z

if you can recreate the issue locally, can you share a gist of the middleware stack at least?

trancehime 2016-02-03T13:30:54.000112Z

Yeah, definitely

trancehime 2016-02-03T13:35:47.000113Z

https://developer.jboss.org/thread/249050?start=0&amp;tstart=0 this is pretty much the only clue I could find on it before I decided to ask here, but I don't know where to find a web.xml

2016-02-03T13:37:40.000115Z

are you using basic auth?

2016-02-03T13:38:43.000116Z

We generate a web.xml for you and put it in the war. You can override the web.xml used with the :resource-paths option to the immutant plugin

2016-02-03T13:39:00.000117Z

if you aren't doing that, you'll be getting the default web.xml we provide

2016-02-03T13:39:12.000118Z

which has that listener-class setting in it

trancehime 2016-02-03T13:40:22.000119Z

Well, I'm using friend

kardan 2016-02-03T13:41:28.000120Z

I tried to hook up immutant/web with Duct, according to https://github.com/weavejester/ring-jetty-component/blob/master/src/ring/component/jetty.clj. For some reason I can’t get Immutant to not reply with a 404. If I swap to Aleph it works. Do anyone know if there is something inherit with how Immutant works that don’t fly with the Duct setup? Or is the guess that I’m just doing something wrong? I tried to start Immutant without and without options.

2016-02-03T13:41:56.000122Z

@kardan: can you share your duct code?

2016-02-03T13:42:27.000123Z

how are you starting immutant? what are you passing to immutant.web/run?

kardan 2016-02-03T13:44:15.000124Z

https://gist.github.com/kardan/e810801e78fb6277ede4

2016-02-03T13:46:03.000125Z

when using immutant, does that pprint get triggered?

kardan 2016-02-03T13:48:00.000126Z

I added that when I was trying to find out what was going on. I need to double check that I’m not a fool

2016-02-03T13:48:30.000127Z

called or not, software makes fools of us all every day

trancehime 2016-02-03T13:48:42.000128Z

Tell me about it

kardan 2016-02-03T13:58:09.000129Z

Hmm no, I still only get a "Resource not found” reply when using Immutant

2016-02-03T13:58:44.000130Z

is that from the browser? what happens if you try to curl to the app?

kardan 2016-02-03T14:04:58.000131Z

I just get connection refused. I wonder if I do something odd

2016-02-03T14:05:20.000132Z

that makes me think that immutant isn't actually getting started then

2016-02-03T14:05:24.000133Z

what port are you connecting to?

2016-02-03T14:05:30.000134Z

immutant will start on 8080 by default

2016-02-03T14:05:36.000135Z

not sure what aleph's default is

kardan 2016-02-03T14:06:59.000136Z

It should be 3000, the default Duct template feed an option map {:port 3000}

kardan 2016-02-03T14:07:13.000137Z

I’m testing both right now

2016-02-03T14:07:15.000138Z

you should see 09:06:36.276 INFO [org.projectodd.wunderboss.web.Web] (main) Registered web context / when immutant starts

kardan 2016-02-03T14:07:45.000139Z

Yes

kardan 2016-02-03T14:08:08.000140Z

I also looked the response headers and saw that I got a 404 from Undertow

2016-02-03T14:08:30.000141Z

on 8080 or 3000?

kardan 2016-02-03T14:09:15.000142Z

I think that was on 3000

kardan 2016-02-03T14:09:31.000143Z

Maybe I need to take a step back and organise myself a bit

2016-02-03T14:09:34.000144Z

and what are the full options that are being passed to immutant.web/run

2016-02-03T14:09:34.000145Z

?

2016-02-03T14:09:36.000146Z

sure

kardan 2016-02-03T14:09:52.000147Z

I thought I would ask if it was know to not work

2016-02-03T14:10:16.000148Z

no, it should work, we have lots of users using component

2016-02-03T14:10:23.000149Z

but I'm happy to help you figure it out

kardan 2016-02-03T14:10:25.000150Z

I’m very thankful, but right now it feels like I steal your time and I’m a bit unorganised with what I have done

2016-02-03T14:11:37.000151Z

sure thing, just let me know if I can offer any more guidance once you are organized

kardan 2016-02-03T14:14:03.000152Z

Thanks. Need to hit out and get kids soon so I might take a break and try later

2016-02-03T14:14:22.000153Z

you can't have too many kids

2016-02-03T14:19:26.000154Z

@trancehime: morning! catching up with your struggles, you wouldn't happen to be passing a :path option to web/run would you?

kardan 2016-02-03T14:19:40.000155Z

I tried with and without

kardan 2016-02-03T14:20:12.000156Z

(I think)

trancehime 2016-02-03T14:21:01.000157Z

@jcrossley3: I am passing a :path option but it is the same name as the .WAR file

2016-02-03T14:21:10.000158Z

if your app is called ctx.war, passing :path /ctx will result in a path of /ctx/ctx

trancehime 2016-02-03T14:21:10.000159Z

Good morning to you too

trancehime 2016-02-03T14:21:19.000160Z

...welp

trancehime 2016-02-03T14:21:33.000161Z

TIL

2016-02-03T14:21:51.000162Z

@jcrossley3: thanks for thinking of that :)

2016-02-03T14:22:17.000163Z

it still may not solve anything

trancehime 2016-02-03T14:23:01.000164Z

Hmm. Well still it's worth a shot.

trancehime 2016-02-03T14:23:41.000165Z

Since for most of my general playing about with it I've been passing a :path option of /crowd and deploying the .WAR file under the name crowd.war

trancehime 2016-02-03T14:24:22.000166Z

The browser path may just have /crowd/ as context, it may actually be treated by the server as /crowd/crowd as you said which is not handled by nginx.

2016-02-03T14:25:03.000168Z

true

2016-02-03T14:25:33.000169Z

best thing would be to bypass nginx for a sanity check, but that may not be possible

trancehime 2016-02-03T14:26:31.000170Z

That is what @tcrawley had suggested to me in the first place, but I had enough trouble even getting any of my web apps to properly be hosted on a virtual url without it

trancehime 2016-02-03T14:26:51.000171Z

(As you can tell, I'm pretty horrid when it comes to app deployment)

2016-02-03T14:27:00.000172Z

that @tcrawley has got it going on

2016-02-03T14:27:59.000173Z

app deployment is like staining a plywood floor: easy to underestimate the difficulty and a pita to fix if you get it wrong

trancehime 2016-02-03T15:01:36.000176Z

Well, it's getting late, so it's time for bed

jrotenberg 2016-02-03T23:26:38.000177Z

aww man

jrotenberg 2016-02-03T23:26:54.000178Z

“well, the rest of the team knows scala, so lets just write it in that"

jrotenberg 2016-02-03T23:27:05.000179Z

“sure, no problem"

jrotenberg 2016-02-03T23:27:20.000180Z

quietly goes back to desk and updates linkedin profile