cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.67k stars 103 forks source link

Add command line option to run without audio #728

Closed torarnv closed 5 months ago

torarnv commented 5 months ago

The default behavior is to run with audio if we're showing the Tart UI window. It can be disabled with --no-audio.

When running without a UI Window, audio is disabled, but can be enabled via --audio.

torarnv commented 5 months ago

Thank you for the improvement! Great idea to allow control audio in the VM. IMO overthinking with separate --no-audio and --audio with custom logic for VNC/nonVNC is too complex and magical. What do you think of a single audio flag that will allow to directly control audio without customization for window/no window?

I think the expectation when running with --no-graphics is that Tart is running as a service, where the host is not affected. Having random sounds come out of the host sound device because some audio based CI test in the guest is running seems strange with that expectation 😄

If disabling audio in no-graphics mode is too magical, perhaps we should introduce a --background or --daemon or --detach flag, that disables both graphics and audio, and also backgrounds Tart instead of running in the foreground? It's something I've missed, similar to docker start, where I can kick off Tart in the background without fiddling with stuff like nohup tart run something >/dev/null 2>&1 &.

fkorotkov commented 5 months ago

I did a little digging and --graphics was introduced in #248 to support having both VNC and UI for debugging Packer plugin in https://github.com/cirruslabs/packer-plugin-tart/pull/21 This way Packer plugin runs something like tart run sonoma-base --graphics --vnc-experimental to have both VNC for the plugin to send commands to and UI window for debugging by a person.

In case of audio still seems like a single --no-audio mimicking --no-graphics is sufficient enough.

I think in most of the cases when --no-graphics is used it's used on a host somewhere in a datacenter where either sounds on the host is already disabled or there are no people to bother. 😅 Introducing yet another flag like --headless is an option but might be too much for just passing --no-graphics --no-audio by an integrator.

torarnv commented 5 months ago

I did a little digging and --graphics was introduced in #248 to support having both VNC and UI for debugging Packer plugin in cirruslabs/packer-plugin-tart#21 This way Packer plugin runs something like tart run sonoma-base --graphics --vnc-experimental to have both VNC for the plugin to send commands to and UI window for debugging by a person.

Interesting you should mention that :) One of my use-cases is that I want to run packer provisioning using Tart without any graphics or audio. Would you expect the headless option in the Tart packer plugin to then map to both --no-graphics and --no-audio ?

In case of audio still seems like a single --no-audio mimicking --no-graphics is sufficient enough.

Fair enough :)

I think in most of the cases when --no-graphics is used it's used on a host somewhere in a datacenter where either sounds on the host is already disabled or there are no people to bother. 😅 Introducing yet another flag like --headless is an option but might be too much for just passing --no-graphics --no-audio by an integrator.

For the data center case, I'd agree. But what do you think of a detach/daemon/headless option for regular users? Having to keep a terminal open (and remembering to not close it to not kill the VM) is a bit annoying :) I run these VMs without graphics because I use them as local test runners. Setting up orchard for that seems a bit overkill 😅

fkorotkov commented 5 months ago

For the packer plugin we might just add an option to disable audio as well. Might be handy for when we use screen reader 😅

detach/daemon/headless is a theme that was discussed several times on different occasions and we'd agreed in most cases that integrations should handle VM lifecycle and "background" activity. For example, Cirrus CLI can help you automate your testing. Or if your custom test runner can handle starting and stopping VMs.

We might reconsider developing Tart Desktop application #305 that will sit in your tray. But we need more than just one use case to allocate time for developing and maintaining it.

torarnv commented 5 months ago

For the packer plugin we might just add an option to disable audio as well. Might be handy for when we use screen reader 😅

Why not use the existing headless option?

fkorotkov commented 5 months ago

Why not use the existing headless option?

Maybe it can be a part of headless but also as a separate option. It's something to think about when making a PR to the Packer plugin. My initial though is to have it configured separately since IMO headless is about no GUI rather than no nothing. Anyways it's a discussion outside of the scope of this PR.

fkorotkov commented 5 months ago

As to merge this PR let's just keep one --no-audio option to disable audio device. Does it sound fair?

torarnv commented 5 months ago

Yepp, I'll re-push based on that.