Node-red container can't be installed - docker

I tried for so many hours now and tried so many things that I have to ask now.
On my docker I can't get nodered to run on it. I get permissions error for the shared volume all the time. My other container for "fhem" does run with the same folder permissions. So i don't get why its a problem for nodered.
Currently I'm using ubuntu on the latest version.
I want to store the /data folder from the nodered instance in /opt/docker-nodered but this doesn't work.
I tried to install it with the following command:
docker run -it -p 1880:1880 -v /opt/docker-nodered/:/data --name nodered nodered/node-red-docker
The permissions here are the following:
stefmde#homeautomation:/opt$ ll
total 16
drwxr-xr-x 4 stefmde stefmde 4096 Sep 24 09:52 ./
drwxr-xr-x 23 root root 4096 Sep 21 18:56 ../
drwxr-xr-x 10 stefmde stefmde 4096 Sep 22 12:48 docker-fhem/
drwxr-xr-x 2 stefmde stefmde 4096 Sep 24 14:01 docker-nodered/
I changed them with the following to try to get it running:
chown -R stefmde:stefmde /opt/docker-nored
But no mather what I try, I always get the same error:
stefmde#homeautomation:/opt/docker-nodered$ sudo docker run -it -p 1880:1880 -v /opt/docker-nodered/:/data --name nod ered nodered/node-red-docker
> node-red-docker#1.0.0 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
fs.js:642
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/data/settings.js'
at Error (native)
at Object.fs.openSync (fs.js:642:18)
at copyFileFallback (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:93:18)
at copyFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:85:10)
at onFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:12)
at getStats (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:39)
at startCopy (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:41:10)
at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:36:10)
at Object.<anonymous> (/usr/src/node-red/node_modules/node-red/red.js:104:20)
at Module._compile (module.js:577:32)
npm ERR! Linux 4.15.0-34-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--userDir" "/data"
npm ERR! node v6.14.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! node-red-docker#1.0.0 start: `node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-red-docker#1.0.0 start script 'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-red-docker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-red-docker
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-red-docker
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/node-red/npm-debug.log
The npm.debug.log-file doesn't exist
I tried different permission sets, I checked the UUID which is 1000 of my user, I tried to run "npm install" manually, checked different bug tickets on github, tried the "--User"-Flag which isn't working, running the docker command with and without "sudo" and so on.
Please can someone try to help me or tell me what i did wrong?
I hope you could :)

The node-red docker container runs as the user node-red, a lot of other docker containers run the application as the default user, which happens to be root.
At the moment your docker-nodered directory is only writable by the user stefmde and root (because root can write to anywhere)
The quick solution is to make the docker-nodered writable by anybody (chmod o+w docker-nodered) this should work.
The longer solution will be to work out what the UID of the node-red user is, add a group to the host OS that has a member with the same UID as node-red and make the directory owned by that group and then make it group writable (chmod g+w docker-nodered)
EDIT: The default uid:gid for the node-red user is 1000:1000

By far, the easiest method is to change ownership of the Node-RED data folder to user 1000 and group 1000, as this is hard-coded in the Node-RED docker container:
sudo chown 1000:1000 name-of-node-red-data-folder

I've workaround that worked for me using docker-compose. I've created the file docker-compose-node-red.yml with the following content:
version: "3.7"
services:
node-red:
image: nodered/node-red:latest
ports:
- "1880:1880"
volumes:
- "/path/to/a-nodered-project:/data"
Then, I run
$ docker-compose -f docker-compose-node-red.yml up
In the folder /path/to/a-nodered-project I have a flows.json file and others. Everything is accessible from the node-red container perspective.

Related

Getting an npm permissions error in CI/CD after upgrading to Node v16 - working fine locally running container from same image

