Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rohittanwar opened this issue Feb 22, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@rohittanwar
Copy link

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.

@rohittanwar rohittanwar added the bug Something isn't working label Feb 22, 2025
@ItzCrazyKns
Copy link
Owner

I think you probably didn't configure config.toml when you first ran the container because Docker can also mount files as a single file volume (and not a directory), copying it directly into the container will make it so it cannot be edited manually from outside the container (except for certain parameters that can be edited with the settings menu)

@moshotande
Copy link

I'm getting the same error. I have configured config.toml prior to composing the docker containers

[GENERAL]
PORT = 3001 # Port to run the server on
SIMILARITY_MEASURE = "cosine" # "cosine" or "dot"
KEEP_ALIVE = "5m" # How long to keep Ollama models loaded into memory. (Instead of using -1 use "-1m")

[MODELS.OPENAI]
API_KEY = "MY_KEY"

[API_ENDPOINTS]
SEARXNG = "http://localhost:32768" # SearxNG API URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants