Skip to main content

Architecture

The Deployment Log Service traces the deployments of components onto environments and documents them as Confluence pages. It is published as a library; the runnable artefact is an instance built by a downstream project, see Getting Started.

Building blocks​

The library consists of seven Maven modules layered so that every module only depends downwards:

ModuleContains
jeap-deploymentlog-domainThe domain model and the repository interfaces. The domain classes are at the same time the JPA entities — there is one model, not a separate persistence model.
jeap-deploymentlog-persistenceThe repository implementations (XxxRepositoryImpl delegating to a Spring Data JpaXxxRepository) and the Flyway migrations in db/migration.
jeap-deploymentlog-jiraA standalone Jira REST client with retry. It has no dependency on the domain or the persistence layer.
jeap-deploymentlog-docgenThe documentation generation: Thymeleaf rendering, the Confluence adapter, the async service and the scheduled jobs.
jeap-deploymentlog-webThe REST controllers and their DTOs, the API security configuration, the OpenAPI configuration and the Spring Boot application class.
jeap-deploymentlog-service-instanceA POM-only module bundling jeap-deploymentlog-web, meant to be used as the Maven parent of a service instance.
jeap-deploymentlog-mcpOptional, added by an instance next to jeap-deploymentlog-web: read-only MCP tools on the endpoint of the jEAP MCP starter, see MCP Server. It only depends on the domain; the repository implementations come from the persistence module at runtime.

Every module contributes a Spring Boot @AutoConfiguration (DomainConfiguration, PersistenceConfiguration, JiraWebClientConfig, DocumentationGeneratorConfig, DeploymentLogConfig, DeploymentLogMcpConfig), so an instance only has to add the dependency and the configuration.

Domain model​

  • Deployment is the central aggregate. It is identified towards clients by a client-chosen externalId and carries a DeploymentState (STARTED, SUCCESS, FAILURE, CANCELLED), a DeploymentSequence, an optional DeploymentTarget (type/url/details), a required DeploymentUnit (type/coordinates/artifactRepositoryUrl), free-form links and properties, and an optional changelog.
  • DeploymentSequence classifies a deployment relative to what was on the environment before: FIRST (first deployment of the component onto the environment), NEW (a new version), REPEATED (the same version again) or UNDEPLOYED (the component was removed). It is derived by the service, not sent by the client.
  • DeploymentType (CODE, CONFIG, INFRASTRUCTURE) marks what a deployment changed. A deployment may carry several types.
  • System, Component, Environment are created on the fly when a deployment references them for the first time. Environment names are upper-cased. A system can be renamed (keeping the old name as a SystemAlias) or merged into another system. Administrative SystemGroup records can structure systems; a nullable foreign key on System enforces that it belongs to at most one group.
  • EnvironmentComponentVersionState holds the current state of an environment: which version of which component is deployed there. It is updated when a deployment is reported as SUCCESS, and it is what the system and environment query endpoints read. An undeployment does not delete the row; it points it at the UNDEPLOYED deployment instead, so the state is kept as a tombstone recording when and that the component was undeployed, rather than silently disappearing.
  • ArtifactVersion and Reference link a deployment back to the build that produced the artefact. They can be published before the deployment happens and are resolved at page-generation time — via the deployment-unit coordinates for artifact versions, and via the reference identifiers of the deployment for references.
  • Page entities (DeploymentPage, DeploymentListPage, SystemPage, EnvironmentHistoryPage and DocumentationStructurePage) record which Confluence page was generated for which entity and when. They are what makes the generation idempotent and repairable. Structural tracking also records the expected parent so existing pages can be moved without replacing their Confluence ids.

Version history​

There is no persisted Flow entity. Relevant CODE deployments are grouped by component and version name for component pages. Each deployment owns its stagingType and explicit finalDeploymentEnvironments; ComponentVersion rows remain per-deployment metadata. DeploymentStagingService serializes classification per component and checks stage history as of the deployment start timestamp. Only successful predecessors permit promotion as NEW.

Classification, latency and version metrics query the retained deployments directly. No separate staging-history archive is maintained. V33 changes only the schema and does not copy or reclassify existing deployments. Stage relevance is derived from the configured stage range; AutoStaging is derived from explicit targets. Deleting deployments through retention also removes their contribution to these evaluations.

Recording a deployment​

Recording a deployment is a two-step protocol, because the outcome is only known when the deployment has finished:

Both calls are idempotent in the sense that matters for a retrying client: a PUT on a deployment whose externalId already exists returns 200 OK and changes nothing, instead of creating a duplicate.

Only SUCCESS, FAILURE and CANCELLED are accepted as a state update; the environment state is only advanced on SUCCESS.

