This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-07
Channels
- # announcements (1)
- # babashka (31)
- # beginners (54)
- # biff (3)
- # calva (22)
- # cider (13)
- # circleci (1)
- # clj-kondo (6)
- # cljsrn (2)
- # clojure (113)
- # clojure-europe (58)
- # clojure-mexico (5)
- # clojure-nl (3)
- # clojure-uk (7)
- # clojurescript (81)
- # cursive (20)
- # datomic (33)
- # events (3)
- # fulcro (29)
- # introduce-yourself (1)
- # meander (78)
- # off-topic (60)
- # om-next (2)
- # podcasts-discuss (1)
- # re-frame (8)
- # reagent (5)
- # reitit (20)
- # remote-jobs (1)
- # shadow-cljs (24)
- # spacemacs (10)
- # sql (8)
- # tools-deps (22)
- # xtdb (16)
#lambda trending on Twitter Germany... At first I thought "yay!" but then I noticed that it's the new Corona mutation 😕
if i don't know supervisord well, what's the easiest way to kick off running a jar even after the shell closes after remoting in?
How married are you to the idea of supervisord? I use systemd user services (and I guess system systemd services too) a fair bit
not married to supervisord or systemd at all. i meant i don't know it at all and would love a simpler solution
don't care about OS boot. i can manually restart it. this is kind of a staging area for a long running branch and just needs to run a jar
`systemd-run --user --slice misc-services -u heat -G -E BS_PORT=23456 -E BS_HOST=192.168.1.160 sbcl --noinf orm --no-sysinit --no-userinit --disable-debugger --eval '(load "src/heat/control.lisp")' --eval '(some-like -it-hot:do-stuff)' ` is an example of launching a one off systemd user service, but you'll need to make a unit file for it if you want to restart on exit, etc
fair. maybe that is a simple solution that just works. and keeps the system out in a place
$ cat bin/rib
#!/usr/bin/env bash
# -*- mode: sh; coding: utf-8; tab-width: 4; indent-tabs-mode: nil -*-
set -euo pipefail
IFS=$'\n\t'
unset TMUX
tmux new-session -d -s rib-"$$" -- direnv exec "$PWD" "$@"
Good question. I don't remember. 😞 Even though it's just two lines this has actually evolved quite a bit over the years as I found rare cases where it didn't work, e.g. adding direnv exec.
I suspect this is the answer, https://stackoverflow.com/q/16398850, so rib can be run from inside a tmux session
tmux (discussed above) is a more advanced screen
and nohup is the most primitive version
I’ve often just run jars from a terminal in a daemonized emacsclient
emacs --daemon
emacsclient -nw
within emacs:
M-x ansi-term
$ java -jar my-uber-jar.jar
it’s not the most robust, but it’s very convenient
for a portable solution there's jsvc, which can integrate on other OS (who uses anything but linux these days in prod?) I made a small convenience wrapper that lets you plug your clojure code into it without a need for AOT https://github.com/noisesmith/clj-jsvc-adapter
it uses a system property to decide which namespace to load via clojure.lang.rt and run
it's also the only java code I've ever published / used in prod iirc
right, but you can also put the jar on classpath and it will do the same thing with the above wrapper (and get restarted via jsvc, logged via jsvc, etc.)
but there are simpler options if you don't need to run on an OS other than Linux
also, do you care about the program's log output? do you want to know when it crashes via any monitor?
another feature you may or may not want is a file indicating the process current PID
and/or ensuring that only one process is running it at a time
what about stderr?
that's often more important
fair. yeah. would love all output streams piped to a file. don't care about separating them
yeah, you can of course get all of this with nohup + redirects / tee, but any good service runner removes a lot of the details you need to think about
the issue with using ad-hoc things like tmux is the logs become ephemeral - eg. if the machine reboots
it's really a question IMHO of what you want to support platform wise
if all you need is linux, use linux - that is to say systemd
oh i see the benefits of your wrapper now. i assumed i could just jsvc my-jar.jar
but its not that simple
yeah. i think i'll just go the systemd route. just need to figure out collecting the output
jsvc offers restarts, PID monitoring, ensuring it's a singleton, log rotation and retention, etc. etc.
but systemd is easier if you only need linux
and it's going to capture program output in a log file out of the box right?
no it logs to stdout. would need to redirect that. not sure if i can just pipe it with systemd-run or if that's an option to be set
right, the wrappers all expect you to log to std(out/err) and they capture that into files
and I would be very surprised if systemd was an exception there