-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Automatic start on login #96
Comments
@abiosoft I have a Homebrew service that works on my machine, give it a try! Leave a thumbs up on the PR if it works, or a comment if it doesn't please! EDIT: it was merged, hopefully it works for everyone. It should, but I guess we can close this issue. |
I wanted to do more testing, prior to having the PR merged. This is where I'm lacking in understanding when it comes to Colima. The service starts in Homebrew and runs effectively, but after some time it restart loops on my machine. I sadly, didn't test for this as I expected once it's up it'll run and do its daemon thing. Looking through logs, Brew Logs: located at
Above shows that Colima has started successfully, I never see any sort of error case happening in these logs. Initial ThoughtsThe issue may be that the livecheck doesn't check the health of the application, so the keep alive from Brew is just restarting it constantly. livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end Removing the keep-alive from the brew config doesn't resolve the issue. I don't believe this is the issue, not sure what else could be causing it. @abiosoft any ideas here? Can you reproduce (if you have a mac) |
That log outputs indicates successful startup. I would say that This is most likely the cause of #156. |
Will revert in Homebrew, removing keep_alive is still hitting the same situation, the logs say it's starting, but docker ps fails, will open another draft and keep that open to ensure it works later tonight. Will reach out then to get approval from others of it working. EDIT: revert PR Homebrew/homebrew-core#94264 |
Thanks for your efforts @NickHackman |
@rfay's original attempt looks promising. It might just be missing setting |
Ah, no, I think we need a way to specify
See also https://www.karltarvas.com/2020/09/11/macos-run-script-on-startup.html. I don't think this is supported in Homebrew yet, but PRs to implement this in https://github.com/Homebrew/brew/blob/423f34dee16e036f685b992a3ba3db29261c8f70/Library/Homebrew/service.rb are welcome. |
@abiosoft Correct my understanding here, but running colima start forks and starts the daemon for the corresponding container runtime? Reading the launchd man pages on MacOS:
Looking at the logs of
From my understanding Colima breaks the above requirements of launchd where it creates a daemon and then @carlocab do you have experience with other applications that behave this way working with launchd in one way or another? |
Not really, but my understanding is that this is why we want This does mean that we don't have the benefit of |
I've been testing Colima with the plist_options manual: "colima"
service do
run [opt_bin/"colima", "start"]
run_type :immediate
keep_alive false
launch_only_once true
environment_variables HOME: ENV["HOME"], PATH: std_service_path_env
error_log_path var/"log/colima.log"
log_path var/"log/colima.log"
working_dir ENV["HOME"]
end It's still following similar behavior where it'll start where Doesn't say anything after it dies in the logs located at |
I'd like to get colima running as a service is there anything I can do to assist? |
I'm using Automator as a workaround for now. |
Hi, @NickHackman need help. I use brew but it says colima not implemented #plist, #service or installed a locatable service file, how can i solve this problem brew services start colima
Error: Formula `colima` has not implemented #plist, #service or installed a locatable service file |
Hi - I just tried this and found that Colina was in Also, I got the error "zsh:2: permission denied: /usr/local/bin/” even though Any ideas? |
(Sidenote: @JCHH2 on arm64 (M1) computers, homebrew puts things in /opt/homebrew, on macOS amd64 it puts them in /usr/local/Homebrew.) |
If you wanted to enable this for yourself trivially you could add a shell script like the following
And modify the plist file to point at the new script. It comes with the caveat of having no relationship to the forked processes colima creates and therefore not responding to the failure of the colima, lima or qemu processes at all. It's only suitable for a run once invokation but could be cycled with It seems like it could be useful to add a configuration flag to colima to create subprocesses as children instead as it would allow the desired behaviour when being run as a service/agent. |
I am currently starting Colima on macOS with a little wrapper script: https://gist.github.com/fardjad/a83c30b9b744b9612d793666f28361a5#file-how-to-start-colima-automatically-on-macos-md The script does the following:
This is less prone to restart loop issues compared to the previous attempts and supports the use-case where the user wants to manually stop colima with @abiosoft It would make things much easier if Colima supported a foreground mode so we could leave it to launchd to manage the process. |
Oh, I never thought of this. Yeah, foreground mode is doable. |
@fardjad Your script is great. - export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
+ export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" |
Looks like the change was reverted: Homebrew/homebrew-core#94264 |
This is the sole reason preventing me from switching from Docker Desktop to |
Would be cool to have this, not a big deal running it manually but would be very nice to have autostart. |
It is a big deal if you're serving actual websites to live traffic from Docker 😇 Power interruptions and/or kernel panics should then cause everything to automatically restart. (I've had both happen already.) (I serve |
Well, you can easily add a script to start colima on boot as other have suggested. Of course an official solution would be nicer |
I'd love to see this too, but it's definitely not a deal-breaker. In the short term, I've been using this ansible-role to manage the launch agent on OSX. (I use Ansible to end-to-end provision my macs...) |
I've implemented the foreground mode. It works with already created service in brew (and then reverted) #789 |
Hi, the FAQ mentions that "since 0.5.6" Colima autostart is easy with |
I just upgraded to 0.5.6 but
|
The commit has been merged. Please verify if it works for you guys. |
Works for me, thanks @regulskimichal ! |
Works for me, too. Thanks! |
Fixed in v0.6.0, thanks! |
People are used to Docker Desktop coming up at login. Can we add the same option with Colima?
I experimented a bit with adding a service using homebrew, but wasn't successful. I think it's probably because colima is already setting up its own launchctl. Not sure what the options might be but letting
brew services
manage the launchctl might be a more integrated solution. My (failed) experiment is at https://github.com/rfay/homebrew-core/blob/601260825034aefbecb50f0a3202f7f0e4f7b197/Formula/colima.rb#L46-L55The text was updated successfully, but these errors were encountered: