funcool

A channel for discussing and asking questions about Funcool libraries https://github.com/funcool/
kenny 2016-04-14T06:20:00.000254Z

Is it possible to create a war file with catacumba?

niwinz 2016-04-14T06:24:11.000255Z

no

niwinz 2016-04-14T06:24:29.000256Z

it uses netty and uses its own http stack

kenny 2016-04-14T06:44:39.000257Z

@niwinz: Is there something similar to a war file that you can create in order to nicely bundle up your application? It would be nice to able to serve static files from inside a jar instead of requiring it be on the system path

niwinz 2016-04-14T06:45:25.000258Z

hmm

niwinz 2016-04-14T06:45:57.000259Z

serving the static from the jar is completly independent from the ability to create war

niwinz 2016-04-14T06:46:17.000260Z

I deploy my apps using uberjar

niwinz 2016-04-14T06:46:30.000261Z

give me 5 min for remember that I'm doing

kenny 2016-04-14T06:46:37.000262Z

Sure

niwinz 2016-04-14T06:48:02.000263Z

java -jar target/uxbox-backend-0.1.0-SNAPSHOT-standalone.jar -m uxbox.main

niwinz 2016-04-14T06:48:06.000264Z

this how I run the app

niwinz 2016-04-14T06:48:19.000265Z

https://github.com/uxbox/uxbox-backend

niwinz 2016-04-14T06:48:23.000267Z

this is the repo and its config

niwinz 2016-04-14T06:48:49.000268Z

I'm just don't want AOT, because of this the -m uxbox.main

niwinz 2016-04-14T06:49:06.000269Z

the uxbox does not serves static files

niwinz 2016-04-14T06:49:43.000270Z

but as far as I know it is easy setup puting the .catacumba file inside resources and configure properly the routing for serve static files from there

kenny 2016-04-14T06:50:39.000271Z

Right but the problem is that :base-dir requires a system path, not relative path inside a jar

niwinz 2016-04-14T06:52:35.000272Z

if you not specify it and put .catacumba file inside resources it does not works?

niwinz 2016-04-14T06:52:56.000273Z

I didn't test that in real environments but if you give me some time I can do it

kenny 2016-04-14T06:53:03.000274Z

What is the .catacumba file?

kenny 2016-04-14T06:53:08.000275Z

The jar?

niwinz 2016-04-14T06:53:09.000276Z

a marker file

niwinz 2016-04-14T06:53:18.000277Z

touch resources/.catacumba

kenny 2016-04-14T06:53:24.000278Z

What does this do?

kenny 2016-04-14T06:53:37.000279Z

What can you put in .catacumba?

niwinz 2016-04-14T06:53:41.000280Z

indicates to catacumba that if no base dir is specified, find one that contains that file

kenny 2016-04-14T06:54:26.000282Z

How does it find one?

niwinz 2016-04-14T06:55:24.000283Z

I don't know the impl, the fact is, if you don't provide the base-dir parameter on server startup, it will find .catacumba file in the class path and the directory where that file exists put as the base dir

niwinz 2016-04-14T06:55:27.000284Z

just that

kenny 2016-04-14T06:55:43.000285Z

Oh I see

kenny 2016-04-14T06:56:04.000286Z

Interesting. I did not know about this. Is this part of ratpack?

niwinz 2016-04-14T06:56:14.000287Z

yes and not

niwinz 2016-04-14T06:56:21.000288Z

in ratpack is not automatic

niwinz 2016-04-14T06:56:27.000289Z

but in catacumba yes it is

kenny 2016-04-14T06:57:10.000291Z

What do you mean not automatic?

niwinz 2016-04-14T06:57:32.000292Z

in ratpack you should explicitly set always the base-dir, and you can use some helper for do that catacumba does

niwinz 2016-04-14T06:57:46.000293Z

catacumba automatically does that if base dir is not specified

niwinz 2016-04-14T06:59:40.000296Z

but I think that I'm wrong in one thin

niwinz 2016-04-14T06:59:50.000297Z

this does not allows in any case serve files

niwinz 2016-04-14T06:59:54.000298Z

from classpath

niwinz 2016-04-14T07:00:07.000299Z

seems like this is not solved at this moment

kenny 2016-04-14T07:00:36.000300Z

Have you tested it?

niwinz 2016-04-14T07:01:23.000301Z

Yes but always out of uberjar

niwinz 2016-04-14T07:01:42.000302Z

I think this will not work in the bundled executable jar

kenny 2016-04-14T07:02:40.000303Z

Hmm. Seems like it should. I'll see if the .catacumba file solves my problem

niwinz 2016-04-14T07:03:14.000304Z

In any case I recommend serve static files just using nginx or similar

kenny 2016-04-14T07:04:08.000305Z

Yes in prod. This is actually for a small dev tool so it would be nice to just distribute it as a standalone jar that can run in the background.

niwinz 2016-04-14T07:04:57.000306Z

ok, let me know of any result 😉

kenny 2016-04-14T07:05:22.000307Z

Will do

niwinz 2016-04-14T07:11:56.000308Z

[3/5.2]niwi@kaleidos:~/uxbox/uxbox-backend> java -jar target/uxbox-backend-0.1.0-SNAPSHOT-standalone.jar -m uxbox.main Exception in thread "main" java.lang.IllegalStateException: Could not find marker file '.catacumba' via context class loader

niwinz 2016-04-14T07:12:05.000309Z

I think it will not work

niwinz 2016-04-14T07:14:51.000311Z

The most closes solution to that you want is just create the uberjar and latter package it for use static files from main filesystem (no classpath), you don't need nginx but at this moment you can't serve files from classpath

niwinz 2016-04-14T07:15:08.000312Z

I think that is very useful so I priorize that task in my backlog 😉

niwinz 2016-04-14T07:17:40.000313Z

java -Dcatacumba.basedir=`pwd`/resources -jar target/uxbox-backend-0.1.0-SNAPSHOT-standalone.jar -m uxbox.main

niwinz 2016-04-14T07:18:36.000315Z

This works as expected

niwinz 2016-04-14T07:20:44.000316Z

I will try to implement the ability to serve static files from classpath, because for small applications this is the most obvious way to deploy them 😄

niwinz 2016-04-14T08:01:41.000317Z

I will chat with ratpack developers if they know any way to do it

niwinz 2016-04-14T10:03:37.000318Z

@kenny: I think that I found a solution, at this moment I don't have much time for it, but this afternoon I'll try to make it done

niwinz 2016-04-14T16:19:44.000319Z

@kenny: fixed in 0.13.0-SNAPSHOT

niwinz 2016-04-14T16:20:09.000322Z

the final part of that doc section explains a little bit the problem and how to solve

kenny 2016-04-14T20:38:50.000323Z

@niwinz: Sweet, that works. Thanks

kenny 2016-04-14T22:18:37.000324Z

@niwinz: Actually I am having a problem with it.. It doesn't seem to find my js file that is in the same directory as .catacumba.basedir. It will serve my index.html though. The main.js file will get a 404.

kenny 2016-04-14T22:20:06.000326Z

It will serve index.html, logback.xml, and I can even download .catacumba.basedir, however, main.js will always be a 404.