Skip to content

Commit f85e62d

Browse files
authored
Merge branch 'main' into dependabot/pip/python-dependencies-c86978efa1
2 parents 9fcf46e + 145e7b2 commit f85e62d

35 files changed

Lines changed: 4002 additions & 891 deletions

‎.dockerignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ backups
77
build
88
dist
99
tests
10+
11+
.env
12+
.env.*
13+
*.pem
14+
*.key
15+
.uv-cache

‎.env.example‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Deployment target: Ubuntu 24.04+ x86_64; compose.yaml fixes linux/amd64.
2+
# Required values must be available to Coolify Compose build-time interpolation AND runtime.
3+
# REQUIRED: fill these six values. They intentionally have no fake working defaults.
4+
# GitHub Settings > Developer settings > GitHub Apps > your App > General: App ID.
5+
GITHUB_APP_ID=
6+
# Account/org login names from github.com/NAME; install the App on All repositories for each.
7+
GITHUB_APP_OWNERS=
8+
# App General > Private keys > Generate a private key; download the PEM.
9+
# Encode locally: base64 < app-private-key.pem | tr -d '\n'
10+
# Use that single-line output below; treat it as a secret.
11+
GITHUB_APP_PRIVATE_KEY_BASE64=
12+
# DigitalOcean > Spaces Object Storage > Access Keys > Create Access Key.
13+
# AWS_ names are boto3/S3 conventions: enter DIGITALOCEAN values; no AWS account needed.
14+
# Access key ID (not friendly name), then the matching secret saved at creation.
15+
# Neither value is a DigitalOcean personal API token.
16+
AWS_ACCESS_KEY_ID=
17+
AWS_SECRET_ACCESS_KEY=
18+
# DigitalOcean > Spaces Object Storage > Buckets: copy the destination bucket name only.
19+
# It may contain other applications' files outside SPACES_PREFIX/.
20+
SPACES_BUCKET=
21+
22+
# OPTIONAL: working defaults; get the region from your bucket's Spaces settings/origin hostname.
23+
# company-files.ams3.digitaloceanspaces.com means bucket=company-files, region=ams3.
24+
SPACES_REGION=fra1
25+
# Reserve this folder exclusively for this worker. Nested prefixes are allowed.
26+
SPACES_PREFIX=github-backup
27+
BACKUP_INTERVAL_HOURS=1
28+
# Recent changed versions plus older UTC calendar checkpoints; deduplicated.
29+
BACKUP_RETENTION=3
30+
BACKUP_KEEP_WEEKLY=2
31+
BACKUP_KEEP_MONTHLY=2
32+
BACKUP_KEEP_OLDEST=true
33+
# 0 disables the age floor to keep the above count policy bounded.
34+
BACKUP_MIN_AGE_DAYS=0
35+
BACKUP_MANIFEST_RETENTION=14
36+
# Budget counts only live objects inside SPACES_PREFIX/, not the shared bucket.
37+
BACKUP_MAX_STORAGE_GIB=100
38+
BACKUP_WORKERS=1
39+
BACKUP_TIMEOUT_HOURS=12
40+
BACKUP_CPUS=0.5
41+
BACKUP_MEMORY_LIMIT=512m
42+
# Optional comma-separated numeric IDs of intentionally deleted repos; never purges data.
43+
ACKNOWLEDGED_MISSING_REPOSITORIES=
44+
45+
# OPTIONAL: disabled when empty. Copy a Push monitor's secret URL from Uptime Kuma.
46+
UPTIME_KUMA_PUSH_URL=
47+
# Enable only for Kuma reached over a trusted private HTTP network.
48+
UPTIME_KUMA_ALLOW_HTTP=false
49+
UPTIME_KUMA_TIMEOUT_SECONDS=5
50+
# 0 = automatic: 2 * BACKUP_INTERVAL_HOURS + 1 (3 hours with default hourly checks).
51+
UPTIME_KUMA_MAX_SUCCESS_AGE_HOURS=0

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
steps:
5858
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5959
- name: Build container image
60-
run: docker build --pull --provenance=false --tag github-backup:ci .
60+
run: docker build --pull --platform linux/amd64 --provenance=false --tag github-backup:ci .
6161
- name: Scan container for actionable high/critical vulnerabilities
6262
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
6363
with:
@@ -69,7 +69,7 @@ jobs:
6969
exit-code: "1"
7070
- name: Smoke-test container image
7171
run: |
72-
docker run --rm --read-only --cap-drop=ALL --security-opt=no-new-privileges \
72+
docker run --rm --platform linux/amd64 --read-only --cap-drop=ALL --security-opt=no-new-privileges \
7373
github-backup:ci --version
74-
docker run --rm --read-only --cap-drop=ALL --security-opt=no-new-privileges \
74+
docker run --rm --platform linux/amd64 --read-only --cap-drop=ALL --security-opt=no-new-privileges \
7575
github-backup:ci help run

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ jobs:
212212
with:
213213
ref: ${{ needs.prepare.outputs.tag }}
214214
- name: Build local image for vulnerability gate
215-
run: docker build --pull --provenance=false --tag github-backup:release-scan .
215+
run: docker build --pull --platform linux/amd64 --provenance=false --tag github-backup:release-scan .
216216
- name: Scan container for actionable high/critical vulnerabilities
217217
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
218218
with:
@@ -226,7 +226,6 @@ jobs:
226226
id: image
227227
shell: bash
228228
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
229-
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
230229
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
231230
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
232231
with:
@@ -246,12 +245,12 @@ jobs:
246245
labels: |
247246
org.opencontainers.image.description=Production backups for GitHub repositories, gists, and optional service data
248247
org.opencontainers.image.licenses=GPL-3.0-only
249-
- name: Build and publish multi-architecture image
248+
- name: Build and publish x86_64 server image
250249
id: build
251250
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
252251
with:
253252
context: .
254-
platforms: linux/amd64,linux/arm64
253+
platforms: linux/amd64
255254
push: true
256255
tags: ${{ steps.metadata.outputs.tags }}
257256
labels: ${{ steps.metadata.outputs.labels }}

