beam-init: autostart services - #141
Conversation
d391cd3 to
cdee60f
Compare
| if !run.is_file() { | ||
| return None; | ||
| } |
There was a problem hiding this comment.
If you leave this out, beamctl list should show that it failed to start the executable without interfering with startup. That might be useful for debugging why an autostart service didn't work.
There was a problem hiding this comment.
I think this would be more confusing because we are essentially checking that run exists and is a file. I see a test failure for the expected ignore because it creates a service for a file that doesn't exist.
There was a problem hiding this comment.
Maybe an eprintln!("run not found in {path}) or something to that effect?
There was a problem hiding this comment.
eprintln!() wouldn't be visible to the end user, right?
There was a problem hiding this comment.
Correct but would give cloud logs to help troubleshoot if there were a support issue.
There was a problem hiding this comment.
Putting it in the beamctl list output as failed would allow self-service troubleshooting. And it would be consistent with beamctl start /non/existent. In any case, I don't think this is big enough of a deal to block this PR. I will approve this PR, though I do prefer having at least some way of debugging in place, even if just an eprintln!().
bb0df51 to
03ba916
Compare
It will be expected that users will want to autostart services along with their initial service. This will attempt to start any services named 'run' in the /etc/beam-init/svc/<name>/ paths.
Updates integration test to allow for bind mount and tests autostart
03ba916 to
b70ceea
Compare
|
Just playing devil's advocate here 😈 but if we wanted to keep #!/usr/bin/env bash
set -euo pipefail
BASE_DIR="/etc/beam-init/svc"
for svc_dir in "$BASE_DIR"/*; do
[[ -d "$svc_dir" ]] || continue
svc="$(basename "$svc_dir")"
for script in "$svc_dir"/*; do
[[ -f "$script" ]] || continue
echo "Starting $svc with $script"
beamctl start --name "$svc" -- "$script"
done
done |
It will be expected that users will want to autostart services along with their initial service. This will attempt to start any services named 'run' in the
/etc/beam-init/svc/<name>/paths.Related: #136