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

"Empty reply from server" creating ledger in introduction #85

Open
SaulMoonves opened this issue Aug 7, 2024 · 2 comments
Open

"Empty reply from server" creating ledger in introduction #85

SaulMoonves opened this issue Aug 7, 2024 · 2 comments

Comments

@SaulMoonves
Copy link

Create:

docker run -d -p 58090:8090 --name fluree --mount type=bind,source=/var/lib/fluree/data,target=/opt/fluree-server/data fluree/server

Command:

curl --location 'http://localhost:58090/fluree/create' --header 'Content-Type: application/json' --data '{
  "ledger": "cryptids",
  "insert": {
    "@id": "my-first-cryptid",
    "name": "Freddy the Yeti"
  }
}'
curl: (52) Empty reply from server

Logs:

10:44:03.907 [async-dispatch-6] INFO  fluree.db.api - Creating ledger "cryptids"
10:44:03.935 [async-thread-macro-1] ERROR fluree.db.util.filesystem - "Unable to create storage directory: /opt/fluree-server/data/cryptids/commit/17cc9fb58069825ab841aae71ea8476699352a60f40448418323e0f7a85c21af.json with error: /opt/fluree-server/data/cryptids/commit/17cc9fb58069825ab841aae71ea8476699352a60f40448418323e0f7a85c21af.json (No such file or directory)."
10:44:03.936 [async-thread-macro-1] ERROR fluree.db.util.filesystem - "Fatal Error, shutting down!"

An attempt to do this with a previous version, as documented in #84 also failed, but in a different way.

@SaulMoonves
Copy link
Author

Following help from the Discord suggesting it was ownership, I changed the permissions on the mounted directory to 777 and tried again and it worked, writing files inside using userid 10001. I have adjusted ownership of the mounted directory to that userid but I am curious if I ran afoul of an unstated assumption in the docs. I did run the create command as root, should I have run it as a different user or something, or otherwise what is the correct way to derive the user for setting the mounted permissions correctly?

I also did use --mount instead of -v maybe that is the difference?

@KartikJha
Copy link

I faced the same issue chmod 777 on the system level directory worked like magic.

Several things that I tried before allowing all users access to the system data directory.

  1. Changed user and group of the data directory to current user and docker respectively, same user group and owner was reflected inside docker shell.

Screenshot from 2024-09-16 14-52-27

  1. Added fluree to the root and sudo user group but that didn't work because of 755 permission group user's are still not allowed full write access.

Alternate solution in-case you don't want to allow 777 access to system files directly

  1. Change the ownership of system directory to current user of sudo group and add the directory to docker group (That's what I did)
sudo chown <sudo_group_current_user>:docker data
  1. Retrieve the containerId
sudo docker container ls
  1. Drop to root shell in the running container
sudo docker exec -it --user root 00fe2bb82a05  /bin/bash
  1. Update the permissions for /opt/fluree-server/data directory to 777

The API should work now without altering system directory permissions.

But the system directory permission altering approach is much faster I guess 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants