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

Make nodejs 18.14.0 installation work, changed npm --unsafe-perm behavior #4615

Closed
wants to merge 1 commit into from
Closed

Make nodejs 18.14.0 installation work, changed npm --unsafe-perm behavior #4615

wants to merge 1 commit into from

Conversation

davereid-pfg
Copy link

@davereid-pfg davereid-pfg commented Feb 6, 2023

The Issue

Fixes #4614

How This PR Solves The Issue

Implements the same change to the npm command in the Dockerfile as #4610 did.

Manual Testing Instructions

Automated Testing Overview

Related Issue Link(s)

Release/Deployment Notes

Copy link
Member

@rfay rfay left a comment

Choose a reason for hiding this comment

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

Thanks so much for the contribution. I don't think this is relevant to this issue; npm at this point in the container is npm 8.19.2. Are you able to recreate the problem you're having with HEAD? brew install --HEAD --fetch-head ddev ?

@davereid-pfg
Copy link
Author

@rfay After I test that, what would be the brew command to run to go back to the stable release like normal?

@rfay
Copy link
Member

rfay commented Feb 6, 2023

brew uninstall ddev && brew install ddev

@davereid-pfg
Copy link
Author

Testing now on local.

@@ -79,7 +79,7 @@ RUN apt-get -qq install --no-install-recommends --no-install-suggests -y \
postgresql-client \
sqlite3

RUN npm config set unsafe-perm true && npm install --global gulp-cli yarn
RUN npm install --unsafe-perm=true --global gulp-cli yarn
Copy link
Member

Choose a reason for hiding this comment

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

The reality is I'm not completely sure why we even install nodejs this early, when we're going to do it later in post-build.

At this point, though, we're building with NODE_LTS=16, so is node 16 affected by this change?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see this error on node 16 - but I also haven't tested this PR to know it fixes things for us.

Copy link
Author

Choose a reason for hiding this comment

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

Maybe we should remove this step here then?

@davereid-pfg
Copy link
Author

Tried testing this on my local (which needs the pre.Dockerfile.certificates to load in extra certificates) and I got the following error:

ddev restart
Restarting project houston9...
Instrumentation is opted in, but SegmentKey is not available. This usually means you have a locally-built ddev binary or one from a PR build. It's not an error. Please report it if you're using an official release build.
failed to solve: executor failed running [/bin/sh -c curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.x  ||  curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.sh >/tmp/setup_node.sh]: exit code: 60
Failed to restart houston9: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-houston9 docker-compose -f /Users/R654600/code/houston9/.ddev/.ddev-docker-compose-full.yaml up --build -d', action='[up --build -d]', err='exit status 17', stdout='#1 [drud/ddev-dbserver-mariadb-10.3:v1.21.4-houston9-built internal] load build definition from Dockerfile
#1 transferring dockerfile: 612B done
#1 DONE 0.0s

#2 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built internal] load build definition from Dockerfile
#2 transferring dockerfile: 2.12kB done
#2 DONE 0.0s

#3 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [drud/ddev-dbserver-mariadb-10.3:v1.21.4-houston9-built internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [drud/ddev-dbserver-mariadb-10.3:v1.21.4-houston9-built internal] load metadata for docker.io/drud/ddev-dbserver-mariadb-10.3:v1.21.4
#5 DONE 0.0s

#6 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built internal] load metadata for docker.io/drud/ddev-webserver:20230128_xdebug_build_time
#6 DONE 0.0s

#7 [drud/ddev-dbserver-mariadb-10.3:v1.21.4-houston9-built 1/2] FROM docker.io/drud/ddev-dbserver-mariadb-10.3:v1.21.4
#7 DONE 0.0s

#8 [drud/ddev-dbserver-mariadb-10.3:v1.21.4-houston9-built 2/2] RUN (groupadd --gid 20 "r654600" || groupadd "r654600" || true) && (useradd  -l -m -s "/bin/bash" --gid "r654600" --comment '' --uid 503 "r654600" || useradd  -l -m -s "/bin/bash" --gid "r654600" --comment '' "r654600" || useradd  -l -m -s "/bin/bash" --gid "20" --comment '' "r654600" || useradd -l -m -s "/bin/bash" --comment '' r654600 )
#8 CACHED

#9 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  1/13] FROM docker.io/drud/ddev-webserver:20230128_xdebug_build_time
#9 DONE 0.0s

#10 [drud/ddev-dbserver-mariadb-10.3:v1.21.4-houston9-built] exporting to image
#10 exporting layers done
#10 writing image sha256:7ee6865cfc3d2148217a86dcb2fa3b3fb48eee855d78c729b8740c6e9e772cfb done
#10 naming to docker.io/drud/ddev-dbserver-mariadb-10.3:v1.21.4-houston9-built done
#10 DONE 0.0s

