frankenphp
frankenphp copied to clipboard
Feature request: self-upgrade command
Let's imagine that it's more convenient for me to use frankenphp as a stand-alone binary. Therefore, it is downloaded to my working folder.
It would be super handy if there was a self-upgrade command that would:
- detect which operating system is used
- download a new binary file and replaced the old one with it
Good idea. This could be implemented by porting this code to Go: https://github.com/laravel/octane/pull/764/files#diff-4c211241cfa3be7c1ba31f8fabc468b671a007ab6fc93a3ca5b379c9567a4c4cR52-R93
Also these
creativeprojects/go-selfupdate mouuff/go-rocket-update
I do not insist on the use of these libraries, only as an example of ready-made code
Thanx!
Cool! I wonder if Caddy uses one of these libs for its own "self update" feature (so we could reuse the same).
It has an experimental upgrade command: https://github.com/caddyserver/caddy/blob/dc12bd974367b1c15e6b8f3c6b446a208ac3546f/cmd/packagesfuncs.go#L36
This looks like an ad-hoc solution using Caddy's API. I fear that we'll not be able to use it for our needs for now because we also need to embed PHP etc. (cc @mholt)
To not confuse users, maybe we could override this command in our builds?
In the future, the best option will be to allow downloading a version of Caddy embedding PHP using the official Caddy API.
LGTM
This looks like an ad-hoc solution using Caddy's API. I fear that we'll not be able to use it for our needs for now because we also need to embed PHP etc. (cc @mholt)
Hmm, yeah, it would work, except CGO_ENABLED=1... our build server does not support this, last time I checked, for a few reasons (compile time -- C is expensive to compile, and compatibility -- C doesn't cross-compile which is a very common use case of our build server).
So yeah, perhaps the best thing to do in the interim is to override the caddy upgrade command with your own. I think(?) that should be possible
What about creating a separate composer package for the built binary? It'd be easy to automate with a GitHub Action.
That way the server could be upgraded using composer update.