open-craft / tutor-contrib-arm64

An unofficial plugin and docker images to make it easier to run Tutor on ARM64 systems
3 stars 0 forks source link

tutor_local_mfe_1 exited with code 1 | exec /usr/bin/caddy: exec format error #4

Open med-zz-eis opened 1 year ago

med-zz-eis commented 1 year ago

Giving the guide from the plugin I installed the tutor on the Oracle Cloud VM.Standard.A1.Flex arm64 machine with Ubuntu 22.04 image (Canonical-Ubuntu-22.04-aarch64-2023.03.18-0).

Installation went smooth, without any specific error and the welcome screens of the tutor are running (both cms and lms)

Unfortunately I'm not able to login nor create new users via webinterface because of getting 502 errors:

caddy_1                      | {"level":"error","ts":1682429165.918607,"logger":"http.log.error.log2","msg":"dial tcp: lookup mfe on 127.0.0.11:53: server misbehaving","request":{"remote_ip":"37.248.253.37","remote_port":"9618","proto":"HTTP/2.0","method":"GET","host":"apps.abc.com","uri":"/authn/register?next=%2F","headers":{"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Referer":["https://trainings.abc.com/"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Dnt":["1"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"Accept-Encoding":["gzip, deflate, br"],"Cache-Control":["max-age=0"],"Accept-Language":["pl"],"Cookie":[],"Sec-Ch-Ua":["\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not:A-Brand\";v=\"99\""],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Site":["cross-site"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"apps.trainings.abc.vom"}},"duration":0.002691159,"status":502,"err_id":"fc2cp3xn2","err_trace":"reverseproxy.statusError (reverseproxy.go:1281)"}
caddy_1                      | {"level":"error","ts":1682429165.9186382,"logger":"http.log.access.log2","msg":"handled request","request":{"remote_ip":"37.248.253.37","remote_port":"9618","proto":"HTTP/2.0","method":"GET","host":"apps.trainings.abc.com","uri":"/authn/register?next=%2F","tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"apps.trainings.abc.com"}},"user_id":"","duration":0.002691159,"size":0,"status":502}

that further I manage to isolate to be incompatible caddy:

tutor_local_mfe_1 exited with code 1
mfe_1                        | exec /usr/bin/caddy: exec format error
mfe_1                        | exec /usr/bin/caddy: exec format error
mfe_1                        | exec /usr/bin/caddy: exec format error
[...]

Let me know in case of any specific logs that could help to analyse this further.

bradenmacdonald commented 1 year ago

Somehow your Tutor MFE image is amd64, not arm64, and since you are running on a cloud arm64 machine, it doesn't have the ability to run amd64 images under emulation out of the box like Docker for Mac does.

You'll need to rebuild the MFE images to be native images (should be just tutor images build mfe but I think there is some issue prevent arm builds of the MFE image, so this may need detailed investigation), or follow these instructions to setup binfmt and qemu so you can run amd64 images under emulation.

med-zz-eis commented 1 year ago

Building native mfe does not work indeed:

ERROR in ./src/id-verification/assets/example-card.png
Module build failed (from ./node_modules/image-webpack-loader/index.js):
Error: Cannot find module 'imagemin-pngquant'
Require stack:
- /openedx/app/node_modules/image-webpack-loader/index.js
- /openedx/app/node_modules/loader-runner/lib/loadLoader.js
- /openedx/app/node_modules/loader-runner/lib/LoaderRunner.js
- /openedx/app/node_modules/webpack/lib/NormalModuleFactory.js
- /openedx/app/node_modules/webpack/lib/Compiler.js
- /openedx/app/node_modules/webpack/lib/webpack.js
- /openedx/app/node_modules/webpack/lib/index.js
- /openedx/app/node_modules/webpack-cli/lib/webpack-cli.js
- /openedx/app/node_modules/webpack-cli/lib/bootstrap.js
- /openedx/app/node_modules/webpack-cli/bin/cli.js
- /openedx/app/node_modules/webpack/bin/webpack.js
- /openedx/app/node_modules/@edx/frontend-build/bin/fedx-scripts.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.module.exports (/openedx/app/node_modules/image-webpack-loader/index.js:78:20)
 @ ./src/id-verification/panels/ReviewRequirementsPanel.jsx 11:0-53 95:17-28
 @ ./src/id-verification/IdVerificationPage.jsx 13:0-71 63:29-52
 @ ./src/id-verification/index.js 2:0-47 2:0-47
 @ ./src/index.jsx 13:0-51 37:25-43

webpack 5.50.0 compiled with 1 error and 1 warning in 45250 ms
npm notice
npm notice New major version of npm available! 8.5.0 -> 9.6.5
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.6.5>
npm notice Run `npm install -g npm@9.6.5` to update!
npm notice
The command '/bin/sh -c npm run build' returned a non-zero code: 1
Error: Command failed with status 1: docker build -t docker.io/overhangio/openedx-mfe:15.0.5 /home/ubuntu/.local/share/tutor/env/plugins/mfe/build/mfe

while emulation after running binfmt docker works quite well indeed docker run --privileged --rm tonistiigi/binfmt --install amd64