uldiseihenbergs / meshcentral-builds

An Docker image for MeshCentral 2. http://www.meshcommander.com/meshcentral2
Apache License 2.0
17 stars 7 forks source link

Install of ws@5.2.0 failed #5

Closed JulienSambre closed 3 years ago

JulienSambre commented 3 years ago

Hi!

First thanks for this Docker image and to update it so often!

I have a problem with the tags 0.8.66 & 0.8.79.

When I did the update (docker-compose behind) from the previous version (0.8.56), when starting, I saw that when the container started :

Installing ws@5.2.0...
ERROR: Unable to install required module "ws@5.2.0". MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. To manualy install this module try:

   cd "/home/node/meshcentral"
   npm install ws@5.2.0
   node node_modules/meshcentral

And then the container stopped.

I have no idea at all, I tried several thing in order to block this unwanted update, but whitout any success so far ...

I think it should never update ws module because I saw that in the npm logs : a ws@5.2.3 is already installed and it wants to install a 5.2.0 instead which is strange.

17 silly resolveWithNewModule ws@5.2.0 checking installable status
18 silly removeObsoleteDep removing ws@5.2.3 from the tree as its been replaced by a newer version or is no longer required

Maybe there is a link with the switch from mc to libcap2-bin?

Have you ever see that?

Thanks!

JulienSambre commented 3 years ago

I just found a workaround : add an entrypoint.sh on my host and override the entrypoint of your Dockerfile :

#!/bin/sh

# Fix bug with npm and ws install via NPM
sed -i 's/ws@5.2.0/ws@5.2.3/g' node_modules/meshcentral/meshcentral.js

# Original command to execute
node ./node_modules/meshcentral

With this sed alone, it fix the problem and other modules install flawlessly :

Installing archiver@4.0.2...
Installing otplib@10.2.3...

There is definitely a problem with the ws module, I don't know why and it appears with the tag 0.8.66.

uldiseihenbergs commented 3 years ago

Hi, and thanks for reporting. do you have this problem with latest tag? as for now, lastest = 0.8.79..

uldiseihenbergs commented 3 years ago

i just tried with both latest and 0.8.79, and all working as expected..

Installing ws@5.2.0...

Installing archiver@4.0.2...

Installing node-rdpjs-2...

Installing semver...

Installing otplib@10.2.3...

MeshCentral HTTP redirection server running on port 80.

MeshCentral v0.8.79, WAN mode.
JulienSambre commented 3 years ago

Yes, I use the latest version currently (0.8.79).

This problem appeared with the tag 0.8.66.

With the add of libcap2-bin is there a need to add CAP rights at the container run?

Here is my docker-compose file, nothing too fancy, except the entrypoint part which is the workaround :

version: '2.4'

services:
    meshcentral2: 
        image: uldiseihenbergs/meshcentral:0.8.79
        container_name: meshcentral2
        volumes:
            - ./meshcentral-data:/home/node/meshcentral/meshcentral-data
            - ./meshcentral-files:/home/node/meshcentral/meshcentral-files      
            - ./entrypoint.sh:/entrypoint.sh
        environment:
            - TZ=XXX
        entrypoint: /entrypoint.sh
        ports: 
            - "XXX"

Interesting fact, we do not have the same modules to install :

Installing archiver@4.0.2...
Installing otplib@10.2.3...
MeshCentral HTTP redirection server running on port 80.
MeshCentral v0.8.79, WAN mode.

Is there some extra container config / environment variable that I missed?

uldiseihenbergs commented 3 years ago

i added libcap, when i moved to 14-slim base image. as far as i know, no additional configuration needed..

uldiseihenbergs commented 3 years ago

can you try latest 0.8.83? should be fixed..

JulienSambre commented 3 years ago

Hi!

Works like a charm! Thanks!