-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I've been tinkering with the server to make my apps compatible, and I wasn't able to make it work out of the box but I'll share what I got working. I know many of the things I'll mention are known bugs or missing features, we can reference them or open new issues, and close this one afterwards.
I tested the server using this app: noeldemartin/ramen. You can use it in your local environment if you want to reproduce the problems I'll mention.
So here's what I did.
First I launched PSS by cloning this repo and running the following command:
export PORT=8000 && \
docker run \
--env "PORT=${PORT}" \
--expose "${PORT}" \
--network host \
--rm \
--volume "$PWD:/app" \
--workdir /app/ \
-it \
php:7.3 \
sh -lInside the docker container shell, I installed composer and git and then I run composer install and composer serve-dev (keep in mind that I had some modifications that I've added in this PR).
Once this was up and running, I started encountering some problems that I hot-fixed along the way. None of them are actual fixes, more like hard-coding things to work in my environment. That's why I won't open a PR with that, but I'll explain what those are:
- Multiple CORS errors. I think this is already a known problem because I've seen a TODO mentioning it.
- DPoP JWK validation failed, inside of
pdsinterop/solid-auth. First this failed because the $alg variable was "ES256" (instead of "RS256"), and then here I got an exception saying "This JWK cannot be converted to PEM format". - Websocket notifications failed, inside of
pdsinterop/solid-crud. In this line, I got an exception saying "Connection to 'ws://localhost/' failed: Server sent invalid upgrade". - In authenticated requests, I got an error saying "Invalid token". This is probably because I commented out a lot of the errors I've mentioned in the 2nd point.
- When I created a container, it was actually created like a turtle file, not a folder. After manually creating a folder it works for the most part, but I wasn't able to add properties to the container in a
.metadocument. - Using PATCH in an existing document returns an error. I think this is because I was using
<>and there's a FIXME mentioning that it isn't supported. - Using PATCH to create a new document works but the document is empty. I think this is because in the PATCH body I am refering the document as
http://localhost:8008/storage/container/document#itbut after writing the contents of the document manually they are returned ashttps://localhost/storage/container/container#itinstead. Notice that it's using https:// and doesn't include the port, I'm not sure if this is something I didn't configure correctly or a bug, but I was using the server with http:// and the port from the browser.
And that's how far I got, after doing some of the fixes I mentioned my app is able to log in and read the documents :D. Containers and files are created, but I had to make some manual fixes as I've mentioned.
If you don't want or can't run my app, here's a summary of what it's doing (with simplified requests):
- Logs in using @inrupt/solid-authn-client-browser.
- Reads the profile to get
pim:storageandsolid:privateTypeIndex. - Finds a container of
schema:Recipedeclared in the type index and a recipe with "ramen" in the title. - If the container does not exist, users can create it triggering a request similar to this:
curl 'http://localhost:8000/storage/' -i \ # obtained from pim:storage
-H 'Slug: my-container' \
-H 'Content-Type: text/turtle' \
-H 'Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel="type"' \
--data '<> <http://www.w3.org/2000/01/rdf-schema#label> "My Container" .'And then the type index is updated like this:
curl 'http://localhost:8000/storage/settings/privateTypeIndex.ttl' -X PATCH \ # obtained from solid:privateTypeIndex
-H 'Content-Type: application/sparql-update' \
--data-raw $'INSERT DATA { <http://localhost:8000/storage/settings/privateTypeIndex.ttl#9507329f-a9a5-4e56-8b13-ee83cfe5fdc3> a <http://www.w3.org/ns/solid/terms#TypeRegistration> .\n<http://localhost:8000/storage/settings/privateTypeIndex.ttl#9507329f-a9a5-4e56-8b13-ee83cfe5fdc3> <http://www.w3.org/ns/solid/terms#forClass> <https://schema.org/Recipe> .\n<http://localhost:8000/storage/settings/privateTypeIndex.ttl#9507329f-a9a5-4e56-8b13-ee83cfe5fdc3> <http://www.w3.org/ns/solid/terms#instanceContainer> <http://localhost:8000/storage/container/> . }'- If the recipe does not exist, users can create it triggering a request similar to this:
curl 'http://localhost:8000/storage/container/document' -X PATCH \
-H 'Content-Type: application/sparql-update' \
--data-raw $'INSERT DATA { <http://localhost:8000/storage/container/document#it> a <https://schema.org/Recipe> . }'I hope this is helpful! And thanks for working on this, it's great to see a php Solid server :).
As I mentioned, once these problems are tracked elsewhere I think we can close this one. There's also some things I may be doing wrong on my part, let me know if something doesn't look right.