Compare commits

..

2 Commits

Author SHA1 Message Date
Lol3rrr
2ace4c1c00 Add workflow to build image
All checks were successful
Build Docker Image / nomad-scale (push) Successful in 11s
Build Docker Image / ceph-rbd-backup (push) Successful in 2m29s
2026-10-02 23:35:34 +02:00
Lol3rrr
0105c98ce5 Add docker image for ceph-rbd backups 2026-10-02 23:34:52 +02:00
4 changed files with 63 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ permissions:
packages: write
jobs:
docker:
nomad-scale:
runs-on: ubuntu-latest
steps:
@@ -34,3 +34,29 @@ jobs:
tags: |
gitea.lol3r.com/leon/nomad-scale:latest
gitea.lol3r.com/leon/nomad-scale:${{ gitea.sha }}
ceph-rbd-backup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: gitea.lol3r.com
username: leon
password: ${{ secrets.DOCKER_PAT }}
- name: Build and push - nomad-scale
uses: docker/build-push-action@v6
with:
context: ./ceph-rbd-backup
file: ./ceph-rbd-backup/Dockerfile
push: true
tags: |
gitea.lol3r.com/leon/ceph-rbd-backup:latest
gitea.lol3r.com/leon/ceph-rbd-backup:${{ gitea.sha }}

View 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
View 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
View 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};