Skip to content
Euro-OfficePublic

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

30 stars

Watchers

3 watching

Forks

Latest commit

 

History

5,260 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Server

License

The backend server software layer which is a part of Euro-Office Document Server and is the base for all other components.

Redis editor-data backend

The complete editor-data test suite covers Redis 7.0.15, Redis 7.2, and Redis 8 in all three tested topologies: standalone, Cluster, and Sentinel. The bundled Node-Redis client version is 6.2.1.

Valkey editor-data backend

The complete editor-data test suite covers Valkey 7.2, Valkey 8, and Valkey 9 in all three tested topologies: standalone, Cluster, and Sentinel.

Operator configuration

Versions and topology

The used Node-Redis 6.2.1 library officially supports Redis 7.2 and later. Use Redis 7.2 or later, or Valkey 7.2 or later, for production deployments. The compatibility matrix also runs against Redis 7.0.15 because that is the Redis version provided by Ubuntu 24.04; this is compatibility coverage rather than the official Node-Redis support floor. Redis 7.2, Redis 8, Valkey 7.2, Valkey 8, and Valkey 9 are tested in standalone, Cluster, and Sentinel configurations.

For Cluster deployments, configure all nodes with the same command and data semantics. For Sentinel deployments, configure one primary, its replicas, and the Sentinel quorum through optionsSentinel.

Sentinel configuration uses the node-redis shape below. Redis-node credentials belong in nodeClientOptions; Sentinel credentials belong in sentinelClientOptions. Omit both credential objects when the corresponding deployment is unauthenticated. For compatibility with older entrypoints, an empty password with no username or with the legacy default username is treated as omitted authentication; an empty username is treated as no username. Any other configured username requires a non-empty password.

{
  "name": "mymaster",
  "sentinelRootNodes": [{"host": "sentinel-1", "port": 26379}],
  "nodeClientOptions": {"username": "default", "password": "redis-secret", "database": 0},
  "sentinelClientOptions": {"username": "default", "password": "sentinel-secret"}
}

Initial Sentinel discovery retries transient topology errors three times. The outer connection attempt is bounded by 15 seconds; commands have a 30-second adapter timeout and fail before readiness rather than entering an unbounded offline queue. A deliberate store or process shutdown remains terminal until the store is recreated.

Before each new Sentinel client is created, DocService sends every configured Sentinel a PING over a connection of its own (2 seconds, all at the same time). Sentinels that do not answer are left out of the list that node-redis gets, so a Sentinel that accepts connections but never answers cannot stall discovery; if none answers, the full list is used. Each new client also starts at the next Sentinel in the list, and one connection attempt through Sentinel gets an equal share of the 15-second budget (at least 3 seconds).

A standalone endpoint that follows a managed failover, such as a DNS name or a Kubernetes Service that always points at the current primary, is handled the same way as Sentinel: a command answered with READONLY or MASTERDOWN closes the client, and the next operation reconnects through the endpoint. The failed command is not replayed. Cluster clients follow MOVED redirects instead.

DocumentServer startup retry policy

When Redis-backed editor-data or editor-stat storage is enabled, DocumentServer does not accept HTTP requests until both stores have connected successfully. Startup retries the complete editor-data/editor-stat readiness sequence at most three times. Between attempts it waits one second, then two seconds. These startup retry values are fixed and are not runtime configuration settings.

Each individual Redis connection still uses the normal topology-specific connection timeout and reconnect behavior described above. Consequently, a Redis outage can delay final startup failure longer than the two retry delays. If all startup attempts fail, DocumentServer logs the final Redis error and terminates with a non-zero exit status; it does not start listening on a partially initialized server. Standalone, Cluster, and Sentinel deployments follow the same startup policy. Process shutdown cancels pending startup retries and closes any in-flight Redis connection attempt.

Redis command timeout isolation

Node-Redis multiplexes commands on one physical client, but a command that has already been written cannot be safely removed from its reply queue. The editor-data connection group therefore serializes application operations on its physical client. This is deliberately conservative: a timed-out operation still aborts its physical client, and operations queued behind it reconnect on the next client generation instead of sharing the half-open socket. The tradeoff is that editor-data operations sharing this group are not fully parallel: a slow operation can impose head-of-line blocking on later operations, potentially until the 30-second command timeout, and Cluster batches do not retain their usual per-command parallelism on this group. This protects reply ordering and fail-closed behavior, but is connection-group isolation rather than unrestricted per-command isolation. Editor-stat, notification, and other Redis-backed groups remain separate connection groups.

