Skip to content

Commit 145e7b2

Browse files
committed
fix: patch container base and target Ubuntu amd64 deployments
1 parent 3719df4 commit 145e7b2

12 files changed

Lines changed: 183 additions & 33 deletions

File tree

‎.env.example‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
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.
13
# REQUIRED: fill these six values. They intentionally have no fake working defaults.
4+
# GitHub Settings > Developer settings > GitHub Apps > your App > General: App ID.
25
GITHUB_APP_ID=
3-
# Comma-separated users/orgs where the App is installed on All repositories.
6+
# Account/org login names from github.com/NAME; install the App on All repositories for each.
47
GITHUB_APP_OWNERS=
5-
# Single-line base64 of the downloaded App PEM; treat as a secret.
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.
611
GITHUB_APP_PRIVATE_KEY_BASE64=
7-
# DigitalOcean Spaces key/secret, NOT a DigitalOcean API token.
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.
816
AWS_ACCESS_KEY_ID=
917
AWS_SECRET_ACCESS_KEY=
10-
# Bucket name only: it may contain other applications' files outside SPACES_PREFIX/.
18+
# DigitalOcean > Spaces Object Storage > Buckets: copy the destination bucket name only.
19+
# It may contain other applications' files outside SPACES_PREFIX/.
1120
SPACES_BUCKET=
1221

13-
# OPTIONAL: working defaults; change region to match your existing bucket.
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.
1424
SPACES_REGION=fra1
1525
# Reserve this folder exclusively for this worker. Nested prefixes are allowed.
1626
SPACES_PREFIX=github-backup

‎.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: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ behavior rather than unconditionally reporting a running process as successful.
2121

2222
## Development setup
2323

24-
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`.
2526

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

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+
6378
## Commit and pull-request format
6479

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

‎Dockerfile‎

Lines changed: 2 additions & 2 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,7 +11,7 @@ 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 \

‎README.md‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
Back up the Git code in your personal GitHub accounts and organizations to DigitalOcean
77
Spaces, so you can recover when GitHub is unavailable or an account is compromised.
8-
**The default installation is Docker Compose deployed through Coolify.**
8+
**The default installation is Docker Compose deployed through Coolify on an Ubuntu 24.04 LTS
9+
or newer supported Ubuntu server with an x86_64 (Intel/AMD 64-bit) CPU.**
10+
Compose explicitly builds and runs `linux/amd64`; no Raspberry Pi OS or ARM hardware is required.
911

1012
Install one GitHub App with **All repositories** on each account and organization. New
1113
repositories are discovered automatically. The worker checks hourly and uploads a new
@@ -64,8 +66,8 @@ Record the bucket name and its region, e.g. `fra1` (Frankfurt) or `ams3` (Amster
6466
5. **Disable automatic deployments, preview deployments, and overlapping/rolling replacements.**
6567
A compromised GitHub account must not be able to deploy replacement worker code with Spaces secrets.
6668
6. In **Environment Variables**, set the six required values below in the production environment.
67-
Make them available at **runtime**, disable **build-time** exposure of credentials, and keep
68-
secret values masked. See the [complete deployment guide](docs/COOLIFY.md) for UI details.
69+
For the current Compose file, enable **Buildtime and Runtime** on all six required values
70+
so Coolify can interpolate Compose during its build command. Keep secret values masked. See the [complete deployment guide](docs/COOLIFY.md) for UI details.
6971
7. Save and deploy. Do not add a Coolify scheduled task: the container includes its own scheduler.
7072

7173
### 4. Set the environment
@@ -85,6 +87,32 @@ SPACES_BUCKET=company-files
8587
The Spaces credentials are a Spaces access-key pair, not a DigitalOcean API token.
8688
`SPACES_BUCKET` is just the bucket name, without a URL or folder.
8789

90+
### Where to find each required value
91+
92+
| Environment variable | Value to enter | Where to find it |
93+
|---|---|---|
94+
| `GITHUB_APP_ID` | Numeric App ID | GitHub **Settings → Developer settings → GitHub Apps → your App → General**; copy **App ID**, not Client ID or installation ID |
95+
| `GITHUB_APP_OWNERS` | User/org login names, comma-separated | The account and organization names in GitHub URLs, e.g. `github.com/alice` and `github.com/example-team`; install the App on each first |
96+
| `GITHUB_APP_PRIVATE_KEY_BASE64` | Single-line base64 of your downloaded PEM | Your App's **General → Private keys → Generate a private key**, then run the base64 command above locally |
97+
| `AWS_ACCESS_KEY_ID` | **DigitalOcean Spaces access key ID** | DigitalOcean **Spaces Object Storage → Access Keys → Create Access Key** |
98+
| `AWS_SECRET_ACCESS_KEY` | **Secret belonging to that same Spaces key** | Copy the secret when creating the Spaces key; if lost, create a replacement pair and update both values |
99+
| `SPACES_BUCKET` | Existing bucket name, e.g. `company-files` | DigitalOcean **Spaces Object Storage → Buckets**; open the destination bucket |
100+
101+
**Why the `AWS_` names?** Spaces implements the S3 API, and this project uses boto3's standard
102+
credential environment variables. Put **DigitalOcean** credentials in them: no AWS account,
103+
AWS IAM key, or AWS bill is involved. `SPACES_BUCKET` and `SPACES_REGION` configure this
104+
application; they are not credential-provider variable names. Keep the exact names shown—
105+
renaming them to `SPACES_KEY`/`SPACES_SECRET` is not supported by this configuration.
106+
See [DigitalOcean's S3 SDK guide](https://docs.digitalocean.com/products/spaces/reference/aws-sdks/)
107+
and [Spaces key creation](https://docs.digitalocean.com/products/spaces/how-to/manage-access/).
108+
109+
Use a separate Spaces key for this worker with access to the intended bucket and the required
110+
read/write/delete operations. Do not paste a DigitalOcean personal API token, the key's display
111+
name, an endpoint URL, or the GitHub App key into either Spaces credential field.
112+
For example, the bucket origin `company-files.ams3.digitaloceanspaces.com` means
113+
`SPACES_BUCKET=company-files` and `SPACES_REGION=ams3`. Keep `SPACES_PREFIX=github-backup`
114+
unless you want a different folder; that prefix is your choice, not a secret to obtain elsewhere.
115+
88116
Optional values already have working defaults. **Change the region if your bucket is not in Frankfurt:**
89117

90118
```dotenv