‎.github/workflows/scorecard.yml‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,25 @@ jobs:
2727
with:
2828
results_file: results.sarif
2929
results_format: sarif
30-
publish_results: true
30+
# Analysis and code-scanning ingestion must not depend on Sigstore availability.
31+
publish_results: false
3132
- name: Upload results to code scanning
3233
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4
3334
with:
3435
sarif_file: results.sarif
36+
- name: Publish signed Scorecard results (best effort)
37+
id: publish
38+
continue-on-error: true
39+
uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0
40+
with:
41+
results_file: published-results.sarif
42+
results_format: sarif
43+
publish_results: true
44+
- name: Retry signed Scorecard publishing (best effort)
45+
if: steps.publish.outcome == 'failure'
46+
continue-on-error: true
47+
uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0
48+
with:
49+
results_file: published-results.sarif
50+
results_format: sarif
51+
publish_results: true

‎CONTRIBUTING.md‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,19 @@ privilege, predictable recovery, and backward compatibility ahead of convenience
1010
private repository names, proprietary source, or real backup data in an issue or pull request.
1111
- Keep pull requests focused. Large behavior changes should describe migration and restore impact.
1212

13+
## Deployment documentation
14+
15+
The README is the primary **Coolify + Docker Compose + GitHub App + Spaces** installation guide.
16+
Keep `compose.yaml`, `.env.example`, `docs/COOLIFY.md`, and `docs/MONITORING.md` aligned when
17+
changing environment variables or defaults. Keep CLI/systemd/PAT alternatives in `docs/CLI.md`.
18+
Container logs must use stdout/stderr; monitoring failure must not interrupt backup persistence,
19+
and secret Push URLs must never appear in logs. Test actual backup status and missing-heartbeat
20+
behavior rather than unconditionally reporting a running process as successful.
21+
1322
## Development setup
1423

15-
Python 3.11 or newer, Git, and Git LFS are required. Docker is required for container changes.
24+
Python 3.11 or newer, Git, and Git LFS are required. Docker is required for container changes. The production target is Ubuntu 24.04+ x86_64;
25+
Compose, container CI, and release builds explicitly target `linux/amd64`.
1626

1727
```bash
1828
git clone https://github.com/drhdev/github-backup.git
@@ -51,6 +61,20 @@ Add tests for changed behavior. Tests must not use a real token or contact a liv
5161
When a live integration check is necessary, document the isolated test account, permissions, and
5262
cleanup procedure without disclosing secrets.
5363

64+
## Container and Scorecard CI
65+
66+
Both Docker stages pin the same official Python 3.13 Bookworm image digest. When refreshing
67+
that pin, inspect `apt` and `libapt-pkg6.0` on the AMD64 deployment target before building: Bookworm
68+
must contain version 2.6.2 or newer for CVE-2026-109518. Keep the CI/release Trivy High/Critical
69+
gates enabled; a base digest pin does not by itself mean its OS packages are current.
70+
71+
Scorecard analysis and GitHub SARIF upload are mandatory. Signed publication to the public
72+
Scorecard service runs afterward, best effort, with one retry. A Sigstore/Rekor outage can
73+
leave public results stale, but cannot bypass analysis or prevent the already-required
74+
code-scanning upload. Inspect the publishing steps and rerun the workflow after an outage
75+
if the public result needs refreshing. Do not treat successful workflow status as proof that
76+
optional public publication succeeded. The job keeps only Scorecard-approved action steps.
77+
5478
## Commit and pull-request format
5579

5680
Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) because commits merged

‎Dockerfile‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.13-slim-bookworm@sha256:a1165e272e578941b84abc79e4ab38a0305cd12803a5c4247979ac7655f4d641 AS builder
1+
FROM python:3.13-slim-bookworm@sha256:a5a7017efc5969e00ae2b91c8eb0631049a569652aa4ffc4501769049ae45c72 AS builder
22

33
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
44
PIP_NO_CACHE_DIR=1
@@ -11,15 +11,16 @@ RUN uv export --frozen --no-dev --extra s3 --no-emit-project --output-file /tmp/
1111
COPY src ./src
1212
RUN python -m pip wheel --no-deps --wheel-dir /wheels .
1313

14-
FROM python:3.13-slim-bookworm@sha256:a1165e272e578941b84abc79e4ab38a0305cd12803a5c4247979ac7655f4d641
14+
FROM python:3.13-slim-bookworm@sha256:a5a7017efc5969e00ae2b91c8eb0631049a569652aa4ffc4501769049ae45c72
1515

1616
ENV PYTHONDONTWRITEBYTECODE=1 \
1717
PYTHONUNBUFFERED=1 \
1818
GITHUB_BACKUP_DESTINATION=/backups \
1919
DEBIAN_FRONTEND=noninteractive
2020

21+
RUN mkdir /cache && chown 10001:10001 /cache
2122
RUN apt-get update \
22-
&& apt-get install --no-install-recommends -y ca-certificates git git-lfs \
23+
&& apt-get install --no-install-recommends -y ca-certificates git git-lfs openssl \
2324
&& rm -rf /var/lib/apt/lists/* \
2425
&& groupadd --gid 10001 ghbackup \
2526
&& useradd --uid 10001 --gid ghbackup --create-home ghbackup

0 commit comments

Comments
 (0)