Skip to content
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

Support switching to Mac M1 machine with ARM64 #1748

Open
loopy3025 opened this issue Dec 23, 2022 · 8 comments
Open

Support switching to Mac M1 machine with ARM64 #1748

loopy3025 opened this issue Dec 23, 2022 · 8 comments

Comments

@loopy3025
Copy link

Description

We have switched to macs with M1 chips. When setting up our environments, we ran fin update and tried starting new containers.

Steps to reproduce the issue:

  1. fin up
  2. Clone site on m1 mac
  3. fin remove just in case
  4. fin start

Describe the results you received:

Results of fin start:

Starting services...
[+] Running 12/17
 ⠿ Network oursite_default                                                                                                                            Created                                                    0.1s
 ⠿ Volume "oursite_cli_home"                                                                                                                          Created                                                    0.0s
 ⠿ Volume "oursite_project_root"                                                                                                                      Created                                                    0.0s
 ⠿ Volume "oursite_db_data"                                                                                                                           Created                                                    0.0s
 ⠿ Container oursite_mail_1                                                                                                                           Started                                                   23.1s
 ⠿ Container oursite_solr_1                                                                                                                           Started                                                   22.9s
 ⠿ Container oursite_browser_1                                                                                                                        Started                                                   22.9s
 ⠿ Container oursite_memcached_1                                                                                                                      Started                                                   22.6s
 ⠿ Container oursite_cli_1                                                                                                                            Started                                                   22.9s
 ⠿ Container oursite_db_1                                                                                                                             Started                                                   22.7s
 ⠇ mail The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested                                                                 0.0s
 ⠇ browser The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested                                                              0.0s
 ⠇ memcached The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested                                                            0.0s
 ⠧ db The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested                                                                   0.0s
 ⠧ solr The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested                                                                 0.0s
 ⠿ Container oursite_web_1                                                                                                                            Started                                                   21.0s
 ⠿ Container oursite_varnish_1                                                                                                                        Started                                                   21.3s

Results of drush staus:

Drupal version : 9.4.7                                 
Site URI       : http://oursite.docksal.site     
DB driver      : mysql                                 
DB hostname    : db                                    
DB port        : 3306                                  
DB username    : user                                  
DB name        : default                               
PHP binary     : /usr/local/bin/php                    
PHP config     : /usr/local/etc/php/php.ini            
PHP OS         : Linux                                 
PHP version    : 8.0.21                                
Drush script   : /usr/local/bin/drush                  
Drush version  : 11.3.2                                
Drush temp     : /tmp                                  
Drush configs  : /var/www/vendor/drush/drush/drush.yml 
                 /var/www/drush/drush.yml              
Drupal root    : /var/www/docroot                      
Site path      : sites/default                

Results of a fin db import:

Error: No such container: 
Truncating default database...
Error: No such container: db
There were errors during truncation. Continue anyways? [y/n]: n

When i look at the docker containers, I see this in the logs for db:

2022-12-23 13:10:08 Including custom configuration from /var/www/.docksal/etc/mysql/my.cnf
2022-12-23 13:10:09 runtime: failed to create new OS thread (have 2 already; errno=22)
2022-12-23 13:10:09 fatal error: newosproc

I also noticed that there is an orange icon in Docker Desktop for each container that says "AMD64" and when you hover over it, it says "Image may have poor performance, or fail, if run via emulation."

Describe the results you expected:

Site spins up as before on other machine and db import works.

Output of fin config:

fin config output
---------------------
COMPOSE_PROJECT_NAME_SAFE: oursite
COMPOSE_FILE:
/Users/adam/.docksal/stacks/volumes-bind.yml
/Users/adam/.docksal/stacks/stack-acquia.yml
/Users/adam/projects/oursite.com/.docksal/docksal.yml
/Users/adam/.docksal/stacks/overrides-dd-bind.yml
ENV_FILE:
/Users/adam/projects/oursite.com/.docksal/docksal.env

PROJECT_ROOT: /Users/adam/projects/oursite.com
DOCROOT: docroot
VIRTUAL_HOST: oursite.docksal.site
VIRTUAL_HOST_ALIASES: *.oursite.docksal.site
IP: 192.168.64.100

MySQL endpoint:
Public URL:

Docker Compose configuration
---------------------
name: oursite
services:
  browser:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    - 8.8.8.8
    - 9.9.9.9
    hostname: browser
    image: selenium/standalone-chrome
    networks:
      default: null
  cli:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      BLACKFIRE_CLIENT_ID: null
      BLACKFIRE_CLIENT_TOKEN: null
      COMPOSER_ALLOW_XDEBUG: "0"
      COMPOSER_DEFAULT_VERSION: "2"
      COMPOSER_DISABLE_XDEBUG_WARN: "0"
      DOCROOT: docroot
      DRUSH_ALLOW_XDEBUG: "0"
      DRUSH_OPTIONS_URI: oursite.docksal.site
      GIT_USER_EMAIL: adamvincent.fasoldt@its.com
      GIT_USER_NAME: Adam Fasoldt
      HOST_GID: "20"
      HOST_UID: "502"
      MYSQL_DATABASE: default
      MYSQL_HOST: db
      MYSQL_PASSWORD: user
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
      PHP_IDE_CONFIG: null
      SECRET_ACQUIA_CLI_KEY: null
      SECRET_ACQUIA_CLI_SECRET: null
      SECRET_PLATFORMSH_CLI_TOKEN: null
      SECRET_SSH_PRIVATE_KEY: null
      SECRET_TERMINUS_TOKEN: null
      SSH_AUTH_SOCK: /.ssh-agent/proxy-socket
      VIRTUAL_HOST: oursite.docksal.site
      XDEBUG_CONFIG: client_host=192.168.64.1 remote_host=192.168.64.1
      XDEBUG_ENABLED: "0"
    extends:
      file: /Users/adam/.docksal/stacks/services.yml
      service: cli
    hostname: cli
    healthcheck:
      interval: 10s
    image: docksal/cli:php8.0-3.2
    labels:
      io.docksal.shell: bash
      io.docksal.user: docker
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    volumes:
    - type: volume
      source: docksal_ssh_agent
      target: /.ssh-agent
      read_only: true
      volume: {}
    - type: volume
      source: cli_home
      target: /home/docker
      volume: {}
    - type: bind
      source: /tmp/.docksal/oursite
      target: /tmp/.docksal/oursite
      read_only: true
      bind:
        create_host_path: true
    - type: volume
      source: project_root
      target: /var/www
      volume:
        nocopy: true
  db:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: null
      MYSQL_DATABASE: default
      MYSQL_INITDB_SKIP_TZINFO: null
      MYSQL_ONETIME_PASSWORD: null
      MYSQL_PASSWORD: user
      MYSQL_RANDOM_ROOT_PASSWORD: null
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
    extends:
      file: /Users/adam/.docksal/stacks/services.yml
      service: mariadb
    hostname: db
    healthcheck:
      interval: 10s
    image: docksal/db:1.1-mysql-5.7
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    ports:
    - mode: ingress
      target: 3306
      protocol: tcp
    volumes:
    - type: bind
      source: /Users/adam/projects/oursite.com/db
      target: /docker-entrypoint-initdb.d
      read_only: true
      bind:
        create_host_path: true
    - type: volume
      source: db_data
      target: /var/lib/mysql
      volume: {}
    - type: volume
      source: project_root
      target: /var/www
      read_only: true
      volume:
        nocopy: true
  mail:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    - 8.8.8.8
    - 9.9.9.9
    extends:
      file: /Users/adam/.docksal/stacks/services.yml
      service: mail
    hostname: mail
    healthcheck:
      interval: 10s
    image: mailhog/mailhog:v1.0.1
    labels:
      io.docksal.cert-name: none
      io.docksal.virtual-host: mail.oursite.docksal.site,mail.oursite.docksal.site.*
      io.docksal.virtual-port: "8025"
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    volumes:
    - type: volume
      source: project_root
      target: /var/www
      read_only: true
      volume:
        nocopy: true
  memcached:
    command:
    - -m
    - "128"
    dns:
    - 8.8.8.8
    - 9.9.9.9
    - 8.8.8.8
    - 9.9.9.9
    - 8.8.8.8
    - 9.9.9.9
    extends:
      file: /Users/adam/.docksal/stacks/services.yml
      service: memcached
    hostname: memcached
    healthcheck:
      interval: 10s
    image: memcached:1.6-alpine
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
  solr:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    - 8.8.8.8
    - 9.9.9.9
    - 8.8.8.8
    - 9.9.9.9
    extends:
      file: /Users/adam/.docksal/stacks/services.yml
      service: solr
    hostname: solr
    healthcheck:
      interval: 10s
    image: docksal/solr:7.5
    labels:
      io.docksal.cert-name: none
      io.docksal.virtual-host: solr.oursite.docksal.site,solr.oursite.docksal.site.*
      io.docksal.virtual-port: "8983"
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    volumes:
    - type: bind
      source: /Users/adam/projects/oursite.com/.docksal/etc/solr/conf
      target: /var/lib/solr/conf
      read_only: true
      bind:
        create_host_path: true
    - type: volume
      source: project_root
      target: /var/www
      read_only: true
      volume:
        nocopy: true
  varnish:
    depends_on:
      web:
        condition: service_started
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      VARNISH_BACKEND_HOST: web
    extends:
      file: /Users/adam/.docksal/stacks/services.yml
      service: varnish
    hostname: varnish
    healthcheck:
      interval: 10s
    image: docksal/varnish:6.6-3.1
    labels:
      io.docksal.cert-name: none
      io.docksal.virtual-host: varnish.oursite.docksal.site,varnish.oursite.docksal.site.*
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    volumes:
    - type: volume
      source: project_root
      target: /var/www
      read_only: true
      volume:
        nocopy: true
  web:
    depends_on:
      cli:
        condition: service_started
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      APACHE_BASIC_AUTH_PASS: null
      APACHE_BASIC_AUTH_USER: null
      APACHE_DOCUMENTROOT: /var/www/docroot
      APACHE_FCGI_HOST_PORT: cli:9000
    extends:
      file: /Users/adam/.docksal/stacks/services.yml
      service: apache
    hostname: web
    healthcheck:
      interval: 10s
    image: docksal/apache:2.4-2.5
    labels:
      io.docksal.cert-name: none
      io.docksal.permanent: "false"
      io.docksal.project-root: /Users/adam/projects/oursite.com
      io.docksal.virtual-host: oursite.docksal.site,*.oursite.docksal.site,oursite.docksal.site.*
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    volumes:
    - type: volume
      source: project_root
      target: /var/www
      read_only: true
      volume:
        nocopy: true
networks:
  default:
    name: oursite_default
volumes:
  cli_home:
    name: oursite_cli_home
  db_data:
    name: oursite_db_data
  docksal_ssh_agent:
    name: docksal_ssh_agent
    external: true
  project_root:
    name: oursite_project_root
    driver: local
    driver_opts:
      device: /host_mnt/Users/adam/projects/oursite.com
      o: bind
      type: none
---------------------


Output of fin sysinfo:

fin sysinfo output
███  DOCKSAL
Docksal version: develop
fin version:     v1.111.0

███  OS
Darwin macOS 12.3
Darwin MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000 arm64

███  ENVIRONMENT
MODE : Docker Desktop
DOCKER_HOST : 

███  NFS
DOCKSAL_NFS_PATH : /Users

nfsd service is enabled
nfsd is running (pid 85025, 8 threads)

NFS EXPORTS
----------

# <ds-nfs docksal
/Users 127.0.0.1 192.168.64.1 -alldirs -maproot=0:0
# ds-nfs>
----------

Exports list on localhost:
/Users                              127.0.0.1 192.168.64.1

███  DOCKER
Expected client version: 20.10.21
Expected server version: 20.10.21

Installed versions:

Client:
Version:           20.10.21
API version:       1.41
Go version:        go1.18.7
Git commit:        baeda1f
Built:             Tue Oct 25 18:01:18 2022
OS/Arch:           darwin/amd64 (rosetta)
Context:           default
Experimental:      true

Server: Docker Desktop 4.15.0 (93002)
Engine:
Version:          20.10.21
API version:      1.41 (minimum version 1.12)
Go version:       go1.18.7
Git commit:       3056208
Built:            Tue Oct 25 17:59:41 2022
OS/Arch:          linux/arm64
Experimental:     false
containerd:
Version:          1.6.10
GitCommit:        770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc:
Version:          1.1.4
GitCommit:        v1.1.4-0-g5fd4c4d
docker-init:
Version:          0.19.0
GitCommit:        de40ad0

███  DOCKER COMPOSE
Expected version:  2.13.0
Installed version: 2.13.0

███  DOCKSAL: PROJECTS
project         STATUS                    virtual host                                                                           project root
oursite   Up 25 minutes (healthy)   oursite.docksal.site,*.oursite.docksal.site,oursite.docksal.site.*   /Users/adam/projects/oursite.com

███  DOCKSAL: VIRTUAL HOSTS
*.oursite.docksal.site
oursite.docksal.site.*
oursite.docksal.site
mail.oursite.docksal.site.*
mail.oursite.docksal.site
solr.oursite.docksal.site.*
solr.oursite.docksal.site
varnish.oursite.docksal.site.*
varnish.oursite.docksal.site

███  DOCKSAL: NETWORKING

DOCKSAL_IP: 192.168.64.100
DOCKSAL_HOST_IP: 192.168.64.1
DOCKSAL_VHOST_PROXY_IP: 0.0.0.0
DOCKSAL_DNS_IP: 0.0.0.0
DOCKSAL_DNS_DISABLED: 1
DOCKSAL_NO_DNS_RESOLVER: 1
DOCKSAL_DNS_UPSTREAM: 
DOCKSAL_DNS_DOMAIN: docksal.site

███  DOCKSAL: CONNECTIVITY

Host to 192.168.64.100: 	PASS
Container to 192.168.64.100: 	PASS
Container to 192.168.64.1: 	PASS

Checking connectivity to http://dns-test.docksal.site...
Host: PASS
Containers: PASS

███  DOCKER: RUNNING CONTAINERS
CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS                    PORTS                                      NAMES
1cbb2cb9be78   docksal/varnish:6.6-3.1      "docker-entrypoint.s…"   25 minutes ago   Up 25 minutes (healthy)   80/tcp, 6082/tcp, 8443/tcp                 oursite_varnish_1
3b2cc8b5b834   docksal/apache:2.4-2.5       "httpd-foreground"       25 minutes ago   Up 25 minutes (healthy)   80/tcp, 443/tcp                            oursite_web_1
dd31e0f53bfd   docksal/cli:php8.0-3.2       "/opt/startup.sh sup…"   25 minutes ago   Up 25 minutes (healthy)   22/tcp, 3000/tcp, 9000/tcp                 oursite_cli_1
02b3ff3462d0   docksal/solr:7.5             "docker-entrypoint.s…"   25 minutes ago   Up 25 minutes (healthy)   8983/tcp                                   oursite_solr_1
051748643c93   selenium/standalone-chrome   "/opt/bin/entry_poin…"   25 minutes ago   Up 25 minutes             4444/tcp                                   oursite_browser_1
a5b419ea7ab9   mailhog/mailhog:v1.0.1       "MailHog"                25 minutes ago   Up 25 minutes             1025/tcp, 8025/tcp                         oursite_mail_1
b9ee1b765a85   memcached:1.6-alpine         "docker-entrypoint.s…"   25 minutes ago   Up 25 minutes             11211/tcp                                  oursite_memcached_1
52a9e466d2aa   docksal/ssh-agent:1.4        "docker-entrypoint.s…"   30 minutes ago   Up 30 minutes (healthy)                                              docksal-ssh-agent
2cdd65a843f6   docksal/vhost-proxy:1.8      "docker-entrypoint.s…"   40 minutes ago   Up 40 minutes (healthy)   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   docksal-vhost-proxy

