Configuration
Ember Nexus API can be configured through environment variables (database connections, common options) and by providing a YML config file for lesser used settings.
A refactoring of the configuration process is planned in issue .
Environment variables
Ember Nexus specific variables:
APP_SECRET: Required. Secret of the Symfony kernel; use a random string and keep it private. The production image has no default value, so the container does not start without it.ANONYMOUS_USER_UUID: Required. The UUID of a user, which will be used if no token is supplied. The production image has no default value.ANONYMOUS_USER_READONLY: Set tofalseto allow the anonymous user to also use write endpoints (POST,PUT,PATCH,DELETE, …). Defaults totrue, i.e. anonymous requests are restricted to read-only (GET,HEAD) endpoints, plus a handful of endpoints that do not require authentication by design, such as , and .CYPHER_AUTH: Connection string for accessing the OpenCypher database, i.e. Neo4j.MONGO_AUTH: Connection string for accessing the Mongo database.ELASTIC_AUTH: Connection string for accessing the Elasticsearch database.S3_ENDPOINT: URL of the S3-compatible storage API, e.g.http://minio:9000.S3_ACCESS_KEY_ID: Access key ID used to authenticate against the S3-compatible storage API.S3_SECRET_ACCESS_KEY: Secret access key used to authenticate against the S3-compatible storage API.REDIS_AUTH: Connection string for accessing the Redis database. Redis must be configured withmaxmemory-policy noeviction, see element type .RABBITMQ_AUTH: Connection string for accessing the RabbitMQ database.VERSION: Variable containing the version of the currently running API software. Automatically set by the build process.REFERENCE_DATASET_VERSION: Variable containing the version of the reference used for validating features.DISABLE_CRON: Set totrueto disable the background every API instance would otherwise run automatically. Defaults tofalse.
Framework specific variables:
See Symfony’s for details.
Background tasks
Every API container instance schedules , , , (stays attached to its queue for most of the 3 minutes between two runs, so completed uploads are finalized as soon as they arrive), , , , , (stays attached to its queue like cron:finalize-uploads, so queued migrations start right away), and internally, each on its own interval, for as long as the container is up - there is nothing to schedule externally, and running multiple instances in parallel is safe since the individual tasks consume their work from a shared RabbitMQ queue, so the same item is never processed twice regardless of how many instances happen to poll at once. Set the DISABLE_CRON environment variable to true on an instance to opt it out, e.g. to run these commands on a different schedule yourself instead.
File storage buckets
Ember Nexus uses three S3-compatible buckets: the system bucket (see element type ) and two for uploaded files: file.S3UploadBucket holds chunks of resumable uploads still in progress, and file.S3StorageBucket holds files that have been fully attached to an element - see Chunk for how a file moves from one to the other. Ember Nexus already cleans up expired uploads itself (see and the background above), but only while those tasks are actually running. As a backstop, operators should also configure an object lifecycle policy directly on the upload bucket: expire objects after roughly 24-48 hours, and abort incomplete multipart uploads after a similarly short period. Ember Nexus neither creates nor manages this policy - it must be set up on the bucket itself, outside of this repository:
- AWS : covers both object expiration and
AbortIncompleteMultipartUpload. - : supports lifecycle expiration rules.
- : lifecycle configuration is recognized but not implemented - keep the background tasks running instead.
The storage bucket holds permanently retained files and should not have such a policy applied to it.
Ember Nexus does not create these buckets itself - they must already exist on the S3-compatible storage before the API starts, named exactly as configured (api-storage, api-upload and ember-nexus-system by default). The Docker Compose includes a minio-init container that creates the buckets (including the system bucket, see element type ) on a fresh MinIO instance; without it (or an equivalent manual mc mb / console step) the command fails and uploads and downloads do not work.
Element type index
Elements are addressed by their id only, but the graph database finds them fast only if the query names their label or relationship type. Ember Nexus therefore keeps a compact lookup table (built by mphf:build, stored in a third bucket, the system bucket) plus a small overlay in Redis for elements created since the last build, and creates the matching id indices with index:ensure. Like the other buckets, the system bucket has to exist before the API starts (ember-nexus-system by default; the Docker Compose example creates it). Without a table the API still works, using slower untyped queries.
Redis must keep the overlay: set maxmemory-policy noeviction, and enable persistence (e.g. appendonly yes and a mounted data directory), otherwise a Redis restart loses the overlay and the version of the current table; the next mphf:build repairs this, but elements created in between are unreachable until then.
Environment variables, all optional:
S3_SYSTEM_BUCKET: bucket for the lookup table files. Defaultember-nexus-system.MPHF_ENABLED: set tofalseto not use the lookup table. Defaulttrue.MPHF_STORAGE:memorykeeps downloaded tables in/dev/shm,diskin the temporary directory. Defaultmemory. The current and the previous table are kept at the same time. Docker limits/dev/shmto 64 MB by default, which is not enough for two tables at around 25 to 30 million elements: the download of the new table fails with a warning in the log, and the API silently stays on the old table or falls back to the slower verified or untyped queries. Raise the limit withshm_size(Docker Compose, e.g.shm_size: 1gb) or--shm-size, or usedisk.MPHF_DIR: overrides the directory of the downloaded tables.MPHF_MADVISE_RANDOM: hints the kernel about random access to the table. Defaulttrue.MPHF_STRICT: iftrue, an id which is neither in the table nor in the overlay is treated as non-existing without a database query, as long as the loaded table is the current one. Defaulttrue.MPHF_OVERLAY_SWITCH_DELAY: seconds between switching the overlay and exporting the ids, so requests which started before the switch can finish writing; time spent on index creation counts. Set to0if nothing writes during the build, e.g. in CI. Default 10.MPHF_OVERLAY_CLEAR_DELAY: seconds the previous overlay stays readable after a build was published; Redis deletes it afterwards, the build does not wait for it.0deletes it right away. Default 300.MPHF_RETENTION_FILES: number of table files kept in the system bucket. Default 7.MPHF_EXPORT_BATCH_SIZE: ids fetched per query while building. Default 10000.MPHF_CLI_DOWNLOAD_TIMEOUT: seconds a command waits for a table download. Default 120.MPHF_BUILDER_BINARY: path of the builder executable. Default/usr/local/bin/mphf-builder.- The schedule of
mphf:buildis configured in the YML , sectionmphf:intervalInSeconds(default 24 hours, at most 7 days),varianceIntervalInSeconds(default 3 hours, not bigger than the interval) andoverlayThresholdInElements(default 100000). ELEMENT_ID_FILTER_ENABLED: set tofalseto not build or use the Bloom filter of element ids (needs Redis 8 or the RedisBloom module; without it the filter is skipped automatically). Defaulttrue.ELEMENT_ID_FILTER_ERROR_RATE: false positive rate of the filter. Default0.001.MAINTENANCE_LOCK_TTL: seconds until a maintenance lock expires if its owner dies. Default 10800.
Embedding providers
Embedding providers turn texts into vectors, for the of vector properties and the search step . They are configured in embedding.providers of the YML , the key of each entry is the name of the provider. Providers must offer the request and response format of OpenAI’s POST /v1/embeddings, which most hosted APIs and local inference servers (e.g. Hugging Face’s text-embeddings-inference, Ollama, vLLM) support:
ember_nexus: embedding: providers: openai: url: 'https://api.openai.com/v1/embeddings' model: 'text-embedding-3-small' dimensions: 1536 apiKey: '%env(OPENAI_API_KEY)%' local: url: 'http://text-embeddings-inference/v1/embeddings' model: 'sentence-transformers/all-MiniLM-L6-v2' dimensions: 384dimensionsis the number of dimensions of the vectors of the model. Vector properties take it over, vectors of another length are rejected. Changing it requires changing the schemas which use the provider.apiKeyis sent as bearer token. Use an environment variable or a Symfony instead of writing it into the file.sendDimensionssendsdimensionswith every request, for models which can shorten their vectors.batch(defaulttrue) andbatchSize(default 32) control how many texts the background job sends in one request.concurrency(default 4) is the number of requests the background job sends to the provider at the same time. Requests to different providers always run at the same time, so a slow provider does not delay the others.timeoutInSeconds(default 30) limits each request, including the requests of searches.- If a provider limits the rate of requests (
429 Too Many Requests), the background job does not send it further requests until its next run; the other providers are not affected. - Certificates of
httpsURLs are checked against the certificate bundle of the Docker image,/etc/ssl/certs/ca-certificates.crt. To trust the certificates of the host instead, mount its bundle read-only over that file, e.g./etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro.caFilesets a bundle for a single provider, e.g. of an internal certificate authority.
Cross-origin requests (CORS)
Browsers only let web applications on another origin use the API if the API allows it. Which origins are allowed is configured with cors.allowedOrigins in the YML :
- Not set (default): the origin of each request is sent back in
Access-Control-Allow-Origin, i.e. every origin is allowed. The response carriesVary: Origin, so that caches do not mix up the origins. '*': the wildcard is sent for every request.Varyis not needed.- A list of origins, e.g.
['https://app.example.com']: only these origins are answered withAccess-Control-Allow-Origin, all others do not get the header and the browser blocks them. Origins are compared exactly, including scheme and port.
The API uses bearer tokens instead of cookies, so credentials are never allowed (Access-Control-Allow-Credentials is not sent).
The headers which a browser may send (Access-Control-Allow-Headers) and read (Access-Control-Expose-Headers) are always listed explicitly, as the wildcard * does not cover Authorization. Each endpoint only lists the headers it really uses, e.g. the Upload-* headers are only listed by the endpoints for resumable uploads, and ETag only by the endpoints which support it. Preflight requests (OPTIONS) are answered for every URL without authentication.
Responses which are not created by the application but by the web server in front of it, e.g. if no PHP thread is available, do not know the configuration and always answer with Access-Control-Allow-Origin: *.
YML configuration
The configuration file must be mounted at /var/www/html/config/packages/ember_nexus.yaml.
Note: The file extension must be .yaml.
# Default configuration for extension with alias: "ember_nexus"ember_nexus:
# Roles are named sets of capabilities, which can be assigned to users. Capabilities unlock instance-wide features and do not grant access to elements, except that user.manage and group.manage make all users and groups readable. Defining roles replaces the default roles completely, e.g. to define a limited admin role or none at all. Allowed capabilities are role.assign, user.manage, group.manage, index.manage, schema.manage, embedding.create and the wildcard "*", which stands for all capabilities. The default is the single role admin with the capability "*"; the key of each entry is the name of the role. roles:
# Examples: # admin: { capabilities: ['*'] } # schema-manager: { capabilities: [schema.manage] }
# Prototype name:
# Capabilities of the role. capabilities: [] # Required
# Affects how many elements can be returned in collection responses. pageSize:
# Minimum number of elements which are always returned, if they exist. min: 5
# Default number of elements which are returned if they exist. default: 25
# Maximum number of elements which are returned in a single response. Should not be way more than 100, as performance problems may arise. max: 100
# Handles the /register endpoint. register:
# If true, the /register endpoint is active and anonymous users can create accounts. enabled: true
# The property name of the identifier. Identifier must be unique across the API, usually the email. uniqueIdentifier: email
# Either false or a regex for checking the identifier content. Defaults to a loose check for an "@" sign, since the identifier is an email address by default. uniqueIdentifierRegex: '/^[^\s@]+@[^\s@]+$/'
# Roles which are assigned to users when they register via the /register endpoint, e.g. a member role. Every role must be defined in "roles". The roles are assigned once, when the account is created; changing this list does not affect existing users. Users created via the command user:create only get the roles given explicitly. defaultRoles: []
# Example: # - member
# Configures settings related to the execution of expressions expression:
# Minimum length for executable expressions to trigger a warning in the logs. warningLength: 512
# Maximum length for executable expressions. Exceeding the limit will throw an exception. maxLength: 10240
# Maximum runtime of the Go Expr Lang CLI call in milliseconds, at least 100. Can be set to null to disable the limit. timeoutInMilliseconds: 5000
# Maximum number of positions which one call of a geo function (e.g. geoContains) reads, summed over its geometry arguments. Larger inputs fail the expression. maxGeoPositions: 1000
# Configures the providers which turn texts into vectors (embeddings). Providers must offer the request and response format of OpenAI's POST /v1/embeddings, which is supported by most hosted and local inference servers. Vector properties of schemas and the search step text-embedding reference providers by their name. embedding:
# Embedding providers, the key of each entry is the name of the provider. No provider is defined by default. providers:
# Example: # openai: { url: 'https://api.openai.com/v1/embeddings', model: text-embedding-3-small, dimensions: 1536, apiKey: '%env(OPENAI_API_KEY)%' }
# Prototype name:
# URL of the endpoint, e.g. https://api.openai.com/v1/embeddings. url: ~ # Required
# Name of the model, sent as "model" with every request. model: ~ # Required
# Number of dimensions of the vectors which the model returns. Vector properties which use the provider get this number of dimensions, vectors of other lengths are rejected. dimensions: ~ # Required
# Sent as bearer token in the Authorization header, if set. Use an environment variable or a Symfony secret, e.g. "%env(OPENAI_API_KEY)%", instead of writing the key into the file. apiKey: null
# If true, the number of dimensions is sent as "dimensions" with every request. Only some models support it, e.g. OpenAI's text-embedding-3 models, which can shorten their vectors. sendDimensions: false
# If true, the background job sends several texts in one request, which is faster and often cheaper. Disable it for providers which accept a single text only. batch: true
# Maximum number of texts in one request, if batch is true. batchSize: 32
# Maximum number of requests the background job sends to this provider at the same time. Requests to different providers always run at the same time. concurrency: 4
# Maximum duration of one request in seconds, including the connection. timeoutInSeconds: 30
# Path of a file with the certificates of trusted certificate authorities (PEM). If not set, the certificate bundle of the system is used, /etc/ssl/certs/ca-certificates.crt in the Docker image. caFile: null
# Configures settings related to the search endpoint. search:
# If true, failed search steps and expressions are explained with the debug data and allowlisted diagnostics of the database. If false, only a short 400 error is returned, without debug data and failure details. explainFailures: true
# Configures the GET /{id}/access endpoint, which lists who is allowed to do what with an element. elementAccess:
# Maximum number of distinct users and groups in one response. If more would be listed, the list is cut and "truncated" is set to true. maxPrincipals: 50
# Configures the schemas of types. schema:
# Maximum number of rules of one schema. Every rule is evaluated on every write of an element of the type, so more rules make writes slower. maxRules: 16
# Configures the schedule of the element type index (id to type lookup table), which is built by the mphf:build command. The command runs every few minutes, but only builds if the next build time has come or the Redis overlay is big. mphf:
# Time between two scheduled builds. At most 7 days. intervalInSeconds: 86400
# After each build, the next build time is moved by a random part of this value, earlier or later, so that instances which run side by side do not build at the same time. Must not be bigger than the interval. varianceIntervalInSeconds: 10800
# If more elements than this were created since the last build, the next run of mphf:build builds right away, whatever the next build time is. overlayThresholdInElements: 100000
# Configures the /instance-configuration endpoint. instanceConfiguration:
# If true, enables the endpoint. If false, 403 error messages are returned. enabled: true
# If false, the version number is omitted. showVersion: true
# Configures Cross-Origin Resource Sharing (CORS). cors:
# Origins which may use the API from a browser, either a single origin, a list of origins (e.g. "https://app.example.com") or "*" for all origins. If not set, the origin of each request is sent back (parrot mode), i.e. every origin is allowed. Responses to requests from unlisted origins carry no Access-Control-Allow-Origin header. allowedOrigins: null
# Configures token settings. token:
# Minimum lifetime of created tokens. minLifetimeInSeconds: 1800
# Default lifetime of created tokens. defaultLifetimeInSeconds: 10800
# Maximum lifetime of created tokens. Can be set to false to disable maximum limit. maxLifetimeInSeconds: 34214400
# Expired tokens will be deleted after defined time. Can be set to false to disable auto delete feature. tokenDeleteExpiredTokensAutomaticallyInSeconds: 1209600
# Configures the cache. cache:
# Seed used to generate Etag values. Changing it invalidates all data cached by clients. etagSeed: ''
# Maximum number of items in a collection for which to generate Etags. Bigger collection do not contain Etags due to performance problems. etagUpperLimitInCollectionEndpoints: 100
# Configures behavior related to files. file:
# Maximum supported file size in bytes. Note: Upstream services like S3 have limits of their own (5TB). maxFileSizeInBytes: 10737418240
# Number of seconds after which unfinished uploads are expired. uploadExpiresAfterFirstRequestInSeconds: 10800
# Number of digits for the upload chunk counter. Number of max chunks can be limited by upstream services, e.g. AWS can only support up to 10.000 chunks, i.e. a chunk digits length of 4. uploadChunkDigitsLength: 4
# Minimum size in bytes of uploaded chunks. Limited by the S3 provider, e.g. AWS requires that chunks are at least 5 MiB big. uploadMinChunkSizeInBytes: 5242880
# Maximum size in bytes of uploaded chunks. Limited by the S3 provider, Caddy and the PHP configuration. uploadMaxChunkSizeInBytes: 105906176
# Grace period after an upload expires during which the cron:delete-expired-uploads command will not yet delete it. Gives clients a bit of leeway past the expiration date before their partial upload and its S3 chunks are removed. expiredUploadCanBeDeletedAfterExpirationInSeconds: 3600
# How long the record of a finished (completed or failed) resumable upload stays available for status requests; afterwards its URL answers 404. Counted from the end of the finalization, the record is deleted by the cron:delete-expired-uploads command once this period and its grace period have passed. finishedUploadRetentionInSeconds: 10800
# Name of the S3 bucket used for storage of files. Multiple S3 providers are supported (e.g. MinIO, VersityGW, SeaweedFS), but this bucket and the upload bucket must be hosted on the same S3 provider/instance, and must not share the same name. S3StorageBucket: api-storage
# Name of the S3 bucket used for temporary storage of uploads. Must be hosted on the same S3 provider/instance as the storage bucket, and must not share its name. S3UploadBucket: api-upload
# Number of levels (folders) used within the S3 storage bucket. S3StorageBucketLevels: 3
# Number of characters used for each level (folder) in the S3 storage bucket. S3StorageBucketLevelLength: 2
# Number of levels (folders) used within the S3 upload bucket. S3UploadBucketLevels: 2
# Number of characters used for each level (folder) in the S3 upload bucket. S3UploadBucketLevelLength: 2
# Maximum number of concurrent HTTP connections kept open to the S3 host. Used to parallelize otherwise sequential S3 operations, e.g. copying the parts of a large file during merge. Must be greater than 1. S3MaxHostConnections: 16This file can be downloaded directly .