A true per-command isolation design would require multiple physical clients or a client pool, with routing and cleanup coordinated across standalone, Cluster, and Sentinel topologies. It would also need explicit handling for transactions, stale client generations, reconnects, and coordination-sensitive operations. That is a substantially larger change with more failure modes; the serialized editor-data lane is therefore retained as the safer correctness boundary.

Memory and eviction policy

Set the following on every primary and replica:

maxmemory-policy noeviction

The backend assigns bounded lifetimes to transient editor data and relies on Redis/Valkey expiration plus its cleanup passes. Eviction policies such as allkeys-lru, allkeys-lfu, or volatile-ttl can remove live editor state before its intended TTL and are not supported. Size the deployment so normal operation does not exhaust maxmemory; noeviction may reject writes under memory pressure, which is safer than silently evicting active locks or state.

TTL defaults

The defaults are defined under services.CoAuthoring.expire in Common/config/default.json. Values below are the editor-data defaults; numeric values are seconds unless noted otherwise.

Data Default lifetime
Presence 300 seconds
Shard connection counters 300 seconds
Document locks 604800 seconds (7 days)
Messages 86400 seconds (24 hours)
Force-save state 604800 seconds (7 days)
Saved status 3600 seconds (1 hour)
Saved-state claim lease 86400 seconds (24 hours)
Monthly unique-user statistics 1y

Presence, locks, messages, force-save state, saved status, and shard counters are refreshed or expired by the backend as they are used. The document and force-save indexes are sorted sets with timestamp scores; cleanup removes expired members, so an index key itself can remain present after its members expire.

Each DocService refreshes its users' presence and its connection shard counters at the services.CoAuthoring.expire.documentsCron interval, which is also the document expiration GC interval. With Redis editor data, services.CoAuthoring.expire.presence and services.CoAuthoring.expire.shard must both be more than 10% (and at least one second) longer than this interval; otherwise live users would expire between refreshes. When they are not, for example with a slow value set in the AdminPanel, DocService uses the default interval of 2 minutes (or half the shorter TTL, if that is shorter) and logs an error. A cron expression that cannot be parsed also falls back to the default interval, and an interval longer than a timer allows (about 24.8 days) is capped. None of these stops DocService from starting. A tenant's presence or shard TTL is raised to at least twice the interval DocService uses.

A DocService that stops without closing its connections (killed, out of memory, a lost node, or a shutdown that leaves its users to reconnect elsewhere) leaves their presence entries and locks in Redis. On each refresh, every DocService also checks the documents its users have open: it removes the expired presence entries, releases the locks of users who no longer have a presence entry, and tells the remaining users, as when a user leaves. A user who does not come back therefore keeps the others out of the parts they had locked for at most the presence TTL plus one interval (with the defaults, 300 seconds plus up to 2 minutes). Nothing is released while no presence entry is left: GC then handles the whole document.

Saved status has a separate claim lease. A claim is created only when a save result is consumed: the backend creates a per-document saved:claim key and removes the saved key as one operation. The claim prevents another operation from consuming the same result while the current operation is completing. A successful consumer acknowledges the claim after it has accepted the saved result; the claim then remains only for the rest of its configured lease. A retry with the same operation can recover a claimed result before that lease expires, while a different operation fails closed until the claim is acknowledged or expires.

If the consumer does not acknowledge the claim, its lease expires after the configured services.CoAuthoring.expire.savedClaim interval. The abandoned claim is then eligible for abandoned-claim recovery, so it no longer blocks a later saved status; terminal document cleanup can also clear an abandoned claim while finalizing the document. The default claim lease is 86400 seconds (24 hours), independently of the 3600-second saved-status lifetime. A claim that has already been acknowledged is also removed when its lease expires.