███  DOCKER: NETWORKS
NETWORK ID     NAME                    DRIVER    SCOPE
f56f6ae66c34   _default                bridge    local
8a4d856d1af6   bridge                  bridge    local
fb593671b1ba   oursite_default   bridge    local
3dda187dc58a   host                    host      local
d5d66d00ff40   none                    null      local

███  DOCKER DESKTOP
EXPECTED VERSION: 4.15.0
DETECTED VERSION: 4.15.0

███  HDD Usage
Filesystem       Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk3s1s1  926Gi   14Gi  747Gi     2%  500632 4293967565    0%   /
devfs           204Ki  204Ki    0Bi   100%     704          0  100%   /dev
/dev/disk3s6    926Gi  3.0Gi  747Gi     1%       3 7831861320    0%   /System/Volumes/VM
/dev/disk3s2    926Gi  180Mi  747Gi     1%     681 7831861320    0%   /System/Volumes/Preboot
/dev/disk3s4    926Gi  880Ki  747Gi     1%      77 7831861320    0%   /System/Volumes/Update
/dev/disk1s2    500Mi  6.0Mi  480Mi     2%       1    4910640    0%   /System/Volumes/xarts
/dev/disk1s1    500Mi  7.3Mi  480Mi     2%      21    4910640    0%   /System/Volumes/iSCPreboot
/dev/disk1s3    500Mi  2.3Mi  480Mi     1%      49    4910640    0%   /System/Volumes/Hardware
/dev/disk3s5    926Gi  161Gi  747Gi    18% 2079443 7831861320    0%   /System/Volumes/Data
map auto_home     0Bi    0Bi    0Bi   100%       0          0  100%   /System/Volumes/Data/home
/dev/disk2s1    5.0Gi  775Mi  4.2Gi    16%      31   44302280    0%   /System/Volumes/Update/SFR/mnt1
/dev/disk3s1    926Gi   14Gi  747Gi     2%  500634 4293967558    0%   /System/Volumes/Update/mnt1
/dev/disk4s2    1.9Gi  1.8Gi  162Mi    92%    4530 4294962749    0%   /Volumes/Docker
@loopy3025
Copy link
Author

Looks like this person got something similar. #1421 (comment)

@loopy3025
Copy link
Author

So I'm wondering if there's anything we need to change on our machine's docksal.env and/or our sites' docksal.env file in order to get the containers to work?

@loopy3025
Copy link
Author

loopy3025 commented Dec 23, 2022

Looks like this is my issue, but I do have the most recent installed:
#1421

I've set the following in my computer's ~/.docksal/docksal.env to no avail:
DOCKER_DEFAULT_PLATFORM=linux/arm64

No matter what I do, docker keeps showing "AMD64" next to each container instead of ARM.

Is there anything else I should be doing?

@loopy3025 loopy3025 changed the title Support switching to Mac M1 machine Support switching to Mac M1 machine with ARM64 Dec 23, 2022
@loopy3025
Copy link
Author

loopy3025 commented Dec 27, 2022

Switched everything over and still getting this whether I use AMD or ARM in the settings files. Not sure what is wrong here.

Screen Shot 2022-12-27 at 8 16 20 AM

Screen Shot 2022-12-27 at 8 16 59 AM

Where do I need to tell Docksal to use ARM instead of AMD?

@loopy3025
Copy link
Author

Screen Shot 2022-12-27 at 8 28 02 AM

@loopy3025
Copy link
Author

loopy3025 commented Dec 27, 2022

Switching to the newest DB_IMAGE seems to have at least created a stable environment:
From: DB_IMAGE="docksal/db:1.1-mysql-5.7"
To: DB_IMAGE="docksal/mysql:8.0-2.0"
I am not sure how this image will take database dumps from Acquia Cloud. I'll have a go.

Note from the release:

Screen Shot 2022-12-27 at 11 08 34 AM

@jajajaime
Copy link

It's a pretty big jump from MySQL 5.7 to 8.0. I would recommend that you switch to something more compatible like docksal/mariadb:10.3-1.3

@cassiohalmeida
Copy link

I'm using MariaDB without any issues. Also, the performance is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants