jefflester/minitrino

ARM64 support

Closed this issue · 4 comments

Apple's latest machines ship with M1 CPUs, built with an ARM64 architecture. Certain images (i.e. MySQL) are incompatible with these CPUs and require adjustments to the deployment in order to get it to work on the user's M1-based machine.

A one-off fix for the MySQL module involved changing the Docker Compose YAML to the following:

mysql:
  platform: "linux/amd64"
  image: "mysql:5.7"
  container_name: "mysql"

The following MySQL tags paired with platform: "linux/amd64" seem to work:

mysql:8.0.31
mysql:8
mysql:5.7

This issue can serve as a channel for planning/discovery as we figure out how to best tackle this issue.

Images detected to really cause problems on M1:

  • SQL Server mcr.microsoft.com/mssql/server:${SQLSERVER_VER}
  • Db2 ibmcom/db2:${DB2_VER}
  • Our own HMS image needs to run under emulation on M1 starburstdata/hive-metastore-unsecured:0cc95b

Below images have been tested to work without having to specify platform configuration:

  • arm64v8/mysql
  • mysql/mysql-server (maintained by the Oracle team)

The following is an example of the configuration needed in the Docker Compose YAML using one of the above images:

mysql:
  image: "arm64v8/mysql"
  container_name: "mysql"

I wonder if we can add a bash check/script to detect if host machine is running on M1 Apple hardware, i.e.

if [[ $(sysctl -n machdep.cpu.brand_string) =~ "M1" ]]; then

Above seems to be the best approach (sysctl -n machdep.cpu.brand_string returns Apple M1 Pro, Apple M2, etc.)

Note: uname -m should hypothetically return arm for M1 chips, however, if terminal or process running the script is deployed by an RMM that is running via Rosetta, may return x86_64 which can be problematic.

The latest release added this function to the provisioning logic. In the event that the user is running on an M1 platform, an enviroment variable MODULE_PLATFORM is set to linux/amd64, which is then passed to the module's underlying docker-compose.yml file:

services:
  example:
    image: "foo/bar:latest"
    container_name: "example"
    platform: "${MODULE_PLATFORM}"

This can at least get an emulated image pulled to your machine, but is not guaranteed to work.

Closing this issue – the latest MacOS releases work with Docker virtualization frameworks that ship with Docker Desktop.