Skip to content

Commit 8027202

Browse files
Merge pull request #16 from eScienceLab/development
Update portal with branding
2 parents 20aad71 + af5f30f commit 8027202

File tree

30 files changed

+3139
-1
lines changed

30 files changed

+3139
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
docker_address="http://host.docker.internal:3030/rocrate/sparql"
3+
local_address="http://localhost:3030/rocrate/sparql"
4+
server_address="https://query.ro-crate.org/rocrate/sparql"
5+
6+
files=( "src/configs/rocrate/search_perspectives/profiles.json"
7+
"src/configs/portalConfig.json" )
8+
9+
10+
for file in ${files[@]}; do
11+
sed -e "s|${docker_address}|${server_address}|g" \
12+
-e "s|${local_address}|${server_address}|g" ${file} > ${file}.temp
13+
mv ${file}.temp $file
14+
done

.docker/fuseki/config.ttl

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
2+
3+
## Fuseki Server configuration file.
4+
5+
@prefix : <#> .
6+
@prefix fuseki: <http://jena.apache.org/fuseki#> .
7+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
8+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
9+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
10+
@prefix tdb2: <http://jena.apache.org/2016/tdb#> .
11+
@prefix text: <http://jena.apache.org/text#> .
12+
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
13+
@prefix crm: <http://www.cidoc-crm.org/cidoc-crm/> .
14+
@prefix ns11: <http://schema.org/> .
15+
16+
[] rdf:type fuseki:Server ;
17+
# Example::
18+
# Server-wide query timeout.
19+
#
20+
# Timeout - server-wide default: milliseconds.
21+
# Format 1: "1000" -- 1 second timeout
22+
# Format 2: "10000,60000" -- 10s timeout to first result,
23+
# then 60s timeout for the rest of query.
24+
#
25+
# See javadoc for ARQ.queryTimeout for details.
26+
# This can also be set on a per dataset basis in the dataset assembler.
27+
#
28+
# ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "30000" ] ;
29+
30+
# Add any custom classes you want to load.
31+
# Must have a "public static void init()" method.
32+
# ja:loadClass "your.code.Class" ;
33+
34+
fuseki:services (
35+
[ rdf:type fuseki:Service ;
36+
fuseki:name "rocrate" ;
37+
fuseki:serviceQuery "sparql" ;
38+
fuseki:serviceUpdate "update" ;
39+
fuseki:serviceUpload "upload" ;
40+
fuseki:serviceReadWriteGraphStore "data" ;
41+
fuseki:dataset :text_dataset ;
42+
]
43+
)
44+
45+
# End triples.
46+
.
47+
48+
## RO-Crate
49+
50+
:text_dataset rdf:type text:TextDataset ;
51+
text:dataset :tdb_dataset ;
52+
text:index <#indexLucene> ;
53+
.
54+
55+
:tdb_dataset rdf:type tdb2:DatasetTDB2 ;
56+
tdb2:location "/fuseki/databases/rocrate" ;
57+
tdb2:unionDefaultGraph false ; # true: default graph becomes a union of all named graphs
58+
.
59+
60+
<#indexLucene> a text:TextIndexLucene ;
61+
text:directory <file:/fuseki/run/databases/rocrate_index> ;
62+
text:entityMap <#entMap> ;
63+
.
64+
65+
<#entMap> a text:EntityMap ;
66+
text:defaultField "text" ;
67+
text:entityField "uri" ;
68+
text:map (
69+
[ text:field "text" ; text:predicate rdfs:label ]
70+
[ text:field "text" ; text:predicate skos:prefLabel ]
71+
[ text:field "text" ; text:predicate ns11:name ]
72+
)
73+
.

