Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copy to .env and adjust.

# DSpace backend REST API base (…/server). The backend must have
# handle.remote-resolver.enabled = true.
# - backend on the same host: http://host.docker.internal:8082/server
# - backend reachable by hostname: http://dspace.example.org/server
DSPACE_HANDLE_ENDPOINT=http://host.docker.internal:8082/server

# Host ports to publish (change if they clash with something else).
HANDLE_HTTP_PORT=8000
HANDLE_NATIVE_PORT=2641
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
*.sh eol=lf
*.sh eol=lf
# Handle.Net launcher scripts have NO extension, so `*.sh eol=lf` misses them.
# Force LF or the shebang breaks when the image is built from a Windows clone.
assets/handle-9.3.1/bin/hdl text eol=lf
assets/handle-9.3.1/bin/hdl-* text eol=lf
31 changes: 31 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@

Dockerized https://github.com/DSpace/Remote-Handle-Resolver.

The Handle server runs as a **standalone service** and resolves handles through
the DSpace backend REST API — it does not connect to the database itself:

```
client -> handle-server(:8000) --HTTP /server/resolve--> DSpace backend --> database
```

## Quick start (docker compose)

Clone & run — the container points the resolver plugin at your backend, waits
for it, and starts the Handle server:

```
git clone --recurse-submodules https://github.com/dataquest-dev/docker-handle-server.git
cd docker-handle-server
cp .env.example .env # set DSPACE_HANDLE_ENDPOINT to your backend (…/server)
docker compose up -d
```

Requirements on the backend side:

```
handle.remote-resolver.enabled = true
```

Test a resolve once it is up (use a handle that exists in your repository):

```
curl http://localhost:8000/api/handles/123456789/0
```

## Installation

1. Generate your own configuration by running:
Expand Down
3 changes: 3 additions & 0 deletions assets/config/config.dct
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
)

"server_config" = {
"storage_type" = "CUSTOM"
"storage_class" = "org.dspace.handle.MultiRemoteDSpaceRepositoryHandlePlugin"

"server_admins" = (
"300:0.NA/YOUR_PREFIX"
)
Expand Down
47 changes: 47 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Clone & run: a SEPARATE DSpace Handle server.
#
# git clone --recurse-submodules <this repo>
# cp .env.example .env # set DSPACE_HANDLE_ENDPOINT to your backend
# docker compose up -d
#
# The Handle server resolves via the DSpace backend's remote-resolver
# endpoints (the backend must have `handle.remote-resolver.enabled = true`).
# It does NOT connect to the database itself.
#
# client -> handle-server(:8000) --HTTP--> DSpace backend --> database
#
services:
handle-server:
build:
context: .
dockerfile: Dockerfile
image: docker-handle-server:local
container_name: handle-server
restart: unless-stopped
environment:
# Where the DSpace backend REST API lives (…/server).
# Default assumes a backend published on the host at :8082.
DSPACE_HANDLE_ENDPOINT: ${DSPACE_HANDLE_ENDPOINT:-http://host.docker.internal:8082/server}
extra_hosts:
# lets the container reach a backend running on the host
- "host.docker.internal:host-gateway"
ports:
- "${HANDLE_HTTP_PORT:-8000}:8000" # HTTP resolver
- "${HANDLE_NATIVE_PORT:-2641}:2641/tcp" # native Handle protocol
- "${HANDLE_NATIVE_PORT:-2641}:2641/udp"
entrypoint:
- /bin/sh
- -c
- |
# 1) point the resolver plugin at the backend
echo "dspace.handle.endpoint1 = $$DSPACE_HANDLE_ENDPOINT" > /app/config/handle-dspace-plugin.cfg
echo "Backend endpoint: $$DSPACE_HANDLE_ENDPOINT"
# 2) wait for the backend (the plugin loads the prefix list on startup
# and aborts if the backend is unreachable)
until wget -q -O- "$$DSPACE_HANDLE_ENDPOINT/listprefixes" >/dev/null 2>&1; do
echo " waiting for backend $$DSPACE_HANDLE_ENDPOINT ...";
sleep 5;
done
echo "Backend is up. Starting Handle server."
# 3) run the Handle server
exec /app/hs/bin/hdl-server /app/config/