After upgrading from Node 14.15 => 16.18.1, I have started getting a Error: EACCES: permission denied, scandir '/root/.npm/_logs' error when trying to run ESLint in the GitHub Actions CI/CD workflow.
Note: I am running this inside a Docker container. I am able to run the ESLint script locally in a container built from the same image, but when running in Github Actions, the workflow fails with the following error:
Creating csps-lint ... done
Attaching to csps-lint
csps-lint |
csps-lint | > lint
csps-lint | > bash ./scripts/lint.sh
csps-lint |
csps-lint | Running Prettier to identify code formatting issues...
csps-lint |
csps-lint | Checking formatting...
csps-lint | All matched files use Prettier code style!
csps-lint |
csps-lint | Running ESLint to identify code quality issues...
csps-lint | npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
csps-lint | npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
csps-lint | npm WARN logfile errno: -13,
csps-lint | npm WARN logfile code: 'EACCES',
csps-lint | npm WARN logfile syscall: 'scandir',
csps-lint | npm WARN logfile path: '/root/.npm/_logs'
csps-lint | npm WARN logfile }
csps-lint | npm ERR! code EACCES
csps-lint | npm ERR! syscall mkdir
csps-lint | npm ERR! path /root/.npm/_cacache/tmp
csps-lint | npm ERR! errno -13
csps-lint | npm ERR!
csps-lint | npm ERR! Your cache folder contains root-owned files, due to a bug in
csps-lint | npm ERR! previous versions of npm which has since been addressed.
csps-lint | npm ERR!
csps-lint | npm ERR! To permanently fix this problem, please run:
csps-lint | npm ERR! sudo chown -R 1001:123 "/root/.npm"
csps-lint |
csps-lint | npm ERR! Log files were not written due to an error writing to the directory: /root/.npm/_logs
csps-lint | npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
csps-lint | ESLint found code quality issues. Please address any errors above and try again.
csps-lint |
csps-lint exited with code 1
1
Aborting on container exit...
Error: Process completed with exit code 1.
My GH Actions workflow is this:
name: test-eslint-fix
on:
push:
branches:
- eslint-fix
jobs:
login:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action#v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
linting:
needs: login
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- run: LINT_COMMAND=lint docker-compose -f docker-comp-lint.yml up --abort-on-container-
Here is the Dockerfile that the image is created from:
# start FROM a base layer of node v16.18.1
FROM node:16.18.1
# confirm installation
RUN node -v
RUN npm -v
# Globally install webpack in the container for webpack dev server
RUN npm install webpack -g
# Install db-migrate
RUN npm install db-migrate#0.11.11 -g
# Set up a WORKDIR for application in the container
WORKDIR /usr/src/app
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json /usr/src/app/
# npm install to create node_modules in the container
RUN npm install
# EXPOSE your server port
EXPOSE 3000
This is my docker-compose file:
version: '3'
services:
csps-lint:
image: <<my image>>
container_name: csps-lint
ports:
- '3002:3002'
volumes:
- ./:/usr/src/app
- node_modules:/usr/src/app/node_modules
environment:
- NODE_ENV=test
- LINT_COMMAND=${LINT_COMMAND}
command: npm run ${LINT_COMMAND}
volumes:
node_modules:
And this is the bash script that is running the ESLint command:
# Run Prettier in check mode and store status
echo -e "\033[1;33mRunning Prettier to identify code formatting issues...\033[0m\n"
prettier --check .
PRETTIER_STATUS=$?
# Run ESLint in check mode and store status
echo -e "\n\033[1;33mRunning ESLint to identify code quality issues...\033[0m"
npx eslint .
ESLINT_STATUS=$?
I have tried adding the recommended fix from the error message in multiple places, but nothing seems to resolve the issue. I've put this command in the lint.sh script, I've added it to the Dockerfile, I've tried adding in the docker-compose file as well, but I'm unable to resolve the issue no matter where I place the command.
sudo chown -R 1001:123 "/root/.npm"
In a few of the instances, there was no access to sudo, so I'm wondering if I somehow need to install that first? Do I even need to be setting these permissions? Is there something that has changed from Node v14 to Node v16 that I'm just overlooking?
I've tried to use the solutions provided in other posts with similar error messages for other packages, but none of the solutions seem to fix this issue.
I feel like there must just be some very small thing I've missed, but the part that I'm really lost on is that I haven't changed this workflow other than upgrading the Node.js version in the Dockerfile. Also, I am able to run this workflow locally without issue in a container created from the same image, but inside GH Actions I can't seem to get past this flow.
When running the following command locally docker exec csps-lint ls -la /root/.npm/_logs, this is my output:
total 1080
drwxr-xr-x 1 root root 4096 Dec 2 23:02 .
drwxr-xr-x 1 root root 4096 Dec 2 20:15 ..
-rw-r--r-- 1 root root 1589 Nov 15 06:46 2022-11-15T06_46_44_197Z-debug-0.log
-rw-r--r-- 1 root root 1589 Dec 2 20:15 2022-12-02T20_15_05_450Z-debug-0.log
-rw-r--r-- 1 root root 65102 Dec 2 20:15 2022-12-02T20_15_05_684Z-debug-0.log
-rw-r--r-- 1 root root 59037 Dec 2 20:15 2022-12-02T20_15_09_141Z-debug-0.log
-rw-r--r-- 1 root root 943351 Dec 2 20:15 2022-12-02T20_15_14_433Z-debug-0.log
-rw-r--r-- 1 root root 1706 Dec 2 20:23 2022-12-02T20_23_05_075Z-debug-0.log
-rw-r--r-- 1 root root 1756 Dec 2 20:23 2022-12-02T20_23_16_787Z-debug-0.log
-rw-r--r-- 1 root root 1599 Dec 2 23:02 2022-12-02T23_02_23_793Z-debug-0.log
UPDATE: So I have discovered that when I run the script in the csps-lint folder locally, the user is root, but when it is run in the CI/CD, it runs as an unnamed user with ID 1001. I'm really unclear why the user would be different when the container is built from the same image no matter where it's being run.
I believe this issue was caused by npm updates no longer running in root. After much back and forth and trying 101 different things, I was able to resolve the issue by:
Adding the following command to the end of my dockerfile
RUN chown -R node:node /usr/src/app
Adding a user key to my docker-compose.yml file
version: '3'
services:
csps-lint:
image: <<my image>>
user: node
container_name: csps-lint
ports:
- '3002:3002'
volumes:
- ./:/usr/src/app
- node_modules:/usr/src/app/node_modules
environment:
- NODE_ENV=test
- LINT_COMMAND=${LINT_COMMAND}
command: npm run ${LINT_COMMAND}
volumes:
node_modules:

