Skip to content

Commit

Permalink
fix: pod url construction when not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximvdw committed Dec 5, 2024
2 parents 84ebd07 + 5423dfc commit 3953069
Show file tree
Hide file tree
Showing 16 changed files with 226 additions and 1,377 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage/
artifacts/
.nyc_output/
test-results.xml
.env
.env
src/**/engine-default.js
39 changes: 39 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
networks:
dht-network:
driver: bridge

x-solid-server: &solid-server
build:
context: docker
dockerfile: Dockerfile
networks:
- dht-network

services:
test-server1:
<<: *solid-server
environment:
- [email protected]
- USER_POD=test1
- USER_PASSWORD=test123
- BASE_URL=http://localhost:3000
ports:
- 3000:3000
test-server2:
<<: *solid-server
environment:
- [email protected]
- USER_POD=test2
- USER_PASSWORD=test123
- BASE_URL=http://localhost:3001
ports:
- 3001:3000
test-server3:
<<: *solid-server
environment:
- [email protected]
- USER_POD=test3
- USER_PASSWORD=test123
- BASE_URL=http://localhost:3002
ports:
- 3002:3000
13 changes: 13 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM solidproject/community-server
RUN npm install mashlib

WORKDIR /community-server

# Copy configuration
COPY ./config/config.json /config/config.json

# Copy entrypoint
COPY ./entrypoint.sh /community-server/entrypoint.sh
RUN chmod +x ./entrypoint.sh

ENTRYPOINT ["sh", "./entrypoint.sh"]
89 changes: 89 additions & 0 deletions docker/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld",
"import": [
"css:config/app/init/static-root.json",
"css:config/app/main/default.json",
"css:config/app/variables/default.json",
"css:config/http/handler/default.json",
"css:config/http/middleware/default.json",
"css:config/http/notifications/all.json",
"css:config/http/server-factory/http.json",
"css:config/http/static/default.json",
"css:config/identity/access/public.json",
"css:config/identity/email/default.json",
"css:config/identity/handler/default.json",
"css:config/identity/oidc/default.json",
"css:config/identity/ownership/token.json",
"css:config/identity/pod/static.json",
"css:config/ldp/authentication/dpop-bearer.json",
"css:config/ldp/authorization/webacl.json",
"css:config/ldp/handler/default.json",
"css:config/ldp/metadata-parser/default.json",
"css:config/ldp/metadata-writer/default.json",
"css:config/ldp/modes/default.json",
"css:config/storage/backend/file.json",
"css:config/storage/key-value/resource-store.json",
"css:config/storage/location/pod.json",
"css:config/storage/middleware/default.json",
"css:config/util/auxiliary/acl.json",
"css:config/util/identifiers/suffix.json",
"css:config/util/index/example.json",
"css:config/util/logging/winston.json",
"css:config/util/representation-conversion/default.json",
"css:config/util/resource-locker/file.json",
"css:config/util/variables/default.json"
],
"@graph": [
{
"comment": "An example of how the UI converter can be configured.",
"@type": "Override",
"overrideInstance": {
"@id": "urn:solid-server:default:DefaultUiConverter"
},
"overrideParameters": {
"@type": "ConstantConverter",
"contentType": "text/html",
"filePath": "./node_modules/mashlib/dist/databrowser.html",
"options_container": true,
"options_document": false,
"options_minQuality": 1
}
},
{
"comment": "Serve Databrowser as default representation",
"@id": "urn:solid-server:default:DefaultUiConverter",
"@type": "ConstantConverter",
"contentType": "text/html",
"filePath": "./node_modules/mashlib/dist/databrowser.html",
"options_container": true,
"options_document": true,
"options_minQuality": 1,
"options_disabledMediaRanges": [
"image/*",
"application/pdf"
]
},
{
"comment": "Serve Mashlib static files.",
"@id": "urn:solid-server:default:StaticAssetHandler",
"@type": "StaticAssetHandler",
"assets": [
{
"@type": "StaticAssetEntry",
"relativeUrl": "/mash.css",
"filePath": "./node_modules/mashlib/dist/mash.css"
},
{
"@type": "StaticAssetEntry",
"relativeUrl": "/mashlib.min.js",
"filePath": "./node_modules/mashlib/dist/mashlib.min.js"
},
{
"@type": "StaticAssetEntry",
"relativeUrl": "/mashlib.min.js.map",
"filePath": "./node_modules/mashlib/dist/mashlib.min.js.map"
}
]
}
]
}
16 changes: 16 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Get the user email and user password from env
USER_EMAIL=${USER_EMAIL:-""}
USER_PASSWORD=${USER_PASSWORD:-""}
USER_POD=${USER_POD:-"pod1"}

BASE_URL=${BASE_URL:-"http://localhost:3000"}

# Create a json file with the user email and password
echo "Creating user file"
echo "[{\"email\":\"${USER_EMAIL}\",\"password\":\"${USER_PASSWORD}\",\"pods\":[{\"name\":\"${USER_POD}\"}]}]" > /config/users.json

# Start solid server
echo "Starting Solid server"
node bin/server.js -c /config/config.json -f /data --baseUrl ${BASE_URL} --seedConfig /config/users.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openhps/solid",
"version": "0.2.8",
"version": "0.2.11",
"description": "Open Hybrid Positioning System",
"author": "Maxim Van de Wynckel",
"license": "Apache-2.0",
Expand Down
6 changes: 5 additions & 1 deletion src/common/SolidPropertyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export class SolidPropertyService extends DataService<string, any> {
this.filter = filter ?? defaultFilter;
}

get session(): SolidSession {
return this.service.session;
}

set service(service: SolidService) {
this.driver.service = service;
}
Expand Down Expand Up @@ -250,7 +254,7 @@ export class SolidPropertyService extends DataService<string, any> {
}`,
undefined,
{
sources: [meta],
sources: [store, meta],
},
);
if (bindings.length === 0) {
Expand Down
Loading

0 comments on commit 3953069

Please sign in to comment.