‎compose.yaml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
services:
22
github-backup:
3-
build: .
3+
platform: linux/amd64
4+
build:
5+
context: .
6+
platforms: [linux/amd64]
47
# Build this checkout; published images before this feature lack the scheduler.
58
entrypoint: ["python", "-m", "github_backup.scheduler"]
69
command: []

‎docs/CLI.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ through the CLI. CLI defaults documented below differ from the scheduled deploym
4343
- [Requirements](#requirements)
4444
- [Quick start](#quick-start)
4545
- [Create a GitHub token](#create-a-github-token)
46-
- [Install on Debian, Ubuntu, or Raspberry Pi OS](#install-on-debian-ubuntu-or-raspberry-pi-os)
46+
- [Install on Ubuntu or Debian](#install-on-ubuntu-or-debian)
4747
- [Run with Docker](#run-with-docker)
4848
- [Configuration](#configuration)
4949
- [Storage backends](#storage-backends)
@@ -168,7 +168,7 @@ Runtime choices:
168168
- CodeQL, dependency review, Dependabot, OpenSSF Scorecard, immutable workflow-action pins, and
169169
Trivy container gates and automated release provenance provide additional supply-chain controls.
170170

171-
GitHub rate limits and upstream retention still apply. Lower `workers` for slow NAS devices, small Raspberry Pis, or constrained enterprise instances.
171+
GitHub rate limits and upstream retention still apply. Lower `workers` for slow NAS devices, resource-constrained servers, or constrained enterprise instances.
172172

173173
## Requirements
174174

@@ -265,7 +265,7 @@ sudo chmod 600 /etc/github-backup/environment
265265

266266
For Docker, pass this file with `--env-file`. Never commit a token, store it in TOML, pass it as a command argument, bake it into an image, or paste it into an issue. Rotate immediately after suspected exposure.
267267

268-
## Install on Debian, Ubuntu, or Raspberry Pi OS
268+
## Install on Ubuntu or Debian
269269

270270
Install a published version for production instead of an arbitrary `main` revision. The examples
271271
use `1.1.0`; replace it with the current version shown on the
@@ -312,11 +312,11 @@ sudo install -o root -g github-backup -m 0640 \
312312
/opt/github-backup/github-backup.example.toml /etc/github-backup/config.toml
313313
```
314314

315-
Set `destination = "/srv/github-backup"` and `cache_dir = "/var/cache/github-backup"` in `/etc/github-backup/config.toml`. On Raspberry Pi, prefer an SSD to an SD card and reduce `workers` to `1` or `2` when resources are constrained.
315+
Set `destination = "/srv/github-backup"` and `cache_dir = "/var/cache/github-backup"` in `/etc/github-backup/config.toml`. Prefer SSD storage and reduce `workers` to `1` when resources are constrained.
316316

317317
## Run with Docker
318318

319-
Install Docker using its official [Ubuntu](https://docs.docker.com/engine/install/ubuntu/), [Debian](https://docs.docker.com/engine/install/debian/), or [Raspberry Pi OS](https://docs.docker.com/engine/install/raspberry-pi-os/) guide. A simple distribution-package setup is:
319+
Install Docker Engine and the Compose plugin using the official [Ubuntu guide](https://docs.docker.com/engine/install/ubuntu/) on your Ubuntu 24.04+ x86_64 server. A simple distribution-package setup is:
320320

321321
```bash
322322
sudo apt update
@@ -327,7 +327,7 @@ sudo docker version
327327

328328
The Docker group is root-equivalent; examples use `sudo docker` instead of adding users to it.
329329

330-
For a published release, prefer the signed multi-architecture GHCR image and pin its digest in
330+
For a published release, prefer the signed x86_64 (`linux/amd64`) GHCR image and pin its digest in
331331
controlled deployments:
332332

333333
```bash
@@ -562,7 +562,7 @@ Inspect `coverage.json` in optional archives. `check --include all` checks the c
562562

563563
## Automate backups with systemd
564564

565-
systemd is recommended on Debian/Ubuntu/Raspberry Pi OS for protected secrets, missed-run recovery, exit monitoring, and journald logs. This example assumes the production paths above.
565+
systemd is recommended on Ubuntu/Debian servers for protected secrets, missed-run recovery, exit monitoring, and journald logs. This example assumes the production paths above.
566566

567567
Create the service:
568568

@@ -781,7 +781,7 @@ is reviewed and merged, the release workflow:
781781
fixable High/Critical vulnerabilities;
782782
4. creates wheel and source archives, an SPDX JSON SBOM, and `SHA256SUMS`;
783783
5. records GitHub/Sigstore provenance attestations;
784-
6. publishes `linux/amd64` and `linux/arm64` images with OCI provenance and SBOMs to GHCR;
784+
6. publishes the `linux/amd64` image with OCI provenance and SBOMs to GHCR;
785785
7. publishes the GitHub release only after every artifact job succeeds.
786786

787787
Verify downloaded files from one release directory:

0 commit comments

Comments
 (0)