Installing hapood 3.2 over docker- error of libc-bin

While installing hadoop 3.2 with docker, I encounter the following error:
Setting up npm (3.5.2-0ubuntu4) ...
Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
WARN engine npm#7.13.0: wanted: {"node":">=10"} (current: {"node":"4.2.6","npm":"3.5.2"})
WARN engine npm#7.13.0: wanted: {"node":">=10"} (current: {"node":"4.2.6","npm":"3.5.2"})
/usr/local/lib
`-- (empty)
npm ERR! Linux 4.15.0-29-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "npm#latest" "-g"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/#npmcli/ci-detect-c7bf9552
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/#npmcli/ci-detect-c7bf9552' -> '/usr/local/lib/node_modules/npm/node_modules/#npmcli/ci-detect'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/#npmcli/ci-detect-c7bf9552' -> '/usr/local/lib/node_modules/npm/node_modules/#npmcli/ci-detect'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
npm ERR! code 1
How can I solve this problem?
The bash script, supplied with Hadoop 3.2 source file and contains the docker commands, is as follows:
#!/usr/bin/env bash
set -e # exit on error
cd "$(dirname "$0")" # connect to root
docker build -t hadoop-build dev-support/docker
if [ "$(uname -s)" = "Linux" ]; then
USER_NAME=${SUDO_USER:=$USER}
USER_ID=$(id -u "${USER_NAME}")
GROUP_ID=$(id -g "${USER_NAME}")
# man docker-run
# When using SELinux, mounted directories may not be accessible
# to the container. To work around this, with Docker prior to 1.7
# one needs to run the "chcon -Rt svirt_sandbox_file_t" command on
# the directories. With Docker 1.7 and later the z mount option
# does this automatically.
if command -v selinuxenabled >/dev/null && selinuxenabled; then
DCKR_VER=$(docker -v|
awk '$1 == "Docker" && $2 == "version" {split($3,ver,".");print ver[1]"."ver[2]}')
DCKR_MAJ=${DCKR_VER%.*}
DCKR_MIN=${DCKR_VER#*.}
if [ "${DCKR_MAJ}" -eq 1 ] && [ "${DCKR_MIN}" -ge 7 ] ||
[ "${DCKR_MAJ}" -gt 1 ]; then
V_OPTS=:z
else
for d in "${PWD}" "${HOME}/.m2"; do
ctx=$(stat --printf='%C' "$d"|cut -d':' -f3)
if [ "$ctx" != svirt_sandbox_file_t ] && [ "$ctx" != container_file_t ]; then
printf 'INFO: SELinux is enabled.\n'
printf '\tMounted %s may not be accessible to the container.\n' "$d"
printf 'INFO: If so, on the host, run the following command:\n'
printf '\t# chcon -Rt svirt_sandbox_file_t %s\n' "$d"
fi
done
fi
fi
else # boot2docker uid and gid
USER_NAME=$USER
USER_ID=1000
GROUP_ID=50
fi
docker build -t "hadoop-build-${USER_ID}" - <<UserSpecificDocker
FROM hadoop-build
RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME}
RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
RUN echo "${USER_NAME} ALL=NOPASSWD: ALL" > "/etc/sudoers.d/hadoop-build-${USER_ID}"
ENV HOME /home/${USER_NAME}
UserSpecificDocker
#If this env varible is empty, docker will be started
# in non interactive mode
DOCKER_INTERACTIVE_RUN=${DOCKER_INTERACTIVE_RUN-"-i -t"}
# By mapping the .m2 directory you can do an mvn install from
# within the container and use the result on your normal
# system. And this also is a significant speedup in subsequent
# builds because the dependencies are downloaded only once.
docker run --rm=true $DOCKER_INTERACTIVE_RUN \
-v "${PWD}:/home/${USER_NAME}/hadoop${V_OPTS:-}" \
-w "/home/${USER_NAME}/hadoop" \
-v "${HOME}/.m2:/home/${USER_NAME}/.m2${V_OPTS:-}" \
-u "${USER_ID}" \
"hadoop-build-${USER_ID}" "$#"
and I used the following command to run the file:
sudo ./start-build-env.sh
Edit: tried to install hadoop with marven over two days, but I have problem installing the pre-existing packages, and don't know what do about it. Thus I tried the docker version, which consider to be easier, but it does not works...

Error on Running selenium test on alpine docker container

Dockerfile:
FROM node:8.14.1-alpine
RUN apk update && apk add --no-cache openjdk8-jre
RUN apk update && apk add python py-pip curl unzip libexif udev nano
ENV CHROME_BIN=/usr/bin/chromium-browser
RUN echo #v3.8 http://nl.alpinelinux.org/alpine/v3.8/community >> /etc/apk/repositories && \
echo #v3.8 http://nl.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
apk add --no-cache \
chromium#v3.8 \
nss#v3.8
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
WORKDIR /project_compile/vue_app
COPY vue_app /project_compile/vue_app
RUN rm -rf node_modules
RUN npm config set registry http://registry.npmjs.org/ && npm install
CMD npm run test:e2e:headless
When it is run, this error happens:
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ value:
{ message: 'Timed out waiting for driver server to start.\nBuild info: version: \'3.141.59\', revision: \'e82be7d358\', time: \'2018-11-14T08:25:53\'\nSystem info: host: \'a3f993cb3a2b\', ip: \'172.22.0.2\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.15.0-33-generic\', java.version: \'1.8.0_191\'\nDriver info: driver.version: unknown',
error: 'unknown error' },
status: 13 }
ERROR Error: Command failed: /project_compile/vue_app/node_modules/nightwatch/bin/nightwatch --config nightwatch.conf.js --env chrome
Error: Command failed: /project_compile/vue_app/node_modules/nightwatch/bin/nightwatch --config nightwatch.conf.js --env chrome
at makeError (/project_compile/vue_app/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/project_compile/vue_app/node_modules/execa/index.js:278:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_app#0.1.0 test:e2e:headless: `vue-cli-service test:e2e --config nightwatch.conf.js --env chrome`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_app#0.1.0 test:e2e:headless script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-01-14T12_14_57_744Z-debug.log
Seems that chrome works correctly (testable running something like chromium-browser --headless --no-sandbox --dump-dom https://www.chromestatus.com/) and also selenium seems to be working fine.
Why does the test not run? The error is not explainable.
All code is contained in this repo https://github.com/nicolalandro/vue-selenium-docker. So reproducing it is easy - clone the repo and run two commands:
docker-compose -f docker/test/js/docker-compose-js-e2e.yml build
docker-compose -f docker/test/js/docker-compose-js-e2e.yml up --exit-code-from e2e
Maybe you have to wait for selenium container to be up?
check out this guide:
https://github.com/SeleniumHQ/docker-selenium#waiting-for-the-grid-to-be-ready
Write down a script to check for "ready": true,
The problem was that the selenium version was not aligned to chrome version.

Apollo iOS: Run script, Build fail Error

I installed the pod apollo according to this manual, then at the stage where you have to create a run-time, the build does not work, it returns this error I do not understand why ..
Can't find Apollo CLI. Installing...
npm ERR! Error while executing:
npm ERR! /Applications/Xcode.app/Contents/Developer/usr/bin/git ls-remote -h -t ssh://git#github.com/Project/fitto-ios.git
npm ERR!
npm ERR! git#github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mickaelbelhassen/.npm/_logs/2018-08-21T13_43_18_743Z-debug.log
Command /bin/sh failed with exit code 1
And I do not understand why he talks about git ..
Also, the repository ssh://git#github.com/Project/fitto-ios.git is my remote repository, it has nothing to do with Apollo.
Here is my run script is the same as the official documentation:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift
You need to install the Apollo CLI from Here Then try building your app again.

Docker build in dind not producing the same result as local docker build

I have been trying to set up a gitlab ci using shared runners. My .gitlab-ci.yml looks like this:
image: docker:latest
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
DOCKER_DRIVER: overlay2
GCP_PROJECT_ID: example-12345
IMAGE_NAME: test
services:
- docker:dind
stages:
- publish
publish-image:
stage: publish
script:
# Create our image. Expected to create an image 'image_id'
- docker build -t $IMAGE_NAME .
# Tag our image for container registry
- docker tag $IMAGE_NAME eu.gcr.io/$GCP_PROJECT_ID/$IMAGE_NAME
# Install CA certs, openssl to https downloads, python for gcloud sdk
- apk add --update make ca-certificates openssl python
- update-ca-certificates
# Download and install Google Cloud SDK
- wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
- tar zxvf google-cloud-sdk.tar.gz && ./google-cloud-sdk/install.sh --usage-reporting=false --path-update=true
- google-cloud-sdk/bin/gcloud --quiet components install kubectl
- google-cloud-sdk/bin/gcloud --quiet components update
- google-cloud-sdk/bin/gcloud auth activate-service-account --key-file g.json
# Optionally tag the image with the commit short-sha
- docker tag $IMAGE_NAME eu.gcr.io/$GCP_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)
#- google-cloud-sdk/bin/gcloud docker -- push eu.gcr.io/$GCP_PROJECT_ID/$IMAGE_NAME:latest
- google-cloud-sdk/bin/gcloud docker -- push eu.gcr.io/$GCP_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)
# Only run builds for these refs
only:
- master
The project I am trying to build is Meteor application (Meteor version 1.6.1) thats supposed to be run in a kubernetes cluster. For creating containers I am using https://github.com/jshimko/meteor-launchpad.
When I use docker build on my local machine everything is working, but when in the CI I get this error (after build in stage Running npm install in the server bundle...):
> node-pre-gyp install --fallback-to-build
module.js:540
throw err;
^
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/opt/meteor/dist/bundle/programs/server/npm/node_modules/.bin/node-pre-gyp:15:20)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#1.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#1.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-03-08T13_29_09_532Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! meteor-dev-bundle# install: `node npm-rebuild.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle# install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-03-08T13_29_09_574Z-debug.log
But I dont believe it is an actual meteor problem since I know the code works.
Another weird thing is that the build actually is successful in an older version of the code running meteor 1.5.2.2 (New version is 1.6.1), however it then breaks when run in kubernetes. The error from the pod reads:
=> Starting app on port 3000...
## There is an issue with `node-fibers` ##
`/opt/meteor/dist/bundle/programs/server/node_modules/fibers/bin/linux-x64-57/fibers.node` is missing.
Try running this to fix the issue: /opt/nodejs/bin/node /opt/meteor/dist/bundle/programs/server/node_modules/fibers/build
/opt/meteor/dist/bundle/programs/server/node_modules/fibers/fibers.js:20
throw new Error('Missing binary. See message above.');
^
Error: Missing binary. See message above.
at Object.<anonymous> (/opt/meteor/dist/bundle/programs/server/node_modules/fibers/fibers.js:20:8)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
Dispite the build log from the runner states:
> fibers#1.0.15 install /opt/meteor/dist/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-46` exists; testing
Binary is fine; exiting
Since I know that the build can succeed I assume that the docker-in-docker is run with the right settings on the shared runners. Either by binding the outer docker socket to the inner och by running privileged (As described here and here)
So why do my build get corrupted/fail on the CI?
EDIT: My local builds are done on ubuntu 16

Resources