Compare commits
5 Commits
d61cc8627b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
505e5c4cdb | ||
|
|
04d56ca7a5 | ||
|
|
b40ce21e9d | ||
|
|
2ace4c1c00 | ||
|
|
0105c98ce5 |
54
.github/workflows/docker.yaml
vendored
54
.github/workflows/docker.yaml
vendored
@@ -9,7 +9,7 @@ permissions:
|
|||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
nomad-scale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -34,3 +34,55 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
gitea.lol3r.com/leon/nomad-scale:latest
|
gitea.lol3r.com/leon/nomad-scale:latest
|
||||||
gitea.lol3r.com/leon/nomad-scale:${{ gitea.sha }}
|
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 - ceph-rbd-backup
|
||||||
|
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 }}
|
||||||
|
|
||||||
|
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 }}
|
||||||
|
|||||||
11
ceph-rbd-backup/Dockerfile
Normal file
11
ceph-rbd-backup/Dockerfile
Normal file
@@ -0,0 +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"]
|
||||||
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 -o ${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};
|
||||||
5
gcp-backup-upload/Dockerfile
Normal file
5
gcp-backup-upload/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
FROM google/cloud-sdk:587.0.0
|
||||||
|
|
||||||
|
COPY script.sh /script.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "/script.sh"]
|
||||||
9
gcp-backup-upload/README.md
Normal file
9
gcp-backup-upload/README.md
Normal 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 |
|
||||||
12
gcp-backup-upload/script.sh
Normal file
12
gcp-backup-upload/script.sh
Normal 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}/;
|
||||||
Reference in New Issue
Block a user