Triggering the documentation generation is deliberately outside the transaction and outside the response: if it fails, the failure is logged and the deployment stays recorded — the scheduled repair job picks the page up later.

Asynchrony and locking​

The service uses no messaging. Documentation work is submitted to a bounded in-process dispatcher with one worker and tracing-context propagation. Live deployment and undeployment tasks have priority over repair, housekeeping and batch tasks. To prevent permanent starvation, the dispatcher runs one background task after a configurable burst of live tasks. Task keys deduplicate queued work; a live deployment also promotes and replaces a queued repair for the same deployment.

If another refresh with the same key arrives while its predecessor is already running, one queued follow-up is retained; further matching requests update that follow-up instead of being discarded or growing the queue. This coalesced follow-up has one reserved slot so it is retained even when the regular queue is full.

The single worker prevents slow Confluence calls from exhausting the datasource pool needed by deployment API requests. Database reads and tracking writes use short transactions; Confluence/Jira calls and distributed-lock acquisition run outside them. There is no transaction spanning the whole generation run. Ordinary deployment, history and retention work reuses a successfully synchronized structure for up to five minutes per instance. Each reuse checks system names, group assignments/names, configured Confluence location and tracked structure page IDs/parents in the database. The cache contains only immutable identifiers, never JPA entities. Deployment generation still refreshes the affected system overview. Generation failures invalidate the snapshot so that the next repair attempt checks the structure again. Lock-acquisition timeouts preserve the snapshot: deployment work stays pending for repair and does not increment the generation-error counter. Expiry is checked on use; explicit full regeneration, migration/merge and administrative reconciliation always bypass the cache.

Distributed locks keep concurrent generation runs apart:

  • Per-system docgen lock (DocgenLocks) — a ShedLock lock named docgen-<systemname> serialises all generation runs for one system, across instances. A run waits up to 30 seconds by default for the lock; if it cannot acquire it, deployment-page work is deferred to the scheduled repair job. History refreshes retry up to three times with a delay; both individual lock timeouts and exhausted retries are logged at INFO. Operations without a repair path report the timeout as a failure. The lock is kept alive while the run is in progress (KeepAliveLockProvider), so a long run retrying Confluence updates does not lose it. The wait can be changed with jeap.deploymentlog.documentation-generator.lock-acquire-timeout.
  • Shared page locks — renewable locks docgen:component:<UUID> and docgen:jira-project:<PROJECTKEY> serialize the generation of one component page or of one Jira project's change view across systems, without holding database row locks during HTTP calls.
  • Scheduled job locks — the cron jobs carry their own @SchedulerLock, so only one instance runs them at a time.

ShedLock uses a JDBC lock provider on the service's own datasource.

Lock contention for deployment-page repair is an expected deferral and is logged without an exception stack trace. Global structure reconciliation holds its distributed documentation lock across the Confluence operations, but no database transaction. Individual tracking writes commit independently, so a slow Confluence response cannot leave an idle database connection attached to the whole reconciliation run; a later run resumes idempotently after failure. Full regeneration, system migration/merge and structure reconciliation use the throwing lock path; history refresh uses it on cache misses; their callers receive or log a failure instead of silently accepting an incomplete operation. Persistent retention refresh tasks remain pending when generation is deferred. Missing and outdated pages remain identifiable through persistent deployment/page tracking. The scheduled repair job first processes the oldest never-attempted items without an age cutoff. Persisted attempt timestamps then rotate repeatedly failing pages behind untried and less recently attempted pages, so a poison page cannot block the backlog.

Cross-cutting concepts​

  • Security — the /api/** endpoints are secured with HTTP basic authentication against two in-memory users configured by property, mapped to the roles deploymentlog-read and deploymentlog-write. The filter chain is stateless and CSRF is disabled. GET /api/deployment-doc/** is explicitly public. See REST API.
  • Error handling — RestResponseExceptionHandler maps the domain exceptions onto HTTP status codes (not-found exceptions to 404, already-defined/invalid-state exceptions to 400, Jira unavailability to 503) and passes errors of synchronously called upstream systems through with their original status.
  • Resilience — the Confluence adapter retries on request failures (four attempts, exponential backoff). Within a single call, an update rejected as a conflict is retried up to two more times with a constant wait, re-rendering the page content each time. The Jira client retries with an exponential backoff too.
  • Read replica — read-only endpoints and queries are annotated with @TransactionalReadReplica (jeap-spring-boot-tx), so an instance configured with a read replica routes them there.
  • Observability — the jEAP monitoring starter provides the actuator endpoints; the service adds its own metrics for the generation lag, generation errors and generation timings, see Operations.