using a `BuildService` how should I be executing a...
# community-support
c
using a
BuildService
how should I be executing an external command? I need to start a non java server; and some way to send a sigint to it later to stop it.
v
sigkill you should be able to send using
Process#destroy()
for example. Arbitrary signals are not supported by Java afair unless maybe you use some native library, or doing some platform specific external call that does it like invoking
kill -SIGINT ...
c
How does Gradle expect me to execute this? Or should I just use process builder?
v
What is "this"?
destroy()
? I don't think you can do that through Gradle-provided utilities but will just use `ProcessBuilder`then.
c
Well I was just trying to figure out if Gradle provided utilities were supposed to be used for starting this process... But from the sounds of it it sounds like no. Which kind of makes me wonder if I should actually use Gradle to start this process, or if I should just rely on it already being running
v
One of the typical use-cases for using a build service is, to start some external server before task that needs it starts and shutting it down after all tasks that need it have finished. There might be processes where you call some starter script that exits after invocation while the server stays running. But I think there are also quite some that would not detach and so for those you could also not use the
ExecOperations
.
c
Yeah it doesn't sound particularly good at it... If I have to write a script around the service in order to stop it. At that point I might as well just use a docker container... Alrighty well I have no desire to look at this further until Monday
v
Starting and stopping Docker or Podman container probably works quite nice as those do exactly that. They start the container and end the command you invoked.
c
yeah, only problem I have is I'm not certain how easy it is to run docker containers in our current CI environment
is podman that sort of replacement for docker compose? I wonder if that ever fixed that problem that annoyed me over docker compose so I cowardly refused to use it
or does podman have one? sorry this is a tangent; I just don't recall hearing about podman before
ah, developed by redhat, that explains everything about their documentation. PASS
skaffold was the thing I was thinking of
v
Podman is a drop-in replacement for Docker, and more. And Podman Compose for Docker Compose.
It is FOSS in more parts, e. g. Podman Desktop is not a commercial product unlike Docker Desktop.
And it can run rootless as long as the containers you run support it.
c
Yeah, but its documentation looks bad...
v
Possible, but you can just read the Docker documentation, the command should (at least for most cases) be 1:1 the same as for Docker
🤣 1
t
Podman is not an exact drop-in though, mainly because it's rootless (due to it being daemon less): • differences in UID/GID mapping which is crucial when using bind-mounts to control the files owner • can't do port mapping to privileged ports
v
That's not exactly right. It can be rootless and thus more secure and so on. But it can also be rootful. It just is rootless by default. Unless you install on Windows for example, where it is rootful by default.
t
TIL about
podman system service
which IIUC turns podman from daemonless to daemonful like Docker, and can thus easily allow being rootful without turning to
sudo
or a podman machine.