Add docker image for ceph-rbd backups
This commit is contained in:
5
ceph-rbd-backup/Dockerfile
Normal file
5
ceph-rbd-backup/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM quay.io/ceph/ceph:v20.2
|
||||
|
||||
COPY script.sh /script.sh
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/script.sh"]
|
||||
10
ceph-rbd-backup/README.md
Normal file
10
ceph-rbd-backup/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Ceph-RBD-backup
|
||||
|
||||
## Environment Variables
|
||||
| Name | Default | Description |
|
||||
|---|---|---|
|
||||
| CEPH_USERNAME | - | TODO |
|
||||
| RBD_POOL | - | TODO |
|
||||
| RBD_IMAGE_ID | - | TODO |
|
||||
| SNAPSHOT_ID | - | TODO |
|
||||
| OUTPUT_FILE | - | TODO |
|
||||
21
ceph-rbd-backup/script.sh
Normal file
21
ceph-rbd-backup/script.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CEPH_USERNAME="${CEPH_USERNAME:-}"
|
||||
RBD_POOL="${RBD_POOL:-}"
|
||||
RBD_IMAGE_ID="${RBD_IMAGE_ID:-}"
|
||||
SNAPSHOT_ID="${SNAPSHOT_ID:-}"
|
||||
OUTPUT_FILE="${OUTPUT_FILE:-}"
|
||||
|
||||
# Create the snapshot
|
||||
rbd --name ${CEPH_USERNAME} snap create ${RBD_POOL}/${RBD_IMAGE_ID}@${SNAPSHOT_ID};
|
||||
|
||||
# Export the snapshot to a file
|
||||
rbd --name ${CEPH_USERNAME} export --export-format 2 ${RBD_POOL}/${RBD_IMAGE_ID}@${SNAPSHOT_ID} - | zstd -T1 -3 ${OUTPUT_FILE};
|
||||
touch ${OUTPUT_FILE}.done;
|
||||
|
||||
ls -al ${OUTPUT_FILE};
|
||||
|
||||
# Remove the snapshot again
|
||||
rbd --name ${CEPH_USERNAME} snap rm ${RBD_POOL}/${RBD_IMAGE_ID}@${SNAPSHOT_ID};
|
||||
Reference in New Issue
Block a user