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

Entwicklungsumgebung (Docker) startet für Mac M1 Geräte nicht #48

Open
ninijay opened this issue Aug 8, 2023 · 1 comment
Open

Entwicklungsumgebung (Docker) startet für Mac M1 Geräte nicht #48

ninijay opened this issue Aug 8, 2023 · 1 comment

Comments

@ninijay
Copy link

ninijay commented Aug 8, 2023

Hoi zäme

Evtl. stehe ich etwas auf dem Schlauch, aber gibt es eine Möglichkeit HitoBito auf Macbooks mit einem M1 Prozessor zu entwickeln? Ich habe als einzige Änderung bei den container/services die Platform auf linux/x86_64 gesetzt, damit das System überhaupt startet.

Lokales Docker-Compose:

version: '3.4'
services:
  rails: &rails
    platform: linux/x86_64
    build:
      context: ./docker
      dockerfile: rails.dockerfile
    image: ghcr.io/hitobito/development/rails
    user: "${RAILS_UID:-1000}"
    tty: true
    stdin_open: true
    depends_on:
    - db
    - mailcatcher
    - cache
    - webpack
    env_file: docker/rails.env
    environment:
      WEBPACKER_DEV_SERVER_HOST: webpack
    ports:
    - "3000:3000"
    volumes:
    - ./app/:/usr/src/app
    - hitobito_bundle:/opt/bundle
    - seed:/seed
    - ./docker/home/rails:/home/developer
    - /tmp/.X11-unix:/tmp/.X11-unix
    - ./docker/rails/work_around_docker_fs_bug.rb:/usr/src/app/hitobito/config/initializers/work_around_docker_fs_bug.rb:ro

  # `exec` into this to execute the tests of the core
  rails_test_core:
    <<: *rails
    command: [ 'sleep', 'infinity' ]
    ports: []
    platform: linux/x86_64
    environment:
      WAGONS: ''
      RAILS_ENV: test
      RAILS_TEST_DB_NAME: "hitobito_test_core"
      WEBPACKER_DEV_SERVER_HOST: null
      RAILS_SPHINX_HOST: null
      SKIP_SEEDS: 1
      SKIP_BUNDLE_INSTALL: 1
    depends_on:
    - db

  worker:
    <<: *rails
    command: [ 'rails', 'jobs:work' ]
    ports: []
    platform: linux/x86_64
    environment:
      SKIP_RAILS_MIGRATIONS: 1
      SKIP_SEEDS: 1
      SKIP_BUNDLE_INSTALL: 1
    depends_on:
    - rails
    - db
    - mailcatcher
    - cache

  # Dependencies
  mailcatcher:
    platform: linux/x86_64
    image: ghcr.io/hitobito/development/mailcatcher
    build:
      context: ./docker
      dockerfile: mailcatcher.dockerfile
    ports:
    - "1080:1080"

  cache:
    image: memcached:1.6-alpine
    command: [ memcached, -l, '0.0.0.0', -p, '11211' ]

  sphinx:
    image: macbre/sphinxsearch:3.1.1
    platform: linux/x86_64
    command: sphinx-start
    depends_on:
    - db
    volumes:
    - ./docker/sphinx.conf:/opt/sphinx/conf/sphinx.conf:ro
    - ./docker/sphinx-start:/usr/local/bin/sphinx-start:ro
    - ./docker/sphinx-indexer:/usr/local/bin/sphinx-indexer:ro
    - sphinx_indexes:/opt/sphinx/indexes

  db:
    image: mysql:5.7
    platform: linux/x86_64
    command:
    - --sort_buffer_size=2M
    - --character-set-server=utf8mb4
    - --collation-server=utf8mb4_unicode_ci
    env_file: ./docker/mysql.env
    ports:
    - "33066:3306"
    volumes:
    - ./docker/mysql-setup.sql:/docker-entrypoint-initdb.d/mysql-setup.sql:ro
    - ./docker/test-setup.sql:/docker-entrypoint-initdb.d/test-setup.sql:ro
    - db:/var/lib/mysql

  webpack:
    build:
      context: ./docker
      dockerfile: rails.dockerfile
    image: ghcr.io/hitobito/development/rails
    platform: linux/x86_64
    entrypoint: [ "webpack-entrypoint" ]
    env_file: docker/rails.env
    environment:
      WEBPACKER_DEV_SERVER_HOST: webpack
      SKIP_BUNDLE_INSTALL: 1
    user: "${RAILS_UID:-1000}"
    command: /usr/src/app/hitobito/bin/webpack-dev-server
    ports:
    - "3035:3035"
    volumes:
    - ./app/:/usr/src/app
    - hitobito_bundle:/opt/bundle
    - hitobito_yarn_cache:/home/developer/.cache/yarn

volumes:
  db:
  seed:
  hitobito_bundle:
    external: true
  hitobito_yarn_cache:
    external: true
  sphinx_indexes:

Ich kriege das Docker-Compose nicht zum laufen.
Beim Sphinx Container kriege ich folgende Error-Meldung:

cevi-sphinx-1           | Host OS is Linux alpine38 4.14.69-0-vanilla #1-Alpine SMP Mon Sep 10 19:33:23 UTC 2018 x86_64 Linux
cevi-sphinx-1           | Stack bottom = 0x4001ffacd7, thread stack size = 0x20000
cevi-sphinx-1           | Trying manual backtrace:
cevi-sphinx-1           | Something wrong with thread stack, manual backtrace may be incorrect (fp=0x5)
cevi-sphinx-1           | Wrong stack limit or frame pointer, manual backtrace failed (fp=0x5, stack=0x4002000000, stacksize=0x20000)
cevi-sphinx-1           | -------------- backtrace ends here ---------------
cevi-sphinx-1           | Please, create a bug report in our bug tracker (http://sphinxsearch.com/bugs) and attach there:
cevi-sphinx-1           | a) searchd log, b) searchd binary, c) searchd symbols.
cevi-sphinx-1           | Look into the chapter 'Reporting bugs' in the documentation
cevi-sphinx-1           | (/usr/share/doc/sphinx/sphinx.txt or http://sphinxsearch.com/docs/current.html#reporting-bugs)
cevi-sphinx-1           | --- BT to source lines (depth 0): ---
cevi-sphinx-1           | conversion failed (error 'No such file or directory'):
cevi-sphinx-1           |   1. Run the command provided below over the crashed binary (for example, 'searchd'):
cevi-sphinx-1           |   2. Attach the source.txt to the bug report.
cevi-sphinx-1           | addr2line -e searchd > source.txt
cevi-sphinx-1           | --- BT to source lines finished ---
cevi-sphinx-1           | --- 0 active threads ---
cevi-sphinx-1           | ------- CRASH DUMP END -------
cevi-worker-1           | ⚙ Activating Wagonfile.development

Beim Rails Container kriege ich diese Meldung:

cevi-rails-1  | Creating scope :without_deleted. Overwriting existing method Role.without_deleted.
cevi-rails-1  | Creating scope :with_deleted. Overwriting existing method Role.with_deleted.
cevi-rails-1  | Creating scope :only_deleted. Overwriting existing method Role.only_deleted.
cevi-rails-1  | /usr/src/app/hitobito_cevi/lib/hitobito_cevi/wagon.rb:49: warning: already initialized constant AbilityDsl::UserContext::LAYER_PERMISSIONS
cevi-rails-1  | /usr/src/app/hitobito/app/abilities/ability_dsl/user_context.rb:16: warning: previous definition of LAYER_PERMISSIONS was here
cevi-rails-1  | /usr/src/app/hitobito_cevi/lib/hitobito_cevi/wagon.rb:50: warning: already initialized constant AbilityDsl::UserContext::GROUP_PERMISSIONS
cevi-rails-1  | /usr/src/app/hitobito/app/abilities/ability_dsl/user_context.rb:12: warning: previous definition of GROUP_PERMISSIONS was here
cevi-rails-1  | /usr/src/app/hitobito_cevi/lib/hitobito_cevi/wagon.rb:58: warning: already initialized constant Export::Tabular::Groups::List::EXCLUDED_ATTRS
cevi-rails-1  | /usr/src/app/hitobito/app/domain/export/tabular/groups/list.rb:11: warning: previous definition of EXCLUDED_ATTRS was here
cevi-rails-1  | Function not implemented - Failed to initialize inotify excluded from capture: DSN not set
cevi-rails-1  | rails aborted!
cevi-rails-1  | Errno::ENOSYS: Function not implemented - Failed to initialize inotify
cevi-rails-1  | /usr/src/app/hitobito/config/environment.rb:5:in `<main>'
cevi-rails-1  | Tasks: TOP => db:migrate => db:load_config => environment
cevi-rails-1  | (See full trace by running task with --trace)
cevi-rails-1 exited with code 1

Hat das überhaupt was mit m1 oder mac zu tun, oder eher nicht?

@ninijay ninijay changed the title Anleitung für Mac M1 Devices Entwicklungsumgebung (Docker) startet für Mac M1 Geräte nicht Aug 8, 2023
@philobr
Copy link

philobr commented Sep 29, 2023

Sali
Ich hatte das gleiche Problem mit meinem M2. Eine definitive Lösung müsste im docker-image gemacht werden, weil dieses standardmässig von GitHub runtergezogen wird und nicht für eine arm-Architektur gebildet wurde.

Es gibt einen kleinen Workaround. Im docker-compose.yml musst du 3x die Zeile "image: ghcr.io/hitobito/development/r..." (Zeile 7, Zeile 61, Zeile 106) entfernen. Die Plattform musst du nicht manuell reinschreiben.

Anschliessend:

  • docker-compose build
  • docker-compose down
  • docker-compose up -d

Bei mir klappts so.

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

2 participants