Compare commits

...

3 Commits

Author SHA1 Message Date
Lol3rrr
505e5c4cdb Add docker image for uploading a file to gcp
All checks were successful
Build Docker Image / nomad-scale (push) Successful in 11s
Build Docker Image / ceph-rbd-backup (push) Successful in 26s
Build Docker Image / gcp-backup-upload (push) Successful in 5m2s
2026-10-03 14:25:27 +02:00
Lol3rrr
04d56ca7a5 Fix zstd command
All checks were successful
Build Docker Image / nomad-scale (push) Successful in 10s
Build Docker Image / ceph-rbd-backup (push) Successful in 7s
2026-10-03 00:23:14 +02:00
Lol3rrr
b40ce21e9d Install zstd in the docker image
All checks were successful
Build Docker Image / nomad-scale (push) Successful in 20s
Build Docker Image / ceph-rbd-backup (push) Successful in 1m0s
2026-10-03 00:17:43 +02:00
6 changed files with 60 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ jobs:
username: leon
password: ${{ secrets.DOCKER_PAT }}
- name: Build and push - nomad-scale
- name: Build and push - ceph-rbd-backup
uses: docker/build-push-action@v6
with:
context: ./ceph-rbd-backup
@@ -60,3 +60,29 @@ jobs:
tags: |
gitea.lol3r.com/leon/ceph-rbd-backup:latest
gitea.lol3r.com/leon/ceph-rbd-backup:${{ gitea.sha }}
gcp-backup-upload:
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 - gcp-backup-upload
uses: docker/build-push-action@v6
with:
context: ./gcp-backup-upload
file: ./gcp-backup-upload/Dockerfile
push: true
tags: |
gitea.lol3r.com/leon/gcp-backup-upload:latest
gitea.lol3r.com/leon/gcp-backup-upload:${{ gitea.sha }}

View File

@@ -1,5 +1,11 @@
FROM quay.io/ceph/ceph:v20.2
RUN dnf clean all \
&& rm -rf /var/cache/dnf \
&& dnf install -y zstd \
&& dnf clean all \
&& rm -rf /var/cache/dnf
COPY script.sh /script.sh
ENTRYPOINT ["/bin/bash", "/script.sh"]

View File

@@ -12,7 +12,7 @@ OUTPUT_FILE="${OUTPUT_FILE:-}"
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};
rbd --name ${CEPH_USERNAME} export --export-format 2 ${RBD_POOL}/${RBD_IMAGE_ID}@${SNAPSHOT_ID} - | zstd -T1 -3 -o ${OUTPUT_FILE};
touch ${OUTPUT_FILE}.done;
ls -al ${OUTPUT_FILE};

View File

@@ -0,0 +1,5 @@
FROM google/cloud-sdk:587.0.0
COPY script.sh /script.sh
ENTRYPOINT ["/bin/bash", "/script.sh"]

View File

@@ -0,0 +1,9 @@
# GCP-Backup-Upload
## Environment Variables
| Name | Default | Description |
|---|---|---|
| FILE_TO_TRIGGER | - | TODO |
| FILE_TO_BACKUP | - | TODO |
| BUCKET_URL | - | TODO |
| GCLOUD_KEY_FILE | - | TODO |

View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail
until [ -f ${FILE_TO_TRIGGER} ]
do
sleep 5
done
gcloud auth activate-service-account --key-file ${GCLOUD_KEY_FILE};
gcloud storage cp ${FILE_TO_BACKUP} ${BUCKET_URL}/;