.docker/sampo-ui/deploy.dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM node:16.13.0-alpine
2+
ARG API_URL
3+
ARG VERSION="3.0.0"
4+
5+
# Based on https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
6+
7+
# Create app directory
8+
WORKDIR /usr/src/app
9+
10+
# Download Sampo UI from GitHub and unzip
11+
# mv commands: install app dependencies, Babel 7 presets and plugins, and bundle app source
12+
# Remove redundant files
13+
RUN <<EOF
14+
wget https://github.com/SemanticComputing/sampo-ui/archive/refs/tags/v$VERSION.zip
15+
unzip v$VERSION.zip
16+
mv ./sampo-ui-$VERSION/package*.json ./
17+
mv ./sampo-ui-$VERSION/webpack*.js ./
18+
mv ./sampo-ui-$VERSION/babel.config.js ./
19+
mv ./sampo-ui-$VERSION/src ./src
20+
rm -rf sampo-ui-$VERSION v$VERSION.zip
21+
EOF
22+
23+
COPY ./src ./src
24+
25+
# Run the scripts defined in package.json using build arguments
26+
RUN npm install && \
27+
API_URL=$API_URL npm run build
28+
29+
EXPOSE 3001
30+
31+
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
32+
USER node
33+
34+
# Express server handles the backend functionality and also serves the React app
35+
CMD ["node", "/usr/src/app/dist/server"]

.docker/sampo-ui/dev.dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM node:16.13.0-alpine
2+
3+
# Specify the Sampo UI version
4+
ARG VERSION="3.0.0"
5+
6+
RUN apk update && apk add bash
7+
8+
# Create app directory
9+
WORKDIR /usr/src/app
10+
11+
# Download Sampo UI from GitHub and unzip
12+
# mv commands: install app dependencies, Babel 7 presets and plugins, and bundle app source
13+
# Remove redundant files
14+
RUN <<EOF
15+
wget https://github.com/SemanticComputing/sampo-ui/archive/refs/tags/v$VERSION.zip
16+
unzip v$VERSION.zip
17+
mv ./sampo-ui-$VERSION/package*.json ./
18+
mv ./sampo-ui-$VERSION/webpack*.js ./
19+
mv ./sampo-ui-$VERSION/babel.config.js ./
20+
mv ./sampo-ui-$VERSION/src ./src
21+
rm -rf sampo-ui-$VERSION v$VERSION.zip
22+
EOF
23+
24+
# Run the scripts defined in package.json using build arguments
25+
RUN npm install
26+
27+
# Install nodemon
28+
RUN npm install -g nodemon
29+
30+
EXPOSE 8080 3001
31+
32+
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
33+
USER node
34+
35+
# Run dev server
36+
CMD ["npm", "run", "dev"]

.github/workflows/deploy.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy to Remote (Self-Hosted)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
deploy:
12+
name: Docker Compose Up
13+
runs-on: self-hosted
14+
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v3
18+
19+
- name: Change domain paths
20+
run: bash .docker/deployment/domain_change.sh
21+
22+
- name: Generate .env from template
23+
env:
24+
ENV_FUSEKI_PASSWORD: ${{ secrets.ENV_FUSEKI_PASSWORD }}
25+
ENV_SAMPO_API_URL: ${{ vars.ENV_SAMPO_API_URL }}
26+
run: |
27+
envsubst < env.template > .env
28+
29+
30+
- name: Clean up Docker compose
31+
run: |
32+
docker compose -f docker-compose.deploy.yml down
33+
34+
- name: Deploy with Docker Compose
35+
run: |
36+
docker compose -f docker-compose.deploy.yml pull
37+
docker compose -f docker-compose.deploy.yml up -d --build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Environments
2+
.env

CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@AnnieZQH
2+
@OliverWoolland
3+
@elichad
4+
@stain

Caddyfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
profiles.ro-crate.org {
2+
reverse_proxy sampo-dashboard:3001
3+
}
4+
5+
query.ro-crate.org {
6+
reverse_proxy jena-fuseki:3030
7+
}

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,47 @@
1-
# sampo-dashboard
1+
# RO-Crate Profile Portal
2+
3+
## About
4+
5+
RO-Crates are a method for packaging research data with their metadata. RO-Crate Profiles define the conventions, types and properties to do this for specific communities and domains.
6+
7+
## Submitting a profile to the portal
8+
9+
The profile portal is accepting contributions!
10+
11+
> [!IMPORTANT]
12+
> To be accepted, the profile must be a [Profile Crate](url) accessible on the public internet.
13+
14+
To add your profile (or a profile you feel is missing):
15+
- Open `scripts/profile_urls.txt` in this repo for editing (click file, then click pencil icon)
16+
- Append the URL of your profile to the file on a new line
17+
- Click `Commit Changes` and select `Create a new branch for this commit and start a pull request`
18+
- In the `Open a pull request window`, click `Create pull request` - the RO-Crate team will now be notified about your request
19+
- When the pull request page has opened, you will notice some automated checks running
20+
- :white_check_mark: If successful: all good, the team will review and merge your request
21+
- :x: If the check fails: there is an error or problem with your URL, either click the link to view the error message and debug or [raise a ticket for the RO-Crate team here](https://github.com/eScienceLab/sampo-dashboard/issues)
22+
23+
## Development Setup
24+
25+
### 1. Clone the repository
26+
27+
To clone the [repository](https://github.com/eScienceLab/sampo-dashboard), click `<> Code` above the list of files on the GitHub page of this repo, and copy the URL under your choice of clone method (HTTPS / SSH Key / GitHub CLI).
28+
29+
In the CLI: \
30+
`git clone <URL>`
31+
32+
Change into the project directory for the following steps: \
33+
`cd sampo-dashboard`
34+
35+
### 2. Configure .env
36+
37+
Make a copy of `env.template`, rename it to `.env` and populate the variables.
38+
39+
### 3. Build Docker images and start containers
40+
41+
The following command builds the development Docker images (`--build`) before starting containers in detached mode (`-d`).
42+
43+
`docker compose -f docker-compose.dev.yml up -d --build`
44+
45+
### 4. Stop and remove containers and networks
46+
47+
`docker compose -f docker-compose.dev.yml down`

docker-compose.deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
services:
2+
caddy:
3+
image: caddy:2.10
4+
container_name: caddy
5+
restart: unless-stopped
6+
ports:
7+
- 80:80
8+
- 443:443
9+
volumes:
10+
- ./Caddyfile:/etc/caddy/Caddyfile:ro
11+
- caddy-config:/config
12+
networks:
13+
- web-network
14+
15+
sampo-dashboard:
16+
container_name: rocrate-sampo-dashboard
17+
build:
18+
context: .
19+
dockerfile: .docker/sampo-ui/deploy.dockerfile
20+
args:
21+
API_URL: ${SAMPO_API_URL}
22+
# image: ghcr.io/esciencelab/sampo-dashboard
23+
# platform: ${DOCKER_DEFAULT_PLATFORM:-linux/x86_64}
24+
restart: unless-stopped
25+
tty: true
26+
networks:
27+
- web-network
28+
ports:
29+
- "3006:3001"
30+
volumes:
31+
- node_modules:/usr/src/app/node_modules/
32+
33+
jena-fuseki:
34+
container_name: rocrate-jena-fuseki
35+
image: stain/jena-fuseki
36+
platform: ${DOCKER_DEFAULT_PLATFORM:-linux/x86_64}
37+
restart: unless-stopped
38+
tty: true
39+
networks:
40+
- web-network
41+
ports:
42+
- "3030:3030"
43+
volumes:
44+
- jena-fuseki-data:/fuseki
45+
- ./.docker/fuseki/config.ttl:/fuseki/config.ttl
46+
environment:
47+
ADMIN_PASSWORD: ${FUSEKI_PASSWORD}
48+
49+
networks:
50+
web-network:
51+
name: rocrate-web-network
52+
53+
volumes:
54+
jena-fuseki-data:
55+
name: rocrate-data
56+
node_modules:
57+
name: rocrate-node_modules
58+
caddy-config:

0 commit comments

Comments
 (0)