Battery-Intelligence-Lab / galv

An open-source platform for automated storage of battery data with advanced metadata support
https://battery-intelligence-lab.github.io/galv/
Other
33 stars 8 forks source link

Compose fail on frontend - yarn install NODE_OPTIONS #65

Closed BradyPlanden closed 1 year ago

BradyPlanden commented 1 year ago

Describe the bug I'm getting an exit code 9 on the RUN yarn install in the docker-compose. Here is the trace:

Building frontend
[+] Building 4.7s (11/15)                                                                            
 => [internal] load build definition from Dockerfile                                            0.7s
 => => transferring dockerfile: 411B                                                            0.0s
 => [internal] load .dockerignore                                                               0.5s
 => => transferring context: 53B                                                                0.0s
 => [internal] load metadata for docker.io/library/nginx:alpine                                 0.0s
 => [internal] load metadata for docker.io/library/node:lts                                     0.0s
 => [build 1/7] FROM docker.io/library/node:lts                                                 0.0s
 => [internal] load build context                                                               0.2s
 => => transferring context: 2.11kB                                                             0.0s
 => CACHED [stage-1 1/3] FROM docker.io/library/nginx:alpine                                    0.0s
 => CACHED [build 2/7] RUN mkdir -p /app                                                        0.0s
 => CACHED [build 3/7] WORKDIR /app                                                             0.0s
 => CACHED [build 4/7] COPY package.json yarn.lock /app/                                        0.0s
 => ERROR [build 5/7] RUN yarn install                                                          3.7s
------                                                                                               
 > [build 5/7] RUN yarn install:
#11 1.439 node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
------
process "/bin/sh -c yarn install" did not complete successfully: exit code: 9
ERROR: Service 'frontend' failed to build : Build failed

Removing ENV NODE_OPTIONS=--openssl-legacy-provider from the /frontend/.env file fixes the exit code; however, I've not confirmed if this affects functionality.

To Reproduce Steps to reproduce the behavior:

  1. Clone current repo
  2. sudo docker-compose up
BradyPlanden commented 1 year ago

After proceeding with ENV NODE_OPTIONS=--openssl-legacy-provider removed, I'm unfortunately unable to login to the frontend via the superuser account. Does it make sense that the login functionality would break with the above command removed?

martinjrobins commented 1 year ago

this option was added because the frontend wasn't working unless @mjaquiery added this, so it could be breaking the login. Can you open a development console in your browser and try logging in, what error do you get?

martinjrobins commented 1 year ago

note I just tried this on a fresh azure vm (ubuntu 20.04) and it worked fine, no issues with the 'NODE_OPTIONS'. What system are you using @BradyPlanden ?

BradyPlanden commented 1 year ago

OS is ubuntu 20.04 LTS (it's the current instance used for the BIL).

Quite weird, I'll investigate this a bit further. I suspect it's a host issue now that you've confirmed via azure. I'll update this issue when I find the problem for future reference.

martinjrobins commented 1 year ago

@mjaquiery do you know why @BradyPlanden is getting this problem with NODE_OPTIONS? I think you added this line.

@BradyPlanden: I don't know what the issue is, but I'm guessing that you have a different node:lts image than we do. Perhaps delete all local images and do a docker compose build --no-cache. This might help.

Also, if you are having an issue with the login this could be a separate problem. Open a development console in your browser (Ctrl-Shift-I for chrome in windows) and then try to login again. Have a look at the console for any output, and also the network tab for more info on what went wrong

mjaquiery commented 1 year ago

Yes, definitely could be a node:lts version issue. We could prevent this by properly specifying the base image. I'll investigate the images I'm actually using on the current setup and upgrade the Dockerfile*s to use more specific image tags.

mjaquiery commented 1 year ago

@BradyPlanden can you try pulling from main and rebuilding and let me know if you still experience the issue, please?

BradyPlanden commented 1 year ago

Thanks Matt, I ended up removing the node:lts docker image and running docker compose build --no-cache and that build correctly. It appears the supporting images where about 14 months old.

mjaquiery commented 1 year ago

Excellent. This problem should not occur in future because the node:lts image is now properly specified so we shouldn't get clashes from older images!