#11 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built internal] load build context
#11 transferring context: 2B 1.8s done
#11 DONE 1.8s

#12 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  4/13] RUN update-ca-certificates --fresh
#12 CACHED

#13 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  5/13] RUN export XDEBUG_MODE=off; composer self-update --stable || composer self-update --stable || true; composer self-update --2 || composer self-update --2 || true
#13 CACHED

#14 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  6/13] RUN mkdir -p /home/r654600 && chown r654600 /home/r654600 && chmod 600 /home/r654600/.pgpass
#14 CACHED

#15 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  2/13] RUN (groupadd --gid 20 "r654600" || groupadd "r654600" || true) && (useradd  -l -m -s "/bin/bash" --gid "r654600" --comment '' --uid 503 "r654600" || useradd  -l -m -s "/bin/bash" --gid "r654600" --comment '' "r654600" || useradd  -l -m -s "/bin/bash" --gid "20" --comment '' "r654600" || useradd -l -m -s "/bin/bash" --comment '' r654600 )
#15 CACHED

#16 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  3/13] COPY *.crt /usr/local/share/ca-certificates/
#16 CACHED

#17 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  7/13] RUN (apt-get remove -y nodejs || true) && (apt purge nodejs || true)
#17 CACHED

#18 [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  8/13] RUN curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.x  ||  curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.sh >/tmp/setup_node.sh
#18 0.578 curl: (60) SSL certificate problem: self signed certificate in certificate chain
#18 0.578 More details here: https://curl.se/docs/sslcerts.html
#18 0.578
#18 0.578 curl failed to verify the legitimacy of the server and therefore could not
#18 0.578 establish a secure connection to it. To learn more about this situation and
#18 0.578 how to fix it, please visit the web page mentioned above.
#18 1.011 curl: (60) SSL certificate problem: self signed certificate in certificate chain
#18 1.011 More details here: https://curl.se/docs/sslcerts.html
#18 1.011
#18 1.011 curl failed to verify the legitimacy of the server and therefore could not
#18 1.011 establish a secure connection to it. To learn more about this situation and
#18 1.011 how to fix it, please visit the web page mentioned above.
#18 ERROR: executor failed running [/bin/sh -c curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.x  ||  curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.sh >/tmp/setup_node.sh]: exit code: 60
------
 > [drud/ddev-webserver:20230128_xdebug_build_time-houston9-built  8/13] RUN curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.x  ||  curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.sh >/tmp/setup_node.sh:
#18 0.578
#18 0.578 curl failed to verify the legitimacy of the server and therefore could not
#18 0.578 establish a secure connection to it. To learn more about this situation and
#18 0.578 how to fix it, please visit the web page mentioned above.
#18 1.011 curl: (60) SSL certificate problem: self signed certificate in certificate chain
#18 1.011 More details here: https://curl.se/docs/sslcerts.html
#18 1.011
#18 1.011 curl failed to verify the legitimacy of the server and therefore could not
#18 1.011 establish a secure connection to it. To learn more about this situation and
#18 1.011 how to fix it, please visit the web page mentioned above.
------
', stderr='failed to solve: executor failed running [/bin/sh -c curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.x  ||  curl -sSL --fail -o /tmp/setup_node.sh https://deb.nodesource.com/setup_18.sh >/tmp/setup_node.sh]: exit code: 60'

@deviantintegral
Copy link
Collaborator

I don't have the same cert setup as @davereid-pfg 's project, and head worked fine! So, I don't think this PR is needed.

$ ddev version
 ITEM             VALUE
 DDEV version     vHEAD-1f93c39
$ ddev exec node --version
v18.14.0

@rfay
Copy link
Member

rfay commented Feb 6, 2023

Since NODE_LTS here is 16, this PR won't be necessary, but we'll definitely have to sort out when we switch the LTS default to 18. Which should be pretty soon.

Thanks so much for taking the time to do this. Continuing conversation on short-term approaches in

@rfay rfay closed this Feb 6, 2023
@davereid-pfg davereid-pfg deleted the fix-dockerfile-npm-unsafe-perm branch February 6, 2023 21:53
@rfay
Copy link
Member

rfay commented Feb 6, 2023

@davereid-pfg this PR couldn't not have worked OOTB because it doesn't reference the docker image that would be built from it.

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.

Unable to start DDEV with nodejs_version: 18 (upstream problem, fix with nodejs 16)
3 participants