Skip to content

beam-init: autostart services - #141

Open
rcanderson23 wants to merge 2 commits into
mainfrom
carson/autostart-services
Open

beam-init: autostart services#141
rcanderson23 wants to merge 2 commits into
mainfrom
carson/autostart-services

Conversation

@rcanderson23

@rcanderson23 rcanderson23 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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

@rcanderson23
rcanderson23 force-pushed the carson/autostart-services branch 10 times, most recently from d391cd3 to cdee60f Compare August 12, 2026 21:26
@rcanderson23
rcanderson23 marked this pull request as ready for review August 12, 2026 21:30
@rcanderson23
rcanderson23 requested review from bjorn3, boxofrad, folkertdev, sclevine and squell and removed request for bjorn3 and folkertdev August 12, 2026 21:30
Comment thread beam-init/src/services.rs
Comment on lines +808 to +810
if !run.is_file() {
return None;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rcanderson23 rcanderson23 Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an eprintln!("run not found in {path}) or something to that effect?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eprintln!() wouldn't be visible to the end user, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct but would give cloud logs to help troubleshoot if there were a support issue.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!().

Comment thread beam-init/src/services.rs Outdated
Comment thread beam-init/src/services.rs
@rcanderson23
rcanderson23 force-pushed the carson/autostart-services branch 4 times, most recently from bb0df51 to 03ba916 Compare August 13, 2026 15:24
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
@rcanderson23
rcanderson23 force-pushed the carson/autostart-services branch from 03ba916 to b70ceea Compare August 14, 2026 14:34
@boxofrad

Copy link
Copy Markdown

Just playing devil's advocate here 😈 but if we wanted to keep beam-init as small as possible, we could have the beam entrypoint script do something like this:

#!/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants