Speckle-server on Docker - missing module?

Hello Specklers,

I’m encountering an error while running Speckle with Docker, and I would greatly appreciate any assistance or insights to help me resolve it. It started with a 502 error on the front end but upon investigating at docker-compose up the error message I’m seeing is as follows:

speckle-server_1      | node:internal/modules/cjs/loader:1078
speckle-server_1      |   throw err;
speckle-server_1      |   ^
speckle-server_1      | 
speckle-server_1      | Error: Cannot find module '/speckle-server/packages/server/bash'
speckle-server_1      |     at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
speckle-server_1      |     at Module._load (node:internal/modules/cjs/loader:920:27)
speckle-server_1      |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
speckle-server_1      |     at node:internal/main/run_main_module:23:47 {
speckle-server_1      |   code: 'MODULE_NOT_FOUND',
speckle-server_1      |   requireStack: []
speckle-server_1      | }
speckle-server_1      | 
speckle-server_1      | Node.js v18.16.0

as of today we pulled the latest server and front-end. any ideas what this could be?
Thanks!

1 Like

Hi @dvalent

We recently made changes to the entrypoint of the Docker image, so the command for starting it is a little different.

Did you update your docker-compose file to the latest published version? I assume you may be using the one from our documentation: Deploying a Server - manual setup | Speckle Docs

EDIT: when updating docker-compose, please backup the database following this guide: Database backup, upgrade, and restore | Speckle Docs

Iain

1 Like

Havent tried the latest docker-compose file, ill give that a go. Is the one on the docs up-to-date or is there a github link? :grinning:

1 Like

Please use the one in the docs, it has been updated to reflect the change. Please do let me know if this resolves the problem for you!

Hi Iain,
I’ve used the latest docker-compose.yml file in the docs and that seems to have solved the network issue.

note:
i had to comment out line 63 as it was giving me an ‘unhealthy container’

    healthcheck:
      test: ["CMD", "node", "-e", "require('node:http').request({headers: {'Content-Type': 'application/json'}, port:3000, hostname:'127.0.0.1', path:'/graphql?query={serverInfo{version}}', method: 'GET' }, (res) => { body = ''; res.on('data', (chunk) => {body += chunk;}); res.on('end', () => {process.exit(res.statusCode != 200 || body.toLowerCase().includes('error'));}); }).end();"]

Front-end and Server spin up without a problem. Unfortunately now my database seems to be completely empty (new) is this possible? would this move create a new db?

Hey @dvalent if you had a volume mapped to your database container it should have your old data.
The new compose file might be referring / creating a different docker volume, so that is why it looks empty.

Also if you are having issues with your database connection, the server won’t report healthy on the healthcheck test.

Could u send a screenshot of your old and new volume references for the DB?

Also note the docker compose volumes are namespaced to the project name.
You can get the existing docker volumes with docker volume ls. Make sure your new compose file is referencing the old volume.

1 Like

Hi Gergo, i thought so too.

our old yml file was using this for postgres

 postgres:

    image: "postgres:13.1-alpine"

    restart: always

    environment:

      POSTGRES_DB: 

      POSTGRES_USER: 

      POSTGRES_PASSWORD: 

    volumes:

      - ./postgres-data:/var/lib/postgresql/data/

    ports:

      - "127.0.0.1:5432:5432"



  redis:

    image: "redis:6.0-alpine"

    restart: always

    volumes:

      - ./redis-data:/data

    ports:

      - "127.0.0.1:6379:6379"

  minio:
    image: "minio/minio"
    command: server /data --console-address ":9001"
    restart: always
    volumes:
      - ./minio-data:/data
    ports:
      - "127.0.0.1:9000:9000"
      - "127.0.0.1:9001:9001"```

compared to the new one from your docs.

  postgres:
    image: 'postgres:14.5-alpine'
    restart: always
    environment:
      POSTGRES_DB: 
      POSTGRES_USER: 
      POSTGRES_PASSWORD: 
    volumes:
      - postgres-data:/var/lib/postgresql/data/
    healthcheck:
      # the -U user has to match the POSTGRES_USER value
      test: ["CMD-SHELL", "pg_isready -U speckle"]
      interval: 5s
      timeout: 5s
      retries: 30

  redis:
    image: 'redis:6.0-alpine'
    restart: always
    volumes:
      - redis-data:/data
    healthcheck:
      test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
      interval: 5s
      timeout: 5s
      retries: 30

  minio:
    image: 'minio/minio'
    command: server /data --console-address ":9001"
    restart: always
    volumes:
      - minio-data:/data
    healthcheck:
      test: ["CMD-SHELL", "curl -s -o /dev/null http://127.0.0.1:9000/minio/index.html"]
      interval: 5s
      timeout: 30s
      retries: 30
      start_period: 10s

i can see the mapped volumes are virtually the same, ill try to investigate why the the server is failing the health check - anything in particular I should look for?

this is a docker volume ls:

DRIVER              VOLUME NAME
local               speckv2_minio-data
local               speckv2_postgres-data
local               speckv2_redis-data

Checking out the logs I found this error when looking at the server, might be the culprit…

2023-06-15 11:19:28.010 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.5

This is likely to be the problem!
We have a guide on backing up and upgrading the postgres database which should help resolve this: Database backup, upgrade, and restore | Speckle Docs

All working now,
changed the image back to our previous 13 version

 image: "postgres:13.1-alpine"

thanks for the link, we will prepare for a migration.

2 Likes