dory icon indicating copy to clipboard operation
dory copied to clipboard

Apple M1 / Big Sur

Open lmorroni opened this issue 4 years ago • 19 comments

Hello, Been using dory for a number of years on OSX. Just upgraded to the M1 chip and Big Sur. When I install dory using gem install dory and then I run dory. I get the following error:

╰─➤  ./dory
Traceback (most recent call last):
	2: from ./dory:7:in `<main>'
	1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- dory (LoadError)
	8: from ./dory:7:in `<main>'
	7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
	6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
	5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
	4: from /Library/Ruby/Gems/2.6.0/gems/dory-1.1.1/lib/dory.rb:1:in `<top (required)>'
	3: from /Library/Ruby/Gems/2.6.0/gems/dory-1.1.1/lib/dory.rb:1:in `each'
	2: from /Library/Ruby/Gems/2.6.0/gems/dory-1.1.1/lib/dory.rb:2:in `block in <top (required)>'
	1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- /Library/Ruby/Gems/2.6.0/gems/dory-1.1.1/lib/dory/config (LoadError)

Any ideas? Thank You, Larry

lmorroni avatar Apr 19 '21 22:04 lmorroni

Hi @lmorroni

Can you try installing it with Homebrew after uninstalling the gem?

https://brew.sh https://formulae.brew.sh/formula/dory#default

tripox avatar Apr 20 '21 16:04 tripox

Thank you, sir. That worked!

lmorroni avatar Apr 20 '21 16:04 lmorroni

Nice! You're welcome! :)

tripox avatar Apr 20 '21 16:04 tripox

Sorry, spoke too soon. Looks like dory up is looking for an AMD image but needs the ARM image.

╰─➤  dory up
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Here's the docker ps -a output

38fdcc450d2b   freedomben/dory-http-proxy:2.5.9.1   "/app/docker-entrypo…"   9 seconds ago        Exited (2) 6 seconds ago                                                    dory_dinghy_http_proxy

I have a generic ~/.dory.yml file freshly generated. Larry

lmorroni avatar Apr 20 '21 16:04 lmorroni

Ah, yeah, that's because the docker images aren't build for the ARM architecture. :( I will try to see if I can make builds for arm and test them on my Raspberry pi, @lmorroni.

tripox avatar Apr 20 '21 17:04 tripox

I do not mind helping here. Can you point me towards the Dockerfile?

lmorroni avatar Apr 20 '21 17:04 lmorroni

@lmorroni https://github.com/FreedomBen/dory-http-proxy https://docs.docker.com/engine/reference/commandline/buildx

You might actually be able to run the image with --platform linux/amd64; not sure if it will be too slow.

tripox avatar Apr 20 '21 17:04 tripox

I got this working but I had to rebuild the dinghy-http-proxy docker container first. I'm not sure how I can contribute this but I am providing my shell commands below. Hope this helps.

git clone https://github.com/codekitchen/dinghy-http-proxy.git
cd dinghy-http-proxy
docker build -t codekitchen/dinghy-http-proxy:2.5 -t codekitchen/dinghy-http-proxy:latest .
cd ..
git clone https://github.com/FreedomBen/dory-http-proxy.git
cd dory-http-proxy
docker build -t freedomben/dory-http-proxy:2.5.9.1 -t freedomben/dory-http-proxy:latest .
dory up

lmorroni avatar Apr 20 '21 20:04 lmorroni

@lmorroni

I tried to build the docker images for ARM but I have only tested on x86_64. Can you test this?

  • Run dory down
  • Update ~/.dory.yml with the config below (with specified images build with support for ARM)
  • Run dory up
---
dory:
  # Be careful if you change the settings of some of
  # these services.  They may not talk to each other
  # if you change IP Addresses.
  # For example, resolv expects a nameserver listening at
  # the specified address.  dnsmasq normally does this,
  # but if you disable dnsmasq, it
  # will make your system look for a name server that
  # doesn't exist.
  dnsmasq:
    enabled: true
    domains:               # array of domains that will be resolved to the specified address
      - domain: docker     # you can set '#' for a wilcard
        address: 127.0.0.1 # return for queries against the domain
    container_name: dory_dnsmasq
    port: 53  # port to listen for dns requests on.  must be 53 on linux. can be anything that's open on macos
    # kill_others: kill processes bound to the port we need (see previous setting 'port')
    #   Possible values:
    #     ask (prompt about killing each time. User can accept/reject)
    #     yes|true (go aheand and kill without asking)
    #     no|false (don't kill, and don't even ask)
    kill_others: ask
    service_start_delay: 5  # seconds to wait after restarting systemd services
    image: tripox/dory-dnsmasq:latest
  nginx_proxy:
    enabled: true
    container_name: dory_dinghy_http_proxy
    https_enabled: true
    ssl_certs_dir: ''  # leave as empty string to use default certs
    port: 80           # port 80 is default for http
    tls_port: 443      # port 443 is default for https
    image: tripox/dory-http-proxy:latest
  resolv:
    enabled: true
    nameserver: 127.0.0.1
    port: 53  # port where the nameserver listens. On linux it must be 53

tripox avatar Apr 21 '21 02:04 tripox

My test on this one failed. I'm glad you showed me the image config option though. I can use that with the images that I built and it works. Here is the docker output from the failed container dory_dinghy_http_proxy

WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one
is being generated in the background.  Once the new dhparam.pem is in place, nginx will be reloaded.
Generating DH parameters, 2048 bit long safe prime, generator 2
runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc

runtime stack:
runtime.throw(0x884500, 0x9)
	/usr/local/go1.6/src/runtime/panic.go:530 +0x90
runtime.newosproc(0xc820026000, 0xc820035fc0)
	/usr/local/go1.6/src/runtime/os1_linux.go:149 +0x18c
runtime.newm(0x932358, 0x0)
	/usr/local/go1.6/src/runtime/proc.go:1513 +0x135
runtime.main.func1()
	/usr/local/go1.6/src/runtime/proc.go:125 +0x2c
runtime.systemstack(0xa8e800)
	/usr/local/go1.6/src/runtime/asm_amd64.s:291 +0x79
runtime.mstart()
	/usr/local/go1.6/src/runtime/proc.go:1048

goroutine 1 [running]:
runtime.systemstack_switch()
	/usr/local/go1.6/src/runtime/asm_amd64.s:245 fp=0xc820020770 sp=0xc820020768
runtime.main()
	/usr/local/go1.6/src/runtime/proc.go:126 +0x62 fp=0xc8200207c0 sp=0xc820020770
runtime.goexit()
	/usr/local/go1.6/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8200207c8 sp=0xc8200207c0

lmorroni avatar Apr 21 '21 11:04 lmorroni

That's certainly an interesting error and not one I had expected.

Need to get one of those Raspberry Pi running. 😄

Thank you for your time and input. I appreciate it.

tripox avatar Apr 21 '21 14:04 tripox

Oh, dinghy-http-proxy uses Go to compile for x86. Now it makes sense.

tripox avatar Apr 21 '21 15:04 tripox

Hey @FreedomBen Is there any active development on this issue? 😁

blyme avatar Jul 03 '21 20:07 blyme

I've got Dory working on my M1 by switching the nginx_proxy image in config to taybenlor/dinghy-http-proxy:latest (see: https://github.com/codekitchen/dinghy-http-proxy/pull/59). Internally it seems like Dory switches between dory-http-proxy and dinghy-http-proxy depending on whether you are configuring certs or not. So I think this image will only work if you have a ssl_certs_dir configured.

Edit: I've just built taybenlor/dory-http-proxy:latest based off my taybenlor/dinghy-http-proxy:latest you could try using this if you are not configuring ssl_certs_dir. I can't confirm if it works or not, sorry!

taybenlor avatar Sep 06 '21 05:09 taybenlor

Hi @taybenlor Thanks. I got the taybenlor/dory-http-proxy:latest image to work! Also without specifying the ssl_certs_dir. If anyone is interested, here is my ~/.dory.yml

---
dory:
  # Be careful if you change the settings of some of
  # these services.  They may not talk to each other
  # if you change IP Addresses.
  # For example, resolv expects a nameserver listening at
  # the specified address.  dnsmasq normally does this,
  # but if you disable dnsmasq, it
  # will make your system look for a name server that
  # doesn't exist.
  dnsmasq:
    enabled: true
    domains:               # array of domains that will be resolved to the specified address
      - domain: docker     # you can set '#' for a wilcard
        address: 127.0.0.1 # return for queries against the domain
    container_name: dory_dnsmasq
    port: 53  # port to listen for dns requests on.  must be 53 on linux. can be anything that's open on macos
    # kill_others: kill processes bound to the port we need (see previous setting 'port')
    #   Possible values:
    #     ask (prompt about killing each time. User can accept/reject)
    #     yes|true (go aheand and kill without asking)
    #     no|false (don't kill, and don't even ask)
    kill_others: ask
    service_start_delay: 5  # seconds to wait after restarting systemd services
  nginx_proxy:
    enabled: true
    container_name: dory_dinghy_http_proxy
    https_enabled: true
    ssl_certs_dir: ''  # leave as empty string to use default certs
    port: 80           # port 80 is default for http
    tls_port: 443      # port 443 is default for https
    image: taybenlor/dory-http-proxy:latest
  resolv:
    enabled: true
    nameserver: 127.0.0.1
    port: 53  # port where the nameserver listens. On linux it must be 53

The only thing different from this and the default config is the change in nginx_proxy image as described above. 🎉

blyme avatar Sep 21 '21 12:09 blyme

I can confirm this works on M1. I'll take a look at this. Thanks @mikkelblyme, @taybenlor and @taybenlor for your contributions.

tripox avatar Oct 12 '21 14:10 tripox

It works for me on an M1 too! Thanks @mikkelblyme

I don't know if this is the right place, or should I create another issue, but for me when if I'm trying to access my site on https the cert is invalid

Screenshot 2022-04-05 at 17 19 27

Can someone point me in the right direction about how to create/make a cert that is accepted by the browser?

kristof-kasa avatar Apr 05 '22 15:04 kristof-kasa

@kristof-kasa No problem, but you should thank https://github.com/taybenlor :slightly_smiling_face:

You should be able to use a project like https://github.com/FiloSottile/mkcert to create certificates.

blyme avatar Apr 05 '22 15:04 blyme

@kristof-kasa No problem, but you should thank https://github.com/taybenlor 🙂

You should be able to use a project like https://github.com/FiloSottile/mkcert to create certificates.

@mikkelblyme Yes, thank you! With mkcert I managed to create everything correctly.

If anyone interested in the setup:

$ brew install mkcert
$ mkcert -install
$ mkdir certs
$ cd certs
$ mkcert custom-local-domain.com "*.custom-local-domain.com" localhost 127.0.0.1 ::1
$ cp custom-local-domain.com+4-key.pem default.key
$ cp custom-local-domain.com+4.pem default.crt

In .dory.yml set your ssl_certs_dir and custom domain

  dnsmasq:
    ...
    domains:               
      - domain: custom-local-domain.com
        address: 127.0.0.1
    ...
  nginx_proxy:
    ...
    image: taybenlor/dory-http-proxy:latest
    ssl_certs_dir: '/Users/<username>/code/local-dev-https-setup/certs'
    ...

kristof-kasa avatar Apr 05 '22 20:04 kristof-kasa