Configuration
All configuration for Knora is done in application.conf.
For optimal performance it is important to tune the configuration to the hardware used, mainly to the number of CPUs and cores per CPU.
The relevant sections for tuning are:
knora-actor-dispatcherknora-blocking-dispatcher
System Environment Variables
A number of core settings is additionally configurable through system environment variables. These are:
| key in application.conf | environment variable | default value |
|---|---|---|
| app.bcrypt-password-strength | KNORA_WEBAPI_BCRYPT_PASSWORD_STRENGTH | 12 |
| app.jwt.secret | KNORA_WEBAPI_JWT_SECRET_KEY | dev-only-insecure-jwt-secret-change-me |
| app.jwt.expiration | KNORA_WEBAPI_JWT_LONGEVITY | 30 days |
| app.jwt.issuer | KNORA_WEBAPI_JWT_ISSUER | 0.0.0.0:3333 |
| app.dsp-ingest.audience | KNORA_WEBAPI_DSP_INGEST_AUDIENCE | http://localhost:3340 |
| app.allow-reload-over-http | KNORA_WEBAPI_ALLOW_RELOAD_OVER_HTTP | false |
| app.allow-sparql-passthrough | KNORA_WEBAPI_ALLOW_SPARQL_PASSTHROUGH | false |
| app.triplestore.sparql-passthrough.timeout | KNORA_WEBAPI_SPARQL_PASSTHROUGH_TIMEOUT | 120 seconds |
| app.triplestore.sparql-passthrough.max-request-body-bytes | KNORA_WEBAPI_SPARQL_PASSTHROUGH_MAX_REQUEST_BODY_BYTES | 1048576 |
| app.triplestore.sparql-passthrough.max-response-bytes | KNORA_WEBAPI_SPARQL_PASSTHROUGH_MAX_RESPONSE_BYTES | 67108864 |
| app.triplestore.sparql-passthrough.max-concurrent-calls | KNORA_WEBAPI_SPARQL_PASSTHROUGH_MAX_CONCURRENT_CALLS | 8 |
| app.ark.resolver | KNORA_WEBAPI_ARK_RESOLVER_URL | http://0.0.0.0:3336 |
| app.ark.assigned-number | KNORA_WEBAPI_ARK_NAAN | 72163 |
| app.knora-api.internal-host | KNORA_WEBAPI_KNORA_API_INTERNAL_HOST | 0.0.0.0 |
| app.knora-api.internal-port | KNORA_WEBAPI_KNORA_API_INTERNAL_PORT | 3333 |
| app.knora-api.external-protocol | KNORA_WEBAPI_KNORA_API_EXTERNAL_PROTOCOL | http |
| app.knora-api.external-host | KNORA_WEBAPI_KNORA_API_EXTERNAL_HOST | 0.0.0.0 |
| app.knora-api.external-port | KNORA_WEBAPI_KNORA_API_EXTERNAL_PORT | 3333 |
| app.sipi.internal-protocol | KNORA_WEBAPI_SIPI_INTERNAL_PROTOCOL | http |
| app.sipi.internal-host | KNORA_WEBAPI_SIPI_INTERNAL_HOST | localhost |
| app.sipi.internal-port | KNORA_WEBAPI_SIPI_INTERNAL_PORT | 1024 |
| app.sipi.external-protocol | KNORA_WEBAPI_SIPI_EXTERNAL_PROTOCOL | http |
| app.sipi.external-host | KNORA_WEBAPI_SIPI_EXTERNAL_HOST | localhost |
| app.sipi.external-port | KNORA_WEBAPI_SIPI_EXTERNAL_PORT | 443 |
| app.ark.resolver | KNORA_WEBAPI_ARK_RESOLVER_URL | http://0.0.0.0:3336 |
| app.ark.assigned-number | KNORA_WEBAPI_ARK_NAAN | 72163 |
| app.triplestore.dbtype | KNORA_WEBAPI_TRIPLESTORE_DBTYPE | fuseki |
| app.triplestore.use-https | KNORA_WEBAPI_TRIPLESTORE_USE_HTTPS | false |
| app.triplestore.host | KNORA_WEBAPI_TRIPLESTORE_HOST | localhost |
| app.triplestore.fuseki.port | KNORA_WEBAPI_TRIPLESTORE_FUSEKI_PORT | 3030 |
| app.triplestore.fuseki.repository-name | KNORA_WEBAPI_TRIPLESTORE_FUSEKI_REPOSITORY_NAME | dsp-repo |
| app.triplestore.fuseki.username | KNORA_WEBAPI_TRIPLESTORE_FUSEKI_USERNAME | admin |
| app.triplestore.fuseki.password | KNORA_WEBAPI_TRIPLESTORE_FUSEKI_PASSWORD | test |
| app.service-identity.trusted-keys | KNORA_WEBAPI_SERVICE_IDENTITY_TRUSTED_KEYS | [] (a JSON array, see below) |
app.dsp-ingest.audience is the audience the API writes into every token it issues and the audience ingest requires;
it is an identifier, not an address the API calls.
It is the only app.dsp-ingest setting; KNORA_WEBAPI_DSP_INGEST_BASE_URL, KNORA_WEBAPI_DSP_INGEST_EXTERNAL_BASE_URL
and KNORA_WEBAPI_DSP_INGEST_ASSET_DIR are no longer read.
Service identity
A trusted export service, such as dsp-repository's sync, calls the project export endpoints with a token it signs
itself (see Project Migration for the token
contract). The server holds only the service's public keys, in app.service-identity.trusted-keys
(KNORA_WEBAPI_SERVICE_IDENTITY_TRUSTED_KEYS). The setting is read at startup; a change needs a restart.
Format. A JSON array with one object per key:
[{"name": "dsp-repository", "kid": "dsp-repository-2026-11", "publicKey": "MCowBQYDK2VwAyEA..."}]
nameis the service's identity: lower-case letters, digits and hyphens. The token'sissandsubmust equal it, and the exports the service creates belong to it. Several keys may share a name.kididentifies the key; the token names it in its header. Eachkidmust be unique.publicKeyis the base64 of the Ed25519 public key's X.509 SubjectPublicKeyInfo, with or without the-----BEGIN PUBLIC KEY-----armour and line breaks.
The default [], an empty value and a blank value all mean no key is trusted: the service identity is off, and
every service token gets 401. A malformed array, an unparsable or non-Ed25519 key, a blank kid, an invalid
name or a duplicate kid stops the server at startup with a message naming the entry and field, never the key. At
startup the server logs one INFO line with the number of trusted keys and their names and kids, for example
Service identity: 1 trusted key(s): dsp-repository (kid dsp-repository-2026-11).
Generating a key. The service generates its key pair and keeps the private key; only the public key goes into this setting. With OpenSSL 3 (LibreSSL lacks Ed25519):
openssl genpkey -algorithm ed25519 -out dsp-repository-2026-11.pem # private key: stays with the service
openssl pkey -in dsp-repository-2026-11.pem -pubout -outform DER | base64 # the publicKey value
Rotating a key. Add the new key with the same name and a new kid, and restart. Switch the service to the new
key. Wait at least 16 minutes (a token lives at most 15 minutes, plus 30 seconds of clock skew), then remove the
old kid and restart. Exports belong
to the name, not the key, so the service keeps access to an export created under the old key.
Turning it off. Remove the service's entries, or set the variable to [], and restart. A key stops working on a
server only once that server has restarted without it; restarting is the only way to revoke a key, so on a server
with several instances the key stays valid until every instance has restarted.
A leaked private key exports any project in full, password hashes included, on every server that trusts it:
- Remove the key from every server that trusts it and restart each one.
- Review the
Export service call:log lines of the service's name since the leak. - Delete any exports the name still holds: exports belong to the name, so the service's new key would see them.
Whoever can change this setting can grant export of every project, so changes to it need the same control as a
SystemAdmin credential. Never add the key that the E2E tests trust (e2e-export-service): its private half is in
the repository.
Logs. The audit and rejection log lines are described under Project Migration.
Ingest
Ingest is served by the API under /ingest/ (see Ingest Endpoints) and has its own
configuration file, ingest.conf in the ingest module, set through INGEST_* environment variables. No key or
variable is read by both the API's application.conf and ingest.conf. Ingest takes the token secret and issuer from
app.jwt and the audience from app.dsp-ingest.audience.
| key in ingest.conf | environment variable | default value |
|---|---|---|
| ingest.storage.asset-dir | INGEST_STORAGE_ASSET_DIR | /opt/images |
| ingest.storage.temp-dir | INGEST_STORAGE_TEMP_DIR | /opt/temp |
| ingest.sipi.use-local-dev | INGEST_SIPI_USE_LOCAL_DEV | false |
| ingest.sipi.local-dev-image | INGEST_SIPI_LOCAL_DEV_IMAGE | daschswiss/knora-sipi:latest |
| ingest.bulk-max-parallel | INGEST_BULK_MAX_PARALLEL | 8 |
| ingest.features.allow-erase-projects | INGEST_ALLOW_ERASE_PROJECTS | false |
| ingest.executor.cpu-share | INGEST_EXECUTOR_CPU_SHARE | 0.5 |
asset-dirandtemp-dirmust be mounted read-write into the API container; ingest writes the asset files there./ingest/healthanswers503when either directory is missing.use-local-devmust stayfalsein a container: ingest then runs the Sipi CLI,ffmpegandffprobeshipped in the API image.trueruns Sipi throughdocker runoflocal-dev-image, for a local API outside a container.allow-erase-projectsenablesDELETE /ingest/projects/{shortcode}/eraseand lets the API's project erasure delete the project's asset folder. It is separate from the API'sALLOW_ERASE_PROJECTSfeature flag below.cpu-sharesizes the ingest thread pool and the number of concurrent child processes (Sipi,ffmpeg,ffprobe) and BagIt exports and imports, as a share of the available processors; it must lie in(0, 1].- The old ingest variables without the
INGEST_prefix (STORAGE_*,SIPI_USE_LOCAL_DEV,JWT_*,DB_JDBC_URL,DSP_API_URL,SERVICE_*) are not read.
The API image runs as root, because ingest writes into the asset folders of the storage volume (NFS-owned on the
DaSCH servers).
Asset backfills
The size and MIME-type backfills of the asset .info files are main classes on the API image's classpath. They read
the same INGEST_* variables, so run them in a container of the API image with the same mounts, for example with
Docker Compose:
docker compose run --rm --no-deps --entrypoint java api -cp '/opt/docker/lib/*' swiss.dasch.MigrateSizes
docker compose run --rm --no-deps --entrypoint java api -cp '/opt/docker/lib/*' swiss.dasch.MigrateMimeTypes 0801
Without arguments a backfill covers the whole asset store; project shortcodes as arguments restrict it to those projects. It exits non-zero when an asset failed.
Startup Flags
There is a number of flags that can be set on startup, they will override any value set in the application configuration file:
loadDemoData,--loadDemoData,-d: Loads the demo data.allowReloadOverHTTP,--allow-reload-over-http,-r: Allows reloading of data over HTTP.-c: Print the configuration at startup.--help: Shows the help message with all startup flags.
Feature Flags
Feature flags gate functionality that is not yet stable, is being rolled out,
or is intentionally restricted on certain deployments. Each flag can be set
via its environment variable or in application.conf under
app.features.<flag-name>.
| key in application.conf | environment variable | default value |
|---|---|---|
| app.features.allow-erase-projects | ALLOW_ERASE_PROJECTS | false |
| app.features.trigger-compaction-after-project-erasure | TRIGGER_COMPACTION_AFTER_PROJECT_ERASURE | false |
| app.features.disable-last-modification-date-check | DISABLE_LAST_MODIFICATION_DATE_CHECK | false |
| app.features.allow-import-migration-bagit | ALLOW_IMPORT_MIGRATION_BAGIT | true |
| app.features.allow-placeholder | ALLOW_PLACEHOLDER | true |
| app.features.allow-project-data-import | ALLOW_PROJECT_DATA_IMPORT | false |
| app.features.serve-stored-xml | SERVE_STORED_XML | false |
allow-erase-projects
Controls whether the project erase endpoint is enabled. Erasing a project permanently removes all of its data from the triplestore and is irreversible; it requires SystemAdmin permission.
When the flag is disabled, calls to the erase endpoint are rejected with
403 Forbidden and the message
The feature to erase projects is not enabled.
trigger-compaction-after-project-erasure
Controls whether the triplestore is compacted after a project is erased. When enabled, a Fuseki compaction is triggered as the final step of the erase operation to reclaim disk space.
Has no effect unless allow-erase-projects is
also enabled.
disable-last-modification-date-check
Disables the optimistic-concurrency check that compares the client-supplied
lastModificationDate against the value stored in the triplestore on
resource and ontology updates.
When the flag is enabled, mismatched modification dates no longer raise an
EditConflictException, so concurrent edits can overwrite each other
silently. Intended for data migration or recovery scenarios only; leave it
off for normal operation.
allow-import-migration-bagit
Controls whether the project migration import endpoints are available. See Project Migration Export/Import for the endpoint reference.
When the flag is disabled, import endpoints return 404 Not Found.
Export endpoints are always available and are not gated by this flag.
allow-placeholder
Controls whether the Placeholder License
(urn:dasch:placeholder) may be used on a FileValue.
The Placeholder License is intended as a temporary placeholder while the
actual license for a file is still being determined. See
License for the broader context.
When the flag is disabled, any FileValue with
licenseIri = urn:dasch:placeholder is rejected by the
legal-info validation with the error:
License urn:dasch:placeholder is the placeholder license and is not allowed on this server
This is checked at the server level — the placeholder license is rejected even if a project has explicitly enabled it.
allow-project-data-import
Controls whether the project data-graph import endpoints are available. See Project Data Import for the endpoint reference.
When the flag is disabled, the data-graph import endpoints return 404 Not Found.
serve-stored-xml
Controls whether client reads of formatted text values return the stored XML.
When the flag is enabled, the API returns the stored knora-base:valueHasXml
instead of rebuilding the XML from standoff. A value without the stored XML
falls back to the rebuild. The served XML is isomorphic to the rebuilt XML:
both are equal after canonicalization.
The flag affects the client reads of resources (single, batch, by project and
class), values and searches (Gravsearch, full-text, incoming links, incoming
regions, still image representations), in the complex schema, when the value is
returned with XML markup. It does not affect reads with markup=standoff or
reads in the simple schema. It never affects internal reads or writes.
Before you enable the flag, run the valueHasXml backfill on all projects
and check the standoff link reference counts. See the
rollout order.
Disable the flag to restore the rebuild at once. Data written while it was enabled stays valid.