elementor / lokl-cli

Interactive script to launch and manage your Lokl sites
The Unlicense
66 stars 7 forks source link

Patch to include check if system supports architecture of lokl image #27

Open nevehallon opened 3 years ago

nevehallon commented 3 years ago

In relation to https://github.com/leonstafford/lokl/issues/34 Performing check in the case that there is a timeout.

leonstafford commented 3 years ago

Awesome, thanks for sending this @nevehallon. I'll check this and the reported issue out soon

leonstafford commented 3 years ago

@nevehallon - the check in /var/lib/dpkg/arch looks a bit too OS-specific.

Would a uname call give us enough info about the arch?

leonstafford commented 3 years ago

To elaborate, sorry. That path doesn't seem to exist outside of Debian-based distros or others which have specifically installed dpkg

leonstafford commented 3 years ago

@nevehallon what architecture was your Lubuntu running on? Arm64?

nevehallon commented 3 years ago

@nevehallon what architecture was your Lubuntu running on? Arm64?

It's running on amd64

nevehallon commented 3 years ago

@nevehallon - the check in /var/lib/dpkg/arch looks a bit too OS-specific.

Would a uname call give us enough info about the arch?

uname doesn't provide achitecture information. At least not on my OS...

leonstafford commented 3 years ago

Try 'uname -a', that usually ends with arch on *buntus

nevehallon commented 3 years ago

I see. I guess then it's best to sift through all the possible values for uname -m in order to determine if there is support for arm64.

nevehallon commented 3 years ago

Or, perhaps a more concise check would be running arch. I get x86_64 on my machine and arch64 in the container via SSH. @leonstafford Is that a better check? More OS-friendly?

leonstafford commented 3 years ago

That looks perfect!

Just tested on my M1 mac and a remote OpenBSD machine:

leon@Leons-MacBook-Pro ~ % docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS  PLATFORMS
default * docker                  
  default default         running linux/arm64, linux/amd64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
leon@Leons-MacBook-Pro ~ % arch
arm64
leon@Leons-MacBook-Pro ~ % ssh someopenbsd
someopenbsd$ arch
OpenBSD.amd64

That docker buildx ls command from https://docs.docker.com/desktop/multi-arch/#build-and-run-multi-architecture-images I first thought was stating run capabilities for the host, but looks more like something I should be making sure I'm building with for more compatible images...

Will need to finish my current task before can properly look into this, but if you want to adjust the PR, I can test the scripts against a variety of architecture VPS's later to try and reproduce the issue.

(There is an argument to just show the arch with OpenBSD's arch command, might be similar on other BSDs, too. Noting, that OpenBSD has no ability to run Docker/Lokl yet, but I believe it might work fine on FreeBSD).

nevehallon commented 3 years ago

Wasn't sure if I should include docker buildx ls as a check. (can remove if not needed) I went with the uname -m - apparently arch is not installed by default acording to this doc: https://www.gnu.org/software/coreutils/manual/html_node/arch-invocation.html#arch-invocation

-"arch is not installed by default, so portable scripts should not rely on its existence."

@leonstafford Let me know if this adjustment works.

leonstafford commented 3 years ago

Many thanks @nevehallon!

It will take me a bit of time to get to test this on a few systems, but looks great!