Skip to content

Commit

Permalink
Merge pull request #1 from digirati-co-uk/feature/search
Browse files Browse the repository at this point in the history
Search
  • Loading branch information
sammeltassen authored Jul 4, 2024
2 parents f2dc6c3 + 9d0f4ca commit 0330085
Show file tree
Hide file tree
Showing 1,396 changed files with 315,915 additions and 358,365 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build and Deploy (production)

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup bun.sh environment
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Cache buns dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Run bun install
run: bun install --frozen-lockfile

- name: Cache .iiif/cache
uses: actions/cache@v4
with:
path: apps/iiif/.iiif/cache
key: ${{ runner.os }}-iiif-cache-${{ hashFiles('apps/iiif/.iiifrc.yml') }}
restore-keys: |
${{ runner.os }}-iiif-cache-
- name: Cache Next.js build cache
uses: actions/cache@v4
with:
path: apps/static-site/.next/cache
key: ${{ runner.os }}-iiif-cache-${{ hashFiles('**/bun.lockb') }}--${{ hashFiles('app/static-site/src/**/*.ts', 'app/static-site/src/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-iiif-cache-${{ hashFiles('**/bun.lockb') }}
- name: IIIF Netlify deploy (production)
id: netlify_iiif
working-directory: apps/iiif
run: |
deploy_json=$(netlify deploy \
--build \
--prod \
--json \
--filter=iiif \
--message="Deploy from GitHub Actions")
preview_url=$(echo $deploy_json | jq -r '.deploy_url')
echo "preview_url=$preview_url" >> $GITHUB_OUTPUT
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_IIIF_SITE_ID }}
IIIF_PREVIEW_URL: https://delft-iiif.netlify.app

- name: Static site Netlify deploy (production)
id: netlify_static_site
working-directory: apps/static-site
run: |
deploy_json=$(netlify deploy \
--build \
--json \
--prod \
--filter=static-site \
--message="Deploy from GitHub Actions")
preview_url=$(echo $deploy_json | jq -r '.deploy_url')
echo "preview_url=$preview_url" >> $GITHUB_OUTPUT
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# This is a search-only API key (public)
NEXT_PUBLIC_IIIF_URL: https://delft-iiif.netlify.app
NEXT_PUBLIC_TYPESENSE_API_KEY: 8EOitKCMTbxUKPZNqUEoQS9M2RGvpkZS
NEXT_PUBLIC_TYPESENSE_HOST: 63flhve71t2un5xgp.a1.typesense.net
NEXT_PUBLIC_TYPESENSE_PORT: 443
NEXT_PUBLIC_TYPESENSE_PROTOCOL: https
NEXT_PUBLIC_TYPESENSE_COLLECTION_NAME: production-manifests

- name: Build IIIF Search
working-directory: apps/static-site
run: |
bun run ./typesense-update.ts
env:
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_ADMIN_API_KEY }}
TYPESENSE_HOST: 63flhve71t2un5xgp.a1.typesense.net
TYPESENSE_PORT: 443
TYPESENSE_PROTOCOL: https
TYPESENSE_COLLECTION_NAME: production-manifests
118 changes: 118 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Build and Deploy Static Site Preview

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup bun.sh environment
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Cache buns dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Run bun install
run: bun install --frozen-lockfile

