Skip to content

Failure to run the backend NodeJS server when mounting config.toml as a volume #646

@rohittanwar

Description

@rohittanwar

Describe the bug
Mounting config.toml in volumes in docker-compose.yaml gives an error when running the backend NodeJS server.

- ./config.toml:/home/perplexica/config.toml

What happens in my opinion is - when docker-compose.yaml mounts the config.toml in a volume as above, the docker container treats the config.toml as a directory instead of a file and thus the Object.readFileSync function fails with the error as below.

Full error text -

perplexica-backend-1 |
perplexica-backend-1 | [i] No changes detected
perplexica-backend-1 | node:internal/fs/utils:356
perplexica-backend-1 | throw err;
perplexica-backend-1 | ^
perplexica-backend-1 |
perplexica-backend-1 | Error: EISDIR: illegal operation on a directory, read
perplexica-backend-1 | at Object.readSync (node:fs:744:3)
perplexica-backend-1 | at tryReadSync (node:fs:444:20)
perplexica-backend-1 | at Object.readFileSync (node:fs:490:19)
perplexica-backend-1 | at loadConfig (/home/perplexica/dist/config.js:11:60)
perplexica-backend-1 | at getPort (/home/perplexica/dist/config.js:12:23)
perplexica-backend-1 | at Object. (/home/perplexica/dist/app.js:13:35)
perplexica-backend-1 | at Module._compile (node:internal/modules/cjs/loader:1364:14)
perplexica-backend-1 | at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
perplexica-backend-1 | at Module.load (node:internal/modules/cjs/loader:1203:32)
perplexica-backend-1 | at Module._load (node:internal/modules/cjs/loader:1019:12) {
perplexica-backend-1 | errno: -21,
perplexica-backend-1 | syscall: 'read',
perplexica-backend-1 | code: 'EISDIR'
perplexica-backend-1 | }
perplexica-backend-1 |
perplexica-backend-1 | Node.js v18.20.7
perplexica-backend-1 | error Command failed with exit code 1.
perplexica-backend-1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
perplexica-backend-1 exited with code 0

To Reproduce
Steps to reproduce the behavior:

  1. Clone the perplexica repo.
  2. Follow the readme steps to rename the sample.config.toml to config.toml and run the docker containers using docker compose up --build.
  3. The backend container, throw an error and is not able to run.

Expected behavior
Running perplexica locally without any changes in the docker-compose file should work fine.
The alternative solution which worked for me is to -

  1. Modify backend.dockerfile and also add COPY config.toml /home/perplexica/ to copy this file.
  2. Remove the - ./config.toml:/home/perplexica/config.toml from the docker-compose.yaml file.

Screenshots

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions