Code Monkey home page Code Monkey logo

Comments (12)

hardillb avatar hardillb commented on September 26, 2024

We are going to need some more details here, to start with:

  • Can we get more of the log running up to the failure
  • What nodes do you have installed
  • What version of docker are you using

from node-red-docker.

hardillb avatar hardillb commented on September 26, 2024

Also what is the output of the following command:

sudo scmp_sys_resolver -a arm clock_gettime64

from node-red-docker.

gray380 avatar gray380 commented on September 26, 2024

I've changed the package.json in the /data from:

{
    "name": "node-red-project",
    "description": "A Node-RED Project",
    "version": "0.0.1",
    "private": true
}

to the:

{
    "name": "node-red-docker",
    "version": "3.1.3",
    "description": "Low-code programming for event-driven applications",
    "homepage": "http://nodered.org",
    "license": "Apache-2.0",
    "repository": {
        "type": "git",
        "url": "https://github.com/node-red/node-red-docker.git"
    },
    "main": "node_modules/node-red/red/red.js",
    "scripts": {
        "start": "node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS",
        "debug": "node --inspect=0.0.0.0:9229 $NODE_OPTIONS node_modules/node-red/red.js $FLOWS",
        "debug_brk": "node --inspect=0.0.0.0:9229 --inspect-brk $NODE_OPTIONS node_modules/node-red/red.js $FLOWS"
    },
    "dependencies": {
        "node-red": "3.1.3",
        "node-red-contrib-mssql-plus": "~0.10.2",
        "node-red-contrib-redis": "~1.3.9",
        "node-red-contrib-uuid": "~0.0.4"
    },
    "engines": {
        "node": ">=14"
    }
}

and service has started.

To be honest I do not recall where package.json comes from.

from node-red-docker.

hardillb avatar hardillb commented on September 26, 2024

Just changing the package.json should not have caused node-red to fail to start.

Also node-red should not be listed in the dependencies for a package.json in /data

from node-red-docker.

gray380 avatar gray380 commented on September 26, 2024

Also what is the output of the following command:

sudo scmp_sys_resolver -a arm clock_gettime64

no such command

from node-red-docker.

gray380 avatar gray380 commented on September 26, 2024

Just changing the package.json should not have caused node-red to fail to start.

miracle ...
That is the only change I've made.

Also node-red should not be listed in the dependencies for a package.json in /data

I used this example.

from node-red-docker.

hardillb avatar hardillb commented on September 26, 2024

That file is for building the container, not for the userDir (/data)

Please supply the information I asked for re the versions and the docker-compose file you used

from node-red-docker.

gray380 avatar gray380 commented on September 26, 2024

We are going to need some more details here, to start with:

* Can we get more of the log running up to the failure

docker service logs shows the only string:
./entrypoint.sh: line 14: 7 Illegal instruction (core dumped) /usr/local/bin/node $NODE_OPTIONS node_modules/node-red/red.js --userDir /data $FLOWS "${@}"

* What nodes do you have installed

What nodes are you asking about? Docker swarm's or something else?

* What version of docker are you using

23.0.5 and 24.0.6

docker-compose.yml

version: '3.7'
services:
  nodered_prod_formnext:
    image: registry.api.lan:8083/common/common.nodered:3.1.3-18
    user: 988:988
    hostname: nodered_prod_formnext
    networks:
      docker.dc:
        aliases:
          - nodered_prod_formnext.docker.dc
      traefik.dc:
        aliases:
          - nodered_prod_formnext.traefik.dc
    dns_search:
      - traefik.dc
      - docker.dc
    environment:
      - TZ=Europe/Kyiv
      - LANG=uk_UA.UTF-8
      - LC_ALL=uk_UA.UTF-8
      - LANGUAGE=uk_UA:uk
      - ASPNETCORE_ENVIRONMENT=Prod
      - BC=11
    volumes:
      - ./volumes/data:/data
    healthcheck:
      test: ["CMD-SHELL", "node /healthcheck.js"]
      interval: 30s
      start_period: 10s
      timeout: 10s
      retries: 3
    deploy:
      labels:
      - traefik.enable=true
      - traefik.docker.network=traefik
      - traefik.http.services.nodered_prod_formnext.loadbalancer.server.port=1880
      - traefik.http.routers.nodered_prod_formnext.entrypoints=websecure
      - traefik.http.routers.nodered_prod_formnext.tls=true
      - traefik.http.routers.nodered_prod_formnext.rule=Host(`formnext.cdc.lan`)
      - traefik.http.routers.nodered_prod_formnext.middlewares=redirect-regex-main
      - "traefik.http.middlewares.redirect-regex-main.redirectregex.regex=^https:\\/\\/([^\\/]+)\\/?$$"
      - "traefik.http.middlewares.redirect-regex-main.redirectregex.replacement=https://$$1/main"
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.labels.worker==true
      restart_policy:
        condition: any
        delay: 5s
        max_attempts: 3
        window: 120s
    logging:
      driver: "gelf"
      options:
        gelf-address: "udp://graylog.lan:12201"
        tag: "common:nodered_prod_formnext:prod"
networks:
  docker.dc:
    external: true
    name: microservices
  traefik.dc:
    external: true
    name: traefik

Dockerfile:

ARG VERSION
FROM nodered/node-red:${VERSION}

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV TZ=Europe/Kyiv

WORKDIR /usr/src/node-red

USER root

ADD CA/*.crt /usr/local/share/ca-certificates/
RUN apk update && apk upgrade && apk add ca-certificates && rm -rf /var/cache/apk/* \
    && update-ca-certificates \
    && npm install --unsafe-perm --no-update-notifier --no-fund --only=production \
    && npm install crypto -g

USER node-red

from node-red-docker.

gray380 avatar gray380 commented on September 26, 2024

That file is for building the container, not for the userDir (/data)

so, what is the correct way to set dependencies?

Please supply the information I asked for re the versions and the docker-compose file you used

from node-red-docker.

hardillb avatar hardillb commented on September 26, 2024

OK, so first you are not using the default image you are using a custom extended container you have built. So it is not the Node-RED images which are crashing but your extended container images, this would have been helpful to know upfront (this is why we ask for the docker inspect output, so we can see what container you are actually using).

The illegal instruction error implies that the container was built for a different target architecture than the one you are running on.

  • Did you do a multi arch manifest build and push that to your local container repository?
  • If you use the default Node-RED shipped image does it start?
  • If you build the container locally on the machine it will run on does it start?

As for including dependencies:

so, what is the correct way to set dependencies?

The file you pointed at lives in /usr/src/node-red this is where the code node-red app is installed in the container. If you edit that package.json to include dependencies then you need to rebuild the whole container. (which you could then use as a base for your extended container)

The other option is to add dependencies to the package.json in the /data volume and run npm install in that directory as part of you extended container. These will be copied to any empty volume mounted on /data when you start up the container for the first time.

At this point I'm not convinced there is a problem with Node-RED shipped containers and the problem is with your build/deployment environment.

from node-red-docker.

gray380 avatar gray380 commented on September 26, 2024

This is alittle bit weird.
My image is based on the official image with added certificates and crypto npm package.

And yes, your images starts successfully:

docker run -it -v myNodeREDdata:/data --name mynodered nodered/node-red:3.1.3-18
30 Jan 16:55:44 - [info]

Welcome to Node-RED
===================

30 Jan 16:55:44 - [info] Node-RED version: v3.1.3
30 Jan 16:55:44 - [info] Node.js  version: v18.19.0
30 Jan 16:55:44 - [info] Linux 4.18.0-477.15.1.el8_8.x86_64 x64 LE
30 Jan 16:55:46 - [info] Loading palette nodes

from node-red-docker.

dceejay avatar dceejay commented on September 26, 2024

I think crypto indeed has a binary component so needs to be rebuilt for the correct architecture.

from node-red-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.