- name: Cache .iiif/cache
uses: actions/cache@v4
with:
path: apps/iiif/.iiif/cache
key: ${{ runner.os }}-iiif-cache-${{ hashFiles('apps/iiif/.iiifrc.yml') }}
restore-keys: |
${{ runner.os }}-iiif-cache-
- name: Cache Next.js build cache
uses: actions/cache@v4
with:
path: apps/static-site/.next/cache
key: ${{ runner.os }}-iiif-cache-${{ hashFiles('**/bun.lockb') }}--${{ hashFiles('app/static-site/src/**/*.ts', 'app/static-site/src/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-iiif-cache-${{ hashFiles('**/bun.lockb') }}
- name: IIIF Netlify deploy (preview)
id: netlify_iiif
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-preview'))
working-directory: apps/iiif
run: |
deploy_json=$(netlify deploy \
--build \
--alias=deploy-preview-${{ github.event.number }} \
--json \
--filter=iiif \
--message="Deploy preview from GitHub Actions")
preview_url=$(echo $deploy_json | jq -r '.deploy_url')
echo "preview_url=$preview_url" >> $GITHUB_OUTPUT
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_IIIF_SITE_ID }}
IIIF_PREVIEW_URL: https://deploy-preview-${{ github.event.number }}--delft-iiif.netlify.app

- name: Static site Netlify deploy (preview)
id: netlify_static_site
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-preview'))
working-directory: apps/static-site
run: |
deploy_json=$(netlify deploy \
--build \
--alias=deploy-preview-${{ github.event.number }} \
--json \
--filter=static-site \
--message="Deploy preview from GitHub Actions")
preview_url=$(echo $deploy_json | jq -r '.deploy_url')
echo "preview_url=$preview_url" >> $GITHUB_OUTPUT
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# This is a search-only API key (public)
NEXT_PUBLIC_IIIF_URL: https://deploy-preview-${{ github.event.number }}--delft-iiif.netlify.app
NEXT_PUBLIC_TYPESENSE_API_KEY: 8EOitKCMTbxUKPZNqUEoQS9M2RGvpkZS
NEXT_PUBLIC_TYPESENSE_HOST: 63flhve71t2un5xgp.a1.typesense.net
NEXT_PUBLIC_TYPESENSE_PORT: 443
NEXT_PUBLIC_TYPESENSE_PROTOCOL: https
NEXT_PUBLIC_TYPESENSE_COLLECTION_NAME: preview-manifests

- name: Build IIIF Search
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-preview'))
working-directory: apps/static-site
run: |
bun run ./typesense-update.ts --recreate-index
env:
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_ADMIN_API_KEY }}
TYPESENSE_HOST: 63flhve71t2un5xgp.a1.typesense.net
TYPESENSE_PORT: 443
TYPESENSE_PROTOCOL: https
TYPESENSE_COLLECTION_NAME: preview-manifests

- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Netlify output

- name: Create or update comment
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-preview'))
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Netlify output
Static site (preview): ${{ steps.netlify_static_site.outputs.preview_url }}
IIIF (preview): ${{ steps.netlify_iiif.outputs.preview_url }}
edit-mode: replace
54 changes: 54 additions & 0 deletions .github/workflows/update-search.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Update Search Index

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup bun.sh environment
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Cache buns dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Run bun install
run: bun install --frozen-lockfile

- name: Cache .iiif/cache
uses: actions/cache@v4
with:
path: apps/iiif/.iiif/cache
key: ${{ runner.os }}-iiif-cache-${{ hashFiles('apps/iiif/.iiifrc.yml') }}
restore-keys: |
${{ runner.os }}-iiif-cache-
- name: Deploy to Search Index
run: |
bun run build --filter=iiif
- name: Build IIIF Search
working-directory: apps/static-site
run: |
bun run ./typesense-update.ts --recreate-index
env:
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_ADMIN_API_KEY }}
TYPESENSE_URL: 63flhve71t2un5xgp.a1.typesense.net
TYPESENSE_PORT: 443
TYPESENSE_PROTOCOL: https
TYPESENSE_COLLECTION_NAME: production-manifests
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ yarn-error.log*
# Misc
.DS_Store
*.pem

# Local Netlify folder
.netlify
2 changes: 2 additions & 0 deletions apps/iiif/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.iiif
build
49 changes: 28 additions & 21 deletions apps/static-site/.iiifrc.yml → apps/iiif/.iiifrc-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,16 @@ run:
- extract-thumbnail
- manifest-sqlite
- metadata-analysis
- folder-collections
- site-collections
- delft-image-source
- typesense-manifests

stores:
manifests:
collective-access:
type: iiif-json
path: ./iiif/manifests
pattern: "**/*.json"

libis-objects:
type: iiif-json
path: ./iiif/libis/objects
path: ./manifests/collective-access
destination: manifests
pattern: "**/*.json"
pattern: "**/*.{json,yaml,yml}"
run:
- extract-topics
- delft-related
Expand All @@ -37,23 +31,36 @@ stores:
topicTypes:
material: ["Materiaal", "Material"]
date: ["Date", "Datering"]
Maker: ["Maker"]
Publisher: ["Publisher"]
contributor: ["Maker"]
format: ["Objectnaam"]

libis-collections:
dlcs:
type: iiif-json
path: ./iiif/libis/collections
destination: collections
pattern: "**/*.json"
path: ./manifests/dlcs
destination: manifests
pattern: "**/*.{json,yaml,yml}"
run:
- extract-topics
- folder-collections
config:
extract-topics:
topicTypes:
date: ["Year"]
format: ["Format"]
contributor: ["Contributor", "Contributors"]

delta-archief:
manifest-editor:
type: iiif-json
path: ./iiif/delta-archief
path: ./manifests/manifest-editor
destination: manifests
pattern: "**/*.json"
pattern: "**/*.{json,yaml,yml}"
run:
- folder-collections

