Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit 740a1dc

Browse files
authored
Merge pull request #7 from kadena-io/backup-api
Add backup API
2 parents 0ba42ae + d8bc356 commit 740a1dc

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

chainweb.openapi.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,18 @@ components:
655655
example:
656656
$ref: '#/components/examples/base64HeaderPage/items/0'
657657

658+
backupStatus:
659+
title: Backup job status
660+
type: string
661+
pattern: "backup-done|backup-in-progress|backup-failed"
662+
663+
backupId:
664+
title: Backup job identifier
665+
description: Textual backup job identifier
666+
type: string
667+
pattern: "[a-zA-Z0-9_-]+"
668+
example: 1648665437000
669+
658670
# Binary encoded Block Header
659671
binaryHeader:
660672
title: Binary Block Header
@@ -1026,6 +1038,22 @@ components:
10261038
minimum: 0
10271039
example: 0
10281040

1041+
backupId:
1042+
name: backupId
1043+
in: path
1044+
description: The identifier of the backup being checked
1045+
required: true
1046+
schema:
1047+
$ref: '#/components/schemas/backupId'
1048+
1049+
backupPact:
1050+
name: backupPact
1051+
in: query
1052+
description: |
1053+
Flag, if present back up the Pact databases too. Extra disk space and time required
1054+
required: false
1055+
allowEmptyValue: true
1056+
10291057
minheight:
10301058
name: minheight
10311059
in: query
@@ -2699,6 +2727,86 @@ paths:
26992727
example:
27002728
$ref: "#/components/examples/nodeConfig"
27012729

2730+
/make-backup:
2731+
post:
2732+
summary: Start a backup job
2733+
description: |
2734+
Backup jobs are identified by the Unix timestamp when they're begun.
2735+
2736+
If a backup job is already in progress, this endpoint will return its
2737+
identifier instead of starting a new one.
2738+
2739+
The RocksDB portion of the database is always backed up; if backupPact
2740+
is set, the Sqlite (Pact) portion is backed up as well, taking much
2741+
longer.
2742+
2743+
There is no automatic backup retention policy - users need to delete old
2744+
backups.
2745+
2746+
This API is enabled by configuring the node thus:
2747+
```yaml
2748+
backup:
2749+
api.enabled: true
2750+
directory: {some file path to put backups in}
2751+
```
2752+
The backup directory ideally will be located in the same partition as the
2753+
RocksDB portion of the node database.
2754+
2755+
RocksDB backups to the same partition as holds the active RocksDB
2756+
database will have almost zero space overhead immediately, but over time
2757+
as the active database diverges from the backup the space overhead will
2758+
increase. If the backup is to another partition, it will take longer
2759+
and take as much disk space as the active RocksDB database.
2760+
2761+
Pact database backups always require about as much space as the active
2762+
Pact database does.
2763+
tags: [ misc ]
2764+
parameters:
2765+
- $ref: '#/components/parameters/backupPact'
2766+
responses:
2767+
"200":
2768+
headers:
2769+
x-peer-addr:
2770+
$ref: '#/components/headers/x-peer-addr'
2771+
x-server-timestamp:
2772+
$ref: '#/components/headers/x-server-timestamp'
2773+
x-chainweb-node-version:
2774+
$ref: '#/components/headers/x-chainweb-node-version'
2775+
content:
2776+
text/plain:
2777+
schema:
2778+
$ref: '#/components/schemas/backupId'
2779+
2780+
/check-backup/{backupId}:
2781+
get:
2782+
summary: Check the status of a backup job
2783+
tags: [ misc ]
2784+
parameters:
2785+
- $ref: '#/components/parameters/backupId'
2786+
responses:
2787+
"200":
2788+
headers:
2789+
x-peer-addr:
2790+
$ref: '#/components/headers/x-peer-addr'
2791+
x-server-timestamp:
2792+
$ref: '#/components/headers/x-server-timestamp'
2793+
x-chainweb-node-version:
2794+
$ref: '#/components/headers/x-chainweb-node-version'
2795+
content:
2796+
text/plain:
2797+
schema:
2798+
$ref: '#/components/schemas/backupStatus'
2799+
2800+
"404":
2801+
headers:
2802+
x-peer-addr:
2803+
$ref: '#/components/headers/x-peer-addr'
2804+
x-server-timestamp:
2805+
$ref: '#/components/headers/x-server-timestamp'
2806+
x-chainweb-node-version:
2807+
$ref: '#/components/headers/x-chainweb-node-version'
2808+
description: There is no backup job with that identifier
2809+
27022810
/health-check:
27032811
servers:
27042812
- url: "https://api.chainweb.com/"

0 commit comments

Comments
 (0)