Closed p-h closed 6 years ago
Just create a jar with dependencies and run it as any other jar (java -jar file
). There is a tutorial on the web page for deploying to Heroku.
This? I don't know how this applies to people not deploying on Heroku. Some people are still stuck in the mid 2000's when it comes to those things.
It's the same procedure more or less anywhere. Just build a fat jar and run it.
Either you run it as java -jar myServer.jar or you can setup spark to run on something like a Tomcat server if you setup a tomcat server you can also setup gradle/maven to build the project as a war. Its even possible to configure both if you want to run a local and deployment based versions,
So do you ssh into your server, java -jar myApp.jar
, and hope that the ssh connection doesn't crash? That the app doesn't crash and doesn't need to be restarted?
@p-h I think the question is more deployment environment than Spark specific. If you deploy as a runnable JAR, you should write a service wrapper (quick googling turned up for example this: https://dzone.com/articles/run-your-java-application-as-a-service-on-ubuntu). I guess daemontools
and/or supervise
would also be worth looking into.
@jakaarl Thank you, that's what I was looking for. 👍
The docs don't talk much about what a deployment environment would look like, except for this. How would I, for example, go about deploying a Sparkjava app on a classic on premise Ubuntu server? Do I need an Application Server? Do I copy an uber jar to the server and write systemd unit file?