Core API for the GA4GH Reference Cloud.
These instructions were written against macOS. Linux works the same way apart from the package manager commands.
| Requirement | Purpose | Install (macOS) |
|---|---|---|
| Java 25+ | Spring Boot 4 runtime. The Docker image builds on Corretto 25, and Java 26 also works locally. | SDKMAN (below) |
| Gradle 9.5.1 | Optional. ./gradlew downloads the pinned version on first run. |
sdk install gradle 9.5.1 |
| PostgreSQL 18+ | Backing store for the API, plus databases for Ory Kratos and Ory Hydra | brew install postgresql@18 |
| Liquibase | Applies the API schema. The app runs with ddl-auto: none and does not create tables itself. |
brew install liquibase |
| Docker (Desktop or OrbStack) | Runs Ory Kratos (identity/sessions), Ory Hydra (OAuth2/JWT issuer) and Mailslurper | docker.com |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh" # or open a new terminal
sdk list java | grep amzn # pick a 25.x (or newer) Corretto build
sdk install java 25.0.3-amzn # answer "Y" to make it the defaultVerify the build is going to use the right JDK. ./gradlew uses JAVA_HOME:
java -version
echo $JAVA_HOME # ~/.sdkman/candidates/java/currentIf java -version reports an older JDK, check ~/.zshrc and ~/.zprofile for an existing JAVA_HOME or Homebrew openjdk PATH entry that is taking precedence. Remove it, or make sure the SDKMAN init block comes last.
brew services start postgresql@18
psql postgres <<'SQL'
CREATE ROLE refcloudapi LOGIN PASSWORD 'secret';
CREATE ROLE kratos LOGIN PASSWORD 'secret';
CREATE ROLE hydra LOGIN PASSWORD 'secret';
CREATE DATABASE refcloudapi OWNER refcloudapi;
CREATE DATABASE kratos OWNER kratos;
CREATE DATABASE hydra OWNER hydra;
SQLThese credentials match src/main/resources/application.yml and docker-compose.yml. They are for local development only.
cd liquibase
liquibase --changeLogFile=dbchangelog.xml \
--url=jdbc:postgresql://localhost:5432/refcloudapi \
--username=refcloudapi --password=secret \
update
cd ..If you don't want to install Liquibase locally, liquibase/Dockerfile packages the same changelog.
Optional test data:
psql -U refcloudapi -d refcloudapi -f src/test/resources/sql/add-test-data.sql
psql -U refcloudapi -d refcloudapi -f src/test/resources/sql/add-test-passport-visa-assertions.sqldocker compose up -dThis runs the Kratos and Hydra migrations against the host Postgres (via host.docker.internal), then starts:
| Service | Ports |
|---|---|
| Kratos | 4433 (public), 4434 (admin) |
| Hydra | 4444 (public / JWT issuer), 4445 (admin), 5555 |
| Mailslurper | 4436, 4437 |
Verification and recovery emails sent by Kratos land in Mailslurper at http://127.0.0.1:4436.
contrib/kratos/kratos.yml sends its self-service redirects (verification and recovery email links, post-logout redirects, error pages) to 127.0.0.1:4455, the default port of Ory's sample UI. The Reference Cloud UI runs on 127.0.0.1:3000 and serves the same paths. Login and registration work without this change because the UI creates those flows through its own Ory proxy, so you can skip it for normal local development. If you need those redirects and email links to land in the UI, run:
sed -i '' 's#127.0.0.1:4455#127.0.0.1:3000#g' contrib/kratos/kratos.yml # macOS; on Linux use sed -i without ''
docker compose restart kratos./gradlew bootRunThe API listens on http://localhost:8080.
curl http://localhost:8080/ga4gh/drs/v1/service-infoYou should get back the DRS service-info document configured under ga4gh.refcloud.drs.service-info in application.yml.
Other public endpoints:
GET /ga4gh/drs/v1/objects/{id}GET /datasets
Endpoints that need a GA4GH Passport require Hydra to be running so the API can validate JWTs against the issuer at http://127.0.0.1:4444. A full browser login flow also needs the Reference Cloud UI; see its README for setup, including registering the Hydra OAuth client.
exec format erroron Apple Silicon. The pinnedoryd/kratos:v0.9.0-alpha.2andoryd/mailslurperimages may not have arm64 builds. Addplatform: linux/amd64to those services indocker-compose.yml.- The
kratos-migrateorhydra-migratecontainer can't reach Postgres. Confirm Postgres accepts connections from Docker. You may needlisten_addresses = '*'inpostgresql.confand apg_hba.confentry for the Docker network. - Kratos rejects its config.
contrib/kratos/kratos.ymldeclaresversion: v0.7.1-alpha.1while the compose file pins Kratos v0.9.0-alpha.2. Check that mismatch first. - The API fails at startup with relation/table errors. The Liquibase step (2) hasn't been run against
refcloudapi.
Configuration lives in src/main/resources/application.yml. Spring Boot's relaxed binding lets you override any property with an environment variable. The ones you are most likely to change:
| Variable | Default | Description |
|---|---|---|
SPRING_DATASOURCE_URL |
jdbc:postgresql://localhost:5432/refcloudapi |
API database JDBC URL |
SPRING_DATASOURCE_USERNAME |
refcloudapi |
Database user |
SPRING_DATASOURCE_PASSWORD |
secret |
Database password |
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUERURI |
http://127.0.0.1:4444 |
OAuth2/OIDC issuer used to validate JWTs (Hydra) |
GA4GH_REFCLOUD_SECURITY_KRATOS_PUBLICBASEURL |
http://127.0.0.1:4433 |
Kratos public API, used for session validation |
GA4GH_REFCLOUD_DRS_SCHEME |
http |
Scheme used when building DRS URIs |
GA4GH_REFCLOUD_DRS_HOSTDOMAIN |
127.0.0.1:8080 |
Host used when building DRS URIs |
For any issues relating to the API, please create an issue in the GA4GH Reference Cloud planning repo. Please do not create issues in this repo as they will not be monitored.