Expiration cleanup is processed in batches of 6 members per index shard. The Redis POP_EXPIRED Lua operation is atomic for one shard, so this cap bounds both the number of sorted-set members it examines and the number it moves into that shard's lease/claim sets; a large backlog cannot turn one Lua invocation into an unbounded blocking operation. Each GC pass checks all 16 shards, and therefore claims at most 96 entries for either expiration queue per pass. The at-least-once lease is acknowledged only after the document operation completes. A sustained arrival rate above the resulting aggregate capacity should be treated as an operational capacity issue rather than addressed by making the Lua batch unbounded.

Key schema

The configured services.CoAuthoring.redis.prefix is prepended to every key generated by the backend. It defaults to ds:. Use a distinct prefix when multiple DocumentServer installations share a Redis/Valkey database.

Tenant and document identifiers are encoded with URL-safe Base64. For a tenant <tenant> and document <document>, the per-document base is:

<prefix>{editor:<base64url(tenant)>:<base64url(document)>}:

The per-document keys are the base followed by presence:set, presence:hash, presence:version, savelock, lockdocument, locks, message, saved, saved:claim, forcesave, and closed. saved:claim is the lease-limited coordination key used while a saved status is being consumed. closed is set when a document's cleanup has run and removed when a user joins again; it expires after twice the presence TTL plus one GC claim lease. GC uses it to tell a documents index entry left over from a clean exit (whose index update failed) from one left by a DocService that stopped, and then does not send the "closed" status callback a second time.

Cross-document editor-data indexes use 16 fixed shards. The shard is the FNV-1a hash of the UTF-8 JSON pair [tenant, document], reduced modulo 16. The tenant is always part of the input, including single-tenant deployments. The document index and force-save timer for one document deliberately share the same Redis Cluster hash tag:

<prefix>{editor:index:<shard>}:documents
<prefix>{editor:index:<shard>}:forcesavetimer
<prefix>{editor:index:<shard>}:documents:expired:lease
<prefix>{editor:index:<shard>}:documents:expired:claims
<prefix>{editor:index:<shard>}:forcesavetimer:expired:lease
<prefix>{editor:index:<shard>}:forcesavetimer:expired:claims

The shard count is a documented implementation constant, not a runtime setting. Keep it stable because changing it changes the key schema. Redis Cluster operations never combine keys from different shards in one Lua script or transaction.

Tenant statistics use the hash tag {stat:<base64url(tenant)>}. Their keys include presence uniqueness (presence:unique:*), monthly presence statistics (presence:month:*), editor connection samples (editorconnections), connection shards (connections:<type>:count and connections:<type>:updated), and notification locks (notification:<base64url(type)>). The braces are intentional Redis Cluster hash tags: all keys for one document or one tenant's statistics stay in the same slot, while cross-document index traffic is distributed over the 16 index slots.

Known limitation: replication failover and locks

Redis and Valkey replication failover is not currently lock-safe. If the primary fails immediately after granting a lock, the promoted replica may not have received that lock, allowing another client to acquire it. Redis- and Valkey-backed editor-data deployments should therefore not be described as fully failover-safe for locks.

Treat this as a deployment risk and a separate production-readiness follow-up. Sentinel support, command retries, and WAIT do not remove this limitation.

File converter worker count

Set FileConverter.converter.workercount to a positive integer in your administrator configuration (local.json) to choose the number of file-conversion workers directly:

{
  "FileConverter": {
    "converter": {
      "workercount": 2
    }
  }
}

For file-based installations, use the local.json next to the deployed default.json (typically /etc/euro-office/documentserver/local.json on Linux). Keep administrator overrides in local.json; upgrades replace default.json.

The explicit count takes precedence over CPU availability and FileConverter.converter.maxprocesscount. It is not capped by the number of CPUs; choose a count appropriate for the server's memory and workload.

The default is null. When the setting is absent or null, the existing automatic calculation is unchanged: the available parallelism (or CPU count if unavailable) multiplied by maxprocesscount, rounded up. Invalid values, including zero, negative numbers, fractions, numeric strings and integers outside JavaScript's safe range, log a warning and fall back to that same calculation.

In particular, workercount: 0 does not itself disable conversion: it selects automatic sizing, which may start more workers than intended.

Restart the converter service after changing this setting. Existing installations that only set maxprocesscount keep their current behavior.

License

Server is released under an GNU AGPL v3.0 license. See the LICENSE file for more information.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

30 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages