small pixel drawing of a pufferfish lilp

in the beginning there was lilp-ness
Jesse Olson j3s@c3f.net
Thu, 10 Feb 2022 04:45:16 +0000
commit

79fcbd8da1c42cb1b55e80eaf0d4386bd5d1e805

2 files changed, 95 insertions(+), 0 deletions(-)

jump to
A README

@@ -0,0 +1,84 @@

+lil process +------------ + +lilp watches git repositories for changes, clones them when they arrive, +and then runs arbitrary commands for you after the cloning is complete. + +lilp is intended to be used like a service manager that is easy to keep +everything up to date with. lilp is especially nice to use with simple scripts, +statically compiled binaries, etc. you may also use it as a build service. + +all logs for your processes go to /var/log/lilp/service-name/stdout and +/var/log/lilp/service-name/stderr. + + lilp is stupid, but resilient + if your process exits quickly, lilp will start it again immediately + fork bombbbbb + + lilp is asking to be hacked + probably dont run lilp as root tbh + lilp provides no process isolation + + lilp runs cron jobs better than cron tho + i built lilp because im extremely lazy + lilp was made to run binaries and scripts + + +install: + +git clone https://git.j3s.sh/lilp +cd lilp && go build +mv lilp /usr/sbin/lilp +mkdir -p /etc/lilp /var/lib/lilp +cp contrib/example-config /etc/lilp/config + +# systemd +cp contrib/lilp.service /etc/systemd/system/lilp.service +systemctl daemon-reload && systemctl start lilp + +# openrc +cp contrib/lilp.initd /etc/init.d/lilp +service lilp start + + +config: + + definitions +clone = the git url to clone & watch. takes the ref argument. +ref = the git ref (branch or tag) to clone + watch for changes +*run = command to run (order matters) - use this to start your service / job +every = how often to run this command (use this only when the process is expected to exit) + +* at least 1 "run" statement is required, everything else is optional +if you leave "clone" out, no repo will be cloned or watched +if you leave "ref" out, the default ref will be "main" +if you leave "every" out, processes will restart 1s after they exit + +the config format is very strict. it goes: + +process "processname" + definition "argument" + + example +# /etc/lilp/config +process "gitea" + clone "https://github.com/go-gitea/gitea.git" + ref "v1.16.1" + # every "run" command is within the context of the cloned repo + run "apt -q go || apt install go" + run "go build" + run "GITEA_PORT=8086 ./gitea" + +process "backup" + clone "https://git.j3s.sh/dotfiles" + ref "main" + run "apt install rsync -y" # a little wasteful but who cares tbh + run "./my-backup-script" + every "1d" + +process "loldockerino" + run "docker run redis" + +process "loldockerino" + run "echo hi mom" + every "1s"
A main.go

@@ -0,0 +1,11 @@

+package main + +type Config struct { + Processes []Process +} + +type Process struct { + RunCmds = []string + Clone = string + Ref = string +}