r/unRAID•
cbackas

Running jars in unRaid

Hey guys. Right now we've got plex/all that stuff running on an Ubuntu server installation, and also a handful of discord bots (fat jars) that are run using screen. I'd like to make the switch to unRaid for this server, the only issue being how to handle the discord bots. Whats the best way to go about running these jars? As of now, we upload new bot builds via sFTP and restart the screen for said bot using SSH. There are 3 of us with our own bots that we maintain, all written in Java. So far the best idea we've come up with to mimic this workflow is just running an Ubuntu server VM just to run the discord bots. Are there any caveats to this idea? We haven't had much success making it work on its own but I want to make sure we're heading down the right path. The idea of having to build docker containers for the bots every time we want to update them doesn't seem super appealing, but I'm open to the idea if that's really the best thing to do - keeping in mind that we'd still want to be able to see the CLI for the bots over SSH or something (including external access).

Let me know if I need to elaborate on anything. Thanks in advance.

Update: External access isn't really necessary because we have a VPN set up now so that external users access unRaid and whatnot "internally".

Posted May 18, 2018, 7:21 PM UTC

920
1n5aN1aC•

You could automate the building of the dockers, but yeah, I'd probably just toss up a VM or two. Shouldn't cause any problems.

2
ColeBrodine•

There are 3 of us with our own bots that we maintain, all written in Java. So far the best idea we've come up with to mimic this workflow

Just wanted to second this. Just do a Ubuntu Server VM or similar so that it doesn't even have a GUI and is more low profile. You should be able to get away with giving it very few resources.

Building the docker containers works too, but VM seems like path of least resistance.

1
cbackasOP•

So far we’ve tried using alpine Linux in a VM to run things because it’s so lightweight, but we’re having trouble getting java to work on it. Any ideas? Either to make alpine work or a different distro all together? We currently run Ubuntu server which is headless but we’d like to slim down from that if that’s possible

1
ColeBrodine•

I'm afraid I don't have much experience with Alpine Linux. I mostly use Ubuntu Server for the one VM that I have. I know a lot of dockers are based on Alpine, and that's about all I've ever used it for.

1
pengee•

This is pretty easy. Just make a new container with the repo as 'java:alpine' or the specific version of java you need, network to w/e you need (probably just bridge) and a virtual path to the location of your jar(s). The post argument will be something like:

./usr/bin/java -jar /VirtalPath/MyJarFile.jar
3
cbackasOP•

Alright, fair enough. We scrapped alpine and are going to try Arch. If that doesn’t work out we’ll probably just return to Ubuntu server since that’s what we have the most experience with, but Arch looks promising.

2
Muh-Q•

You should have a VCS like git to develop your bots anyway, right? Just hook up a CI process to it and have it build your docker images and maybe even deploy new images automatically.

Running in docker you can still see all the output using "docker logs <container_name>".

I feel running them in docker containers makes it easier for you to keep everything updated. If you add a full VM, you have another system you have to keep updated and managed.

1
cbackasOP•

We’ve already got the VM up because we needed to get things back online, but thanks. We do use GitHub, and I’d really like to explore the docker method more down the road.

Edit: I’d also like to say that you’re the person who’s given the most helpful info about using containers instead of a VM, so thanks. Most other people just replied with “automate your workflow and use docker.” - which naturally wasn’t enough info to help me get that going :P

1
cryptomon•

VM all the way.

1