map-series:
projects:
type: iiif-json
path: ./iiif/map-series
path: ./manifests/projects
destination: manifests
pattern: "**/*.json"
pattern: "**/*.{json,yaml,yml}"
run:
- folder-collections
1 change: 1 addition & 0 deletions apps/iiif/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Deploy to Typesense.
8 changes: 8 additions & 0 deletions apps/iiif/iiif.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { env } from "node:process";
export * from "./.iiifrc-base.yml";

const url = env["IIIF_PREVIEW_URL"] || env["IIIF_URL"] || "http://localhost:3000";

export const server = {
url,
};
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@
"type": "Image"
}],
"id": "https://raw.githubusercontent.com/libis/ca_tudelft_iiif/main/objects/adf7c898-8e4a-4774-807b-e37b9f506fc9.json",
"label": {"nl": ["Portret van prof. A.E. Korvezee"]},
"label": {"nl": ["Portret van prof. A.E. Korvezee door A. Kaat"]},
"type": "Manifest"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
},
{
"label": "Beschrijving",
"value": "Het Gouden Kalf (door de hoge aanschafprijs) door Felix Andries Vening Meinesz (1887-1966), hoogleraar geodesie van 1939 tot 1957. Dit instrument is gemonteerd geweest in de onderzeeboot K2 (1923), de K13 (1926) en de O2 (1937). Met het slingerinstrument werd de zwaartekracht op de oceanen gemeten. De werking berust op het principe dat een slinger sneller gaat slingeren naarmate de zwaartekracht toeneemt. Het instrument is gebouwd omstreeks 1920 en voor het laatst gebruikt in de Caribische Zee in 1957. Zie ook GEO 2004.0002.GEO. Los bij dit instrument is een kast met de fotografische registratie van de slingerbeweging. De bijbehorende tijdregistratie systeem van de Nederlandsche Seintoestellen Fabriek (Hilversum) is niet aanwezig. Voor meetresultaten zie inventarisnummers 2000.0900.GEO, 2007.0182.GEO en 2007.0183.GEO.<\/br>"
"value": "\"Het Gouden Kalf\" door Felix Andries Vening Meinesz (1887-1966), hoogleraar geodesie van 1939 tot 1957. Dit instrument is gemonteerd geweest in de onderzeeboot K2 (1923), de K13 (1926) en de O2 (1937). Met het slingerinstrument werd de zwaartekracht op de oceanen gemeten. De werking berust op het principe dat een slinger sneller gaat slingeren naarmate de zwaartekracht toeneemt. Het instrument is gebouwd omstreeks 1920 en voor het laatst gebruikt in de Caribische Zee in 1957. Zie ook GEO 2004.0002.GEO. Los bij dit instrument is een kast met de fotografische registratie van de slingerbeweging. De bijbehorende tijdregistratie systeem van de Nederlandsche Seintoestellen Fabriek (Hilversum) is niet aanwezig. Voor meetresultaten zie inventarisnummers 2000.0900.GEO, 2007.0182.GEO en 2007.0183.GEO.<\/br>"
},
{
"label": "Documentatie",
"value": "zie NCG publicaties de film en de koffer 2000900."
},
{
"label": "Gerelateerd erfgoedobject",
"value": "Slinger met bijbehorende houten kist;Koffer met logboeken, aantekenboeken en papieren door prof. F.A. Vening Meinesz en ir. E.A.J.H. Modderman;Archief met aantekenboek door prof. F.A. Vening Meinesz en E.A.J.H. Modderman;Meetrollen van zwaartekrachtmetingen door prof. F.A. Vening Meinesz, E.A.J.H. Modderman, W. Nieuwenkamp en B. Villinger (GEO.2004.0002;GEO.2000.0900;GEO.2007.0182;GEO.2007.0183)"
"value": "Slinger met bijbehorende houten kist;Koffer met logboeken, aantekenboeken en papieren door prof. F.A. Vening Meinesz en ir. E.A.J.H. Modderman;Archief met aantekenboek door prof. F.A. Vening Meinesz en E.A.J.H. Modderman;Meetrollen van zwaartekrachtmetingen door prof. F.A. Vening Meinesz, E.A.J.H. Modderman, W. Nieuwenkamp en B. Villinger;Zeegravimeter door Askania type Gss-2 (GEO.2004.0002;GEO.2000.0900;GEO.2007.0182;GEO.2007.0183;GEO.2023.0003)"
}
],
"@type": "sc:Manifest",
Expand Down
Loading

0 comments on commit 0330085

Please sign in to comment.