Is it possible to create a war file with catacumba?
no
it uses netty and uses its own http stack
@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
hmm
serving the static from the jar is completly independent from the ability to create war
I deploy my apps using uberjar
give me 5 min for remember that I'm doing
Sure
java -jar target/uxbox-backend-0.1.0-SNAPSHOT-standalone.jar -m uxbox.main
this how I run the app
this is the repo and its config
I'm just don't want AOT, because of this the -m uxbox.main
the uxbox does not serves static files
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
Right but the problem is that :base-dir requires a system path, not relative path inside a jar
if you not specify it and put .catacumba
file inside resources it does not works?
I didn't test that in real environments but if you give me some time I can do it
What is the .catacumba file?
The jar?
a marker file
touch resources/.catacumba
What does this do?
What can you put in .catacumba?
indicates to catacumba that if no base dir is specified, find one that contains that file
How does it find one?
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
just that
Oh I see
Interesting. I did not know about this. Is this part of ratpack?
yes and not
in ratpack is not automatic
but in catacumba yes it is
What do you mean not automatic?
in ratpack you should explicitly set always the base-dir, and you can use some helper for do that catacumba does
catacumba automatically does that if base dir is not specified
Found the relavent fn: https://github.com/funcool/catacumba/blob/bbb0d0955a07960ffa0ec67c085447673cd2ddd4/src/clojure/catacumba/impl/server.clj#L77
but I think that I'm wrong in one thin
this does not allows in any case serve files
from classpath
seems like this is not solved at this moment
Have you tested it?
Yes but always out of uberjar
I think this will not work in the bundled executable jar
Hmm. Seems like it should. I'll see if the .catacumba
file solves my problem
In any case I recommend serve static files just using nginx or similar
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.
ok, let me know of any result 😉
Will do
[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
I think it will not work
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
I think that is very useful so I priorize that task in my backlog 😉
java -Dcatacumba.basedir=`pwd`/resources -jar target/uxbox-backend-0.1.0-SNAPSHOT-standalone.jar -m uxbox.main
This works as expected
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 😄
I will chat with ratpack developers if they know any way to do it
@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
@kenny: fixed in 0.13.0-SNAPSHOT
https://github.com/funcool/catacumba/blob/master/doc/content.adoc#configuration-options
the final part of that doc section explains a little bit the problem and how to solve
@niwinz: Sweet, that works. Thanks
@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.
It will serve index.html, logback.xml, and I can even download .catacumba.basedir, however, main.js will always be a 404.