Skip to content

Commit

Permalink
package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Forberg committed May 15, 2024
1 parent 4746dc7 commit 729944f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 33 deletions.
39 changes: 22 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
FROM ubuntu:22.04
FROM node:18 AS installer

COPY ./server/package.json ./server/package-lock.json /server/
COPY ./public/package.json ./public/package-lock.json /public/

# Set up the NPM projects:
RUN cd /server && \
npm install && \
cd ../public && \
npm install


FROM ubuntu:22.04 AS release

COPY --from=installer /server/node_modules /databus/server/node_modules
COPY --from=installer /public/node_modules /databus/public/node_modules

# Install node.js, Caddy as proxy server, and java.
RUN apt-get update && \
apt-get -y install curl debian-keyring debian-archive-keyring apt-transport-https && \
apt-get -y install curl wget systemctl debian-keyring debian-archive-keyring apt-transport-https && \
wget https://github.com/caddyserver/caddy/releases/download/v2.7.6/caddy_2.7.6_linux_amd64.deb && \
dpkg -i ./caddy_2.7.6_linux_amd64.deb && \
caddy version && \
systemctl daemon-reload && systemctl enable --now caddy && \
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg && \
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list && \
apt-get update && \
apt-get -y install \
nodejs \
caddy \
ca-certificates-java \
openjdk-17-jdk \
openjdk-17-jre && \
Expand Down Expand Up @@ -39,18 +55,7 @@ ENV DATABUS_PROXY_SERVER_HOSTNAME="my-databus.org"
# Define the volume for the TLS certificate:
VOLUME /tls

COPY ./server /databus/server
COPY ./public /databus/public
COPY ./search /databus/search
COPY ./model/generated /databus/model/generated

COPY ./setup.sh /databus/setup.sh

# Set up the NPM projects:
RUN cd /databus/server && \
npm install && \
cd ../public && \
npm install
COPY . /databus

WORKDIR /databus
ENTRYPOINT [ "/bin/bash", "./setup.sh" ]
20 changes: 11 additions & 9 deletions server/app/api/lib/dataid-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const ArrayUtils = require('../../common/utils/array-utils');
const DatabusUtils = require('../../../../public/js/utils/databus-utils');
const { JSONLD_VALUE } = require('../../../../public/js/utils/databus-uris');
const knownCompressionExtensions = require('../../common/config/compression-extensions.json');
const DatabusConstants = require('../../../../public/js/utils/databus-constants');

var autocompleter = {};

Expand Down Expand Up @@ -52,8 +53,8 @@ function autofillFileIdentifiers(datasetUri, fileGraph) {
segment += `.${compression}`;
}

fileGraph[DatabusUris.DATABUS_FILE] = [];
fileGraph[DatabusUris.DATABUS_FILE].push({ '@id': `${baseUri}/${segment}` });
fileGraph[DatabusUris.DATABUS_FILE] = [{}];
fileGraph[DatabusUris.DATABUS_FILE][0][DatabusUris.JSONLD_ID] = `${baseUri}/${segment}`;
fileGraph[DatabusUris.JSONLD_ID] = `${baseUri}#${segment}`;
}

Expand Down Expand Up @@ -86,10 +87,9 @@ autocompleter.autocomplete = function (expandedGraph, logger) {

if (publisherUri == null) {
versionGraph[DatabusUris.DCT_PUBLISHER] = [{}];
versionGraph[DatabusUris.DCT_PUBLISHER][0][DatabusUris.JSONLD_ID] = `${accountUri}#this`;
versionGraph[DatabusUris.DCT_PUBLISHER][0][DatabusUris.JSONLD_ID] = `${accountUri}${DatabusConstants.WEBID_THIS}`;
}


var timeString = DatabusUtils.timeStringNow();

if (versionGraph[DatabusUris.DCT_ISSUED] == undefined) {
Expand Down Expand Up @@ -199,9 +199,9 @@ autocompleter.autocomplete = function (expandedGraph, logger) {

for (var fileGraph of fileGraphs) {

versionGraph[DatabusUris.DCAT_DISTRIBUTION].push({
'@id': fileGraph[DatabusUris.JSONLD_ID]
});

versionGraph[DatabusUris.DCAT_DISTRIBUTION] = [{}];
versionGraph[DatabusUris.DCAT_DISTRIBUTION][0][DatabusUris.JSONLD_ID] = fileGraph[DatabusUris.JSONLD_ID];

for (var contentVariantProperty of contentVariantProperties) {

Expand All @@ -223,8 +223,10 @@ autocompleter.autocompleteArtifact = function (expandedGraphs) {
var groupUri = UriUtils.navigateUp(artifactUri, 1);
var accountUri = UriUtils.navigateUp(artifactUri, 2);


expandedGraphs.push({ '@id': groupUri, '@type': DatabusUris.DATABUS_GROUP });
var groupGraph = {};
groupGraph[DatabusUris.JSONLD_ID] = groupUri;
groupGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_GROUP;
expandedGraphs.push(groupGraph);

artifactGraph[DatabusUris.DATABUS_GROUP_PROPERTY] = [{}];
artifactGraph[DatabusUris.DATABUS_GROUP_PROPERTY][0][DatabusUris.JSONLD_ID] = groupUri;
Expand Down
4 changes: 0 additions & 4 deletions server/app/common/get-jsonld.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ module.exports = async function getJsonLd(resourceUri, template, formatting) {

var result = JSON.parse(await rp(options));

console.log(formatting);
console.log(process.env.DATABUS_CONTEXT_URL);

if (formatting == undefined || formatting == 'compacted' || formatting == 'compact') {
// Single out jsonld in order to compact the result with the databus context
var result = await jsonld.compact(result, defaultContext);
Expand All @@ -49,7 +46,6 @@ module.exports = async function getJsonLd(resourceUri, template, formatting) {
var result = await jsonld.flatten(result);
}

console.log(result);
return result;
} catch (err) {
console.log(err);
Expand Down
1 change: 0 additions & 1 deletion server/app/pages/modules/resource-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const DatabusCache = require('../../common/cache/databus-cache');
const ServerUtils = require('../../common/utils/server-utils.js');
const Constants = require('../../common/constants');
const UriUtils = require('../../common/utils/uri-utils');
const rp = require('request-promise');
const JsonldUtils = require('../../../../public/js/utils/jsonld-utils');
const DatabusUris = require('../../../../public/js/utils/databus-uris');
const { dataid } = require('../../common/queries/sparql');
Expand Down
5 changes: 3 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
"debug": "~2.6.9",
"ejs": ">=3.1.9",
"express": "^4.16.4",
"express-openid-connect": "^2.4.0",
"express-openid-connect": "^2.17.0",
"express-session": "^1.17.2",
"get-random-values": "^1.2.2",
"glob": "^7.1.7",
"glob-promise": "^4.2.0",
"got": "11.8.2",
"http-errors": "~1.6.3",
"js-sha256": "^0.9.0",
"jsonld": "^8.3.2",
Expand All @@ -34,7 +35,7 @@
"morgan": "~1.9.1",
"node-cache": "^4.2.0",
"node-rsa": "^1.1.1",
"openid-client": "^3.10.0",
"openid-client": "^5.6.5",
"pem-jwk": "^2.0.0",
"rdf-ext": "^1.3.1",
"rdf-parse": "^1.8.0",
Expand Down

0 comments on commit 729944f

Please sign in to comment.