aantron/dream

Issues with Docker builds in examples

Closed this issue · 6 comments

From #233 (comment):

Testing with z-fly and z-docker-opam examples, and I'm encountering build issues within just the docker compose up process even before running a request with the empty key-value header.

(* app.ml *)
let () =
  Dream.run ~interface:"0.0.0.0"
  @@ Dream.logger
  @@ Dream.router [
    Dream.get "/" (fun _ -> Dream.html ~headers:[("", "")] "Dream deployed on Fly.io!");
  ]

Local tests first on an m1 mac:

z-docker-opam local error with docker compose up

z-docker-opam-web-1  | Error loading shared library libssl.so.3: No such file or directory (needed by /bin/app)
z-docker-opam-web-1  | Error loading shared library libcrypto.so.3: No such file or directory (needed by /bin/app)
z-docker-opam-web-1  | Error relocating /bin/app: SSL_CTX_get_cert_store: symbol not found
z-docker-opam-web-1  | Error relocating /bin/app: SSL_load_client_CA_file: symbol not found
...I truncated because we get the picture

z-fly local error with docker compose up

 > [build  5/12] RUN npm install esy:
#9 15.35 npm ERR! code 1
#9 15.35 npm ERR! path /build/node_modules/esy
#9 15.35 npm ERR! command failed
#9 15.35 npm ERR! command sh -c node -e "process.env['OCAML_VERSION'] = process.platform == 'linux' ? '4.12.0-musl.static.flambda': '4.12.0'; process.env['OCAML_PKG_NAME'] = 'ocaml'; require('./postinstall.js')"
#9 15.35 npm ERR! internal/fs/utils.js:269
#9 15.35 npm ERR!     throw err;
#9 15.35 npm ERR!     ^
#9 15.35 npm ERR! 
#9 15.35 npm ERR! Error: ENOENT: no such file or directory, scandir '/build/node_modules/esy/platform-linux-arm64/bin'

To test a remote build, I've deployed both examples to fly.io.

z-docker-opam fails with the same missing missing ssl files

z-fly deploys successfully because it uses debian, and we finally get a failure on a request due to the missing header. Since fly proxies requests, they're already interrupting the request before it makes it back to the client.

2023-04-20T14:03:56.181 proxy[2c233da5] ewr [error] could not make HTTP request to instance: invalid HTTP header parsed 

Unfortunate i'm unable to reproduce locally exactly what pckilgore found, but we should still filter empty header keys regardless of linux image or whether it works locally because certain hosting platforms will block such http responses.

cc @dangdennis

I can check this out if you want to keep using esy. The error occurs when you’re trying to install esy.

esy seeks to offer a better experience than “raw” opam and dune, but I personally don’t use it.

I'm not sure about esy -- not clear on its status. It's fine to leave this for later if there is too much uncertainty.

I ccd you mainly just so that you're subscribed to the continuation of this thread :)

I've encountered this same issue today running z-docker-opam on Mac M1.

Updating the Alpine version from 3.12 to 3.18 solved it here.
Maybe the example could be updated with this newest version?

Nice! Make that PR if you'll please.

I'm going to assume that this is solved by #300, which is now merged. Thanks @pedrofgd and @dangdennis!

If this comes up again still, we can reopen this issue or create a new one.