feat(snap): add snap install method to install.sh when available#2250
feat(snap): add snap install method to install.sh when available#2250olivercalder wants to merge 7 commits into
snap install method to install.sh when available#2250Conversation
|
All contributors have signed the DCO ✍️ ✅ |
|
I have read the DCO document and I hereby sign the DCO. |
|
recheck |
…ovisioning Add snap install path to install.sh so that on Linux systems with snapd available and no native Docker Engine installed, the installer chooses the snap path. Snap is preferred when 'snap' command exists and 'snapd.socket' is active. New functions: - has_snapd(): detects snapd availability via snap command + snapd.socket - has_native_docker(): pre-flight check for conflicting native Docker - install_linux_snap(): installs openshell snap, Docker snap if missing, connects interfaces (best-effort), registers gateway via HTTP, verifies status - register_local_gateway_snap(): gateway add with http:// URL (no mTLS) - wait_for_local_gateway_listener_snap(): waits for HTTP listener linux_package_method() returns 'snap' when snapd is available and no native docker, respecting OPENSHELL_INSTALL_METHOD=classic override. The installer handles the full flow: installing Docker snap if missing, connecting all required interfaces, and registering the gateway. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Fix the snap gateway protocol from https to http to match what the installer actually registers. Correct misleading claims that the installer "exits with an error" and "refuses" snap installs on hosts with native Docker — it silently falls back to classic. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Adjust the wording of the installation docs for the `openshell` snap. In particular, clarify when the snap will be installed, how it currently requires the docker snap, and how to override the installation method. Also, prune some of the manual interface connections, as these have since been granted autoconnection via snap store assertions. See: https://forum.snapcraft.io/t/please-update-snap-declaration-assertion-for-openshell/51762 Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
As @drew suggested, add `deb`, `rpm`, `snap`, and `homebrew` as installation methods which the user can specify via `OPENSHELL_INSTALL_METHOD` rather than falling back to detecting the package manager automatically. `homebrew` is not yet supported on Linux, and it is the only supported option on MacOS. Also adds a TODO to implement `install_linux_homebrew` in the future. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
70480f2 to
22525a2
Compare
|
Rebased to pull in the changes from #2280 which remove the |
|
We're shipping an improvement to the Once snapd 2.77 hits |
|
Would you mind updating the release-canary Github Action to use this? Presently it fetches the snap from the release artifacts and installs it manually, but the other installations (excepting Kubernetes) use install.sh to install the latest available version. In the near future this will all change when we revamp the build and release process, but for now consistency is probably better. I'm unsure about exposing an env var to force the installation mechanism. To me, the contract of |
Split the `ubuntu` release canary into three jobs: - `ubuntu-deb`: test that `install.sh` installs the OpenShell .deb package on Ubuntu when snapd is not present. - `ubuntu-deb-native-docker`: test that `install.sh` installs the OpenShell .deb package on Ubuntu when a native docker daemon is present -- this will change when snapd 2.77 is released to the `latest/stable` channel, which will allow the `openshell` snap to connect to non-snap Docker daemons; this job will then be renamed to `ubuntu-snap-native-docker`. - `ubuntu-snap-without-docker`: test that `install.sh` installs both the `openshell` and `docker` snaps if snapd is present and there is no Docker daemon installed. In all variants, the canary tests that `openshell status` succeeds after installation. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
The change in snapd to support the `openshell` snap connecting to a non-snap Docker daemon will ship in snapd 2.77, not 2.76. Also, all the `openshell` snap interfaces are now auto-connected, so there is no need for manual connection anymore. Remove these from the description. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
The contract of `install.sh` is to choose the best installation method for the host system. Adding the `OPENSHELL_INSTALL_METHOD` variable breaks that contract, so it is best to remove it. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
|
Done and done, thanks for the suggestions. I've split the
In all jobs, test that The .deb package and snap package both need to be tested, and the snap will need to be tested with both the |
|
Label |
| fi | ||
| sudo systemctl start docker || sudo service docker start | ||
| mkdir -p "${HOME}/.config/openshell" | ||
| printf 'OPENSHELL_DRIVERS=docker\n' > "${HOME}/.config/openshell/gateway.env" |
There was a problem hiding this comment.
Is this line required? I would have expected gateway auto-detection of Docker to work.
| When installing from the Snap Store, snapd automatically connects the `home`, | ||
| `network`, and `network-bind` plugs. The `docker` plug still | ||
| requires manual connection: | ||
| The OpenShell snap requires the Docker snap, which you can install with: |
There was a problem hiding this comment.
If the OpenShell snap requires the Docker snap, does that also mean it cannot be used with Podman? I'm wondering what this means for auto-detection, which prefers Podman over Docker. It seems like we need to document this limitation of the snap more clearly, if that's the case. I'd expect to see the docs say very clearly that the snap only works with Docker and you should configure Docker as the openshell driver explicitly to avoid issues if you also have Podman running.
|
/ok to test c91aea9 |
|
I ran this with e2e but what I actually meant to do was run the release-canary workflow for it, which I did here: https://github.com/NVIDIA/OpenShell/actions/runs/29593468971 The snap installation without Docker failed, which we expect until this is merged and a new snap is published. The others succeeded, though, which is good. |
Summary
Update
install.shto install the OpenShellsnappackage if snapd is available on the system and the required conditions are met. Also add theOPENSHELL_INSTALL_METHODenvironment variable to force a particular install method rather than fall back to automatic system detection.Related Issue
Based on: #1697 (picking up the work from @zyga)
Addresses: #1674
Changes
snapdand if compatible conditions (dockersnap) are met, installs the snap from the store.OPENSHELL_INSTALL_METHODto override automatic detectiondeb,rpm,snap, andhomebrewTesting
mise run pre-commitpassesChecklist