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

FIx failing docker compose #535

Merged
merged 9 commits into from Jan 30, 2024
Merged

FIx failing docker compose #535

merged 9 commits into from Jan 30, 2024

Conversation

Tanvez
Copy link
Collaborator

@Tanvez Tanvez commented Jan 23, 2024

This PR fixes the failing docker compose by:

Removing the following and updating package.json:

  • babel-eslint: ^10.1.0
  • eslint: ^7.9.0
  • eslint-import-resolver-webpack: ^0.12.2
  • eslint-plugin-html: ^6.1.0
  • eslint-plugin-import: ^2.22.0
  • eslint-plugin-vue: ^6.2.2
  • Update Sass to version 1.64.2

Update Dockerfile with the following:

  • curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \
  • ARG NODE_OPTIONS=--openssl-legacy-provider

Note:

Not related to failing compose:

  • updates to Python version: 3.11
  • update to base.in pandas version

To do

  • we will need to remedy the NODE_OPTIONS. Setup spike to look into webpack updates/migration
  • Add back linter package and re-enable gh actions for eslint
  • Update subsequent packages in node/python(e.g django/vue)

@Tanvez Tanvez marked this pull request as ready for review January 24, 2024 18:41
Copy link
Contributor

@arthurian arthurian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updates look good @Tanvez! I rebuilt my local dev environment with the changes and the docker image built cleanly (pandas took forever to build, but other than that no issues).

Kudos for tracking down the source of the issues and bringing some of these outdated dependencies up-to-date. I left a few comments/suggestions below, but nothing blocking. 👍

Dockerfile Outdated
@@ -34,7 +36,7 @@ EXPOSE 8000 8080

FROM prod AS dev

# Install python dev dependencies
# # Install python dev dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: double hash (#) symbol

@@ -8,9 +8,9 @@ RUN mkdir -p /app
WORKDIR /app

# Install system dependencies and target node v14
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \
Copy link
Contributor

@arthurian arthurian Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that NodeJS v20 is the LTS release and v21 is the current release, which has a much shorter support window. According to the release schedule, v21 will be EOL on June 1, 2024, so we may want to ensure we update to v22 (the next LTS release) when that's available later this Spring (or switch to the current LTS release v20).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Artie! Will note that in the comments

pandas~=1.4.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we could probably bump this to the latest 1.x release 1.5.3 without any issues. I briefly glanced at the Pandas Release Notes and didn't see any major incompatibilities from 1.4 to 1.5. Not sure about the jump to 2.0 though. AFAIK pandas is only being used in the import scripts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good will do!

@@ -20,6 +20,8 @@ RUN pip install -r base.txt && \

# Install node dependencies
COPY ./package-lock.json ./package.json /app/
# TODO: see if we can upgrade webpack/uglify to remedy NODE_OPTIONS
ARG NODE_OPTIONS=--openssl-legacy-provider
Copy link
Contributor

@arthurian arthurian Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(For posterity) omitting the --openssl-legacy-provider node option results in an error message like this when doing an npm i:

ERROR in main-6d8044f3191ec0e46aaa.js from UglifyJs
19.84 Error: error:0308010C:digital envelope routines::unsupported
19.84     at new Hash (node:internal/crypto/hash:68:19)
19.84     at Object.createHash (node:crypto:138:10)
19.84     at /app/node_modules/uglifyjs-webpack-plugin/dist/index.js:186:40
19.84     at Array.forEach (<anonymous>)
19.84     at UglifyJsPlugin.optimizeFn (/app/node_modules/uglifyjs-webpack-plugin/dist/index.js:126:142)
19.84     at AsyncSeriesHook.eval [as callAsync] (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:21:1)
19.84     at AsyncSeriesHook.lazyCompileHook (/app/node_modules/tapable/lib/Hook.js:154:20)
19.84     at /app/node_modules/webpack/lib/Compilation.js:1409:36
19.84     at eval (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
19.84     at /app/node_modules/copy-webpack-plugin/dist/index.js:598:9
19.84 
19.84 ERROR in vendor-6d8044f3191ec0e46aaa.js from UglifyJs
19.84 Error: error:0308010C:digital envelope routines::unsupported
19.84     at new Hash (node:internal/crypto/hash:68:19)

The underlying issue seems to have to do with webpack v4 using an outdated hash function, which has been disallowed as of Node v17. The only way to allow it is to pass that legacy option. Long-term, we need to updgrade to webpack v5 which uses a newer hash function.

See also:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for adding context/reference to the --openssl-legacy-provider

- name: Lint JavaScript
run: npm run lint
# - name: Lint JavaScript
# run: npm run lint
Copy link
Contributor

@arthurian arthurian Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intent to fix/restore the linting in a follow-up PR?

Edit: nevermind, I see you noted that in the PR description.

@Tanvez Tanvez merged commit 6240c65 into dev Jan 30, 2024
4 checks passed
@Tanvez Tanvez deleted the bug/failing-docker-compose branch January 30, 2024 14:47
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

Successfully merging this pull request may close these issues.

None yet

2 participants