Export module
Source: modules/export/.
At a glance
Section titled “At a glance”| CLI | — |
| Subcommands | 2 |
| HTTP endpoints | see the route reference |
| Events emitted | — |
| Error codes | see the error code reference |
| Service classes | ExporterLoader, ExportService, ImportService |
| Cross-module deps | app, job, node, stack |
Source layout
Section titled “Source layout”modules/export/├── archive.go├── command.go├── errors.go├── router.go├── runner.go├── service.go├── types.go└── commands/HTTP API
Section titled “HTTP API”Routes are listed in the generated route reference; request/response notes live in the API reference.
Errors
Section titled “Errors”Typed errors are catalogued in the error code reference with HTTP statuses and message templates.
Responsibilities
Section titled “Responsibilities”The export module owns selective, schema-driven data export and
import — taking a declared subset of a stack’s state (configs,
secrets, app data) out to a transportable archive, and bringing it
back in somewhere else.
ExportService builds the archive; ExporterLoader discovers the
*.exporter.yaml files that describe what to export. This is distinct
from backup (which is a Restic-based full-data
snapshot with deduplication) and from clone (which is
an orchestrated stack duplication). export is the lightweight, typed,
human-curated option.
Export Artifact Format (.exp)
Section titled “Export Artifact Format (.exp)”AR archive structure:
{id}.exp (AR archive)├── metadata.json # ExportMetadata└── data.tar.gz # Exported filesMetadata Fields
Section titled “Metadata Fields”| Field | Description |
|---|---|
id | Unique artifact identifier |
exporter | Name of the exporter used |
stack | Source stack name |
tenant | Tenant name |
environment | Environment name |
timestamp | Creation time (ISO 8601) |
version | Format version |
params | Exporter-specific parameters |
data.checksum | SHA256 of data.tar.gz |
data.size | Size of data.tar.gz in bytes |
Wrap Import
Section titled “Wrap Import”The --wrap flag allows importing external files as artifacts without running an export:
# Import a Keycloak realm exportshc import mystack /path/to/realm.json --wrap keycloak/realms
# Import a database dumpshc import mystack /backup/dump.sql --wrap postgres/dumpWrapped Artifact Metadata
Section titled “Wrapped Artifact Metadata”Wrapped artifacts include additional tracking fields:
| Field | Description |
|---|---|
source | "wrapped" (vs "exported" for normal) |
wrapped_from | Original file/directory path |
wrapped_by | User who created the wrap |
wrapped_at | Wrap timestamp (ISO 8601) |
See Backup Module - Wrap Import for full details.