Skip to content

Commit d0d05a7

Browse files
committed
Upgrade components
- Upgrade to bookworm (not trixie because we need Python 3.11) - Isolate Python in a venv - Use Python 3.11 since our borgmatic version needs it - Upgrade to PostgreSQL 18 - Upgrade other dependencies - Do not upgrade borgmatic, not sure about how to do it correctly (might require Borg v2)
1 parent 5276e8e commit d0d05a7

8 files changed

Lines changed: 76 additions & 21 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- upgrade
7+
8+
jobs:
9+
build-and-push:
10+
name: Deploy Docker Upgrade Image
11+
permissions:
12+
contents: read
13+
packages: write
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@v6
17+
- name: Build and push
18+
uses: openzim/docker-publish-action@v10
19+
with:
20+
restrict-to: kiwix/borg-backup
21+
image-name: kiwix/borg-backup
22+
manual-tag: upgrade
23+
registries: ghcr.io
24+
credentials:
25+
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
26+
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
27+
repo_description: auto
28+
repo_overview: auto

.github/workflows/docker.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ on:
88
jobs:
99
build-and-push:
1010
name: Deploy Docker Image
11-
runs-on: ubuntu-22.04
11+
permissions:
12+
contents: read
13+
packages: write
14+
runs-on: ubuntu-24.04
1215
steps:
13-
- uses: actions/checkout@v3.4.0
16+
- uses: actions/checkout@v6
1417
- name: Build and push
1518
uses: openzim/docker-publish-action@v10
1619
with:

.github/workflows/test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Docker
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test-build:
8+
name: Test Docker Image Build
9+
permissions:
10+
contents: read
11+
runs-on: ubuntu-24.04
12+
steps:
13+
- uses: actions/checkout@v6
14+
15+
- name: Build the Docker image
16+
run: |
17+
docker build -t local-borg-backup .

Dockerfile

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM debian:bullseye-slim
2-
LABEL org.opencontainers.image.source https://github.com/kiwix/borg-backup
1+
FROM debian:bookworm-slim
2+
LABEL org.opencontainers.image.source=https://github.com/kiwix/borg-backup
33
#
44
# Author : Florent Kaisser <florent.pro@kaisser.name>
55
#
@@ -31,37 +31,41 @@ ENV DATABASES_OPTIONS=""
3131
ENV MAX_BORGMATIC_RETRY="10"
3232
ENV WAIT_BEFORE_BORGMATIC_RETRY="30"
3333
# for k8s cluster data backup
34-
ARG KUBECTL_VERSION="1.23.3"
34+
ARG KUBECTL_VERSION="1.34.2"
3535

3636
RUN apt-get update && \
3737
apt-get install -y --no-install-recommends bash curl borgbackup vim \
3838
python3 python3-pip python3-setuptools openssh-client unzip git cron \
39-
default-mysql-client \
40-
dnsutils bind9utils tar xz-utils gzip bzip2 coreutils grep lsb-release gnupg2 && \
41-
# install postgresql-18 \
42-
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main 18" > /etc/apt/sources.list.d/pgdg.list && \
43-
curl -Ls https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
39+
default-mysql-client ca-certificates \
40+
dnsutils bind9utils tar xz-utils gzip bzip2 coreutils grep lsb-release gnupg2 \
41+
python3.11-venv && \
42+
install -d /usr/share/postgresql-common/pgdg && \
43+
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc && \
44+
. /etc/os-release && \
45+
sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-pgdg main' > /etc/apt/sources.list.d/pgdg.list" && \
4446
apt-get update && \
4547
apt-get install -y --no-install-recommends -y postgresql-client-18 && \
46-
curl -Ls https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian10-x86_64-100.5.2.deb -o mongo-tools.deb && \
48+
curl -Ls https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-x86_64-100.14.1.deb -o mongo-tools.deb && \
4749
apt-get install -y --no-install-recommends -y ./mongo-tools.deb && \
4850
rm -f ./mongo-tools.deb && \
4951
apt-get clean -y && \
5052
rm -rf /var/lib/apt/lists/* && \
51-
curl -Ls 'https://github.com/bitwarden/cli/releases/download/v1.19.1/bw-linux-1.19.1.zip' -o bitwarden.zip && \
53+
curl -Ls 'https://github.com/bitwarden/cli/releases/download/v1.22.1/bw-linux-1.22.1.zip' -o bitwarden.zip && \
5254
unzip bitwarden.zip && rm -f bitwarden.zip && chmod +x bw && mv bw /usr/local/bin/ && \
55+
python3.11 -m venv /app/kiwix-python && \
56+
. /app/kiwix-python/bin/activate && \
5357
git clone --depth=1 --branch=master https://github.com/borgbase/borgbase-api-client.git && \
54-
mv borgbase-api-client/borgbase_api_client/ /usr/lib/python3/dist-packages/ && \
58+
mv borgbase-api-client/borgbase_api_client/ /app/kiwix-python/lib/python3.11/site-packages/ && \
5559
rm -rf borgbase-api-client && \
56-
pip3 install --no-cache-dir --upgrade requests==2.27.1 borgmatic==1.5.24 jsonschema==4.4.0 pyrsistent==0.18.1 && \
57-
curl -sLo /usr/bin/jq "https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64" && \
60+
pip3 install --no-cache-dir --upgrade requests==2.27.1 borgmatic==1.5.24 jsonschema==4.4.0 pyrsistent==0.18.1 && \
61+
curl -sLo /usr/bin/jq "https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-linux64" && \
5862
chmod +x /usr/bin/jq && \
59-
curl -sLo /usr/bin/yq "https://github.com/mikefarah/yq/releases/download/v4.20.2/yq_linux_amd64" && \
63+
curl -sLo /usr/bin/yq "https://github.com/mikefarah/yq/releases/download/v4.52.4/yq_linux_amd64" && \
6064
chmod +x /usr/bin/yq && \
6165
curl -sLo /usr/bin/kubectl \
6266
"https://storage.googleapis.com/kubernetes-release/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl" && \
6367
chmod +x /usr/bin/kubectl && \
64-
curl -sLo /usr/bin/kube-dump "https://raw.githubusercontent.com/WoozyMasta/kube-dump/1.1.1/kube-dump" && \
68+
curl -sLo /usr/bin/kube-dump "https://raw.githubusercontent.com/WoozyMasta/kube-dump/1.1.2/kube-dump" && \
6569
chmod +x /usr/bin/kube-dump
6670

6771
# Entrypoint for k8s mode

bin/backup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
1313
function init_cron {
1414
BORGMATIC_CRON="/etc/crontab"
1515
BORGMATIC_CONFIG="/root/.config/borgmatic/config.yaml"
16-
BORGMATIC_CMD="/usr/bin/flock -w 0 /dev/shm/cron.lock /usr/local/bin/borgmatic -c ${BORGMATIC_CONFIG} --verbosity 1 --files"
16+
BORGMATIC_CMD="/usr/bin/flock -w 0 /dev/shm/cron.lock /app/kiwix-python/bin/borgmatic -c ${BORGMATIC_CONFIG} --verbosity 1 --files"
1717
BORGMATIC_LOG_FILE="/dev/shm/borgmatic.log"
1818

1919
CRON_MONTH="*"

bin/init_borgbase_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3
1+
#!/app/kiwix-python/bin/python
22
#
33
# Author : Florent Kaisser <florent.pro@kaisser.name>
44
#
@@ -264,7 +264,7 @@ def main(
264264
time.sleep(delay)
265265
ret = subprocess.call(
266266
[
267-
"/usr/local/bin/borgmatic",
267+
"/app/kiwix-python/bin/borgmatic",
268268
"-c",
269269
BORGMATIC_CONFIG,
270270
"-v",

bin/single-backup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function main {
2323

2424
echo "Initialization complete, running borgmatic ..."
2525

26-
/usr/local/bin/borgmatic -c /root/.config/borgmatic/config.yaml --verbosity 1 --files
26+
/app/kiwix-python/bin/borgmatic -c /root/.config/borgmatic/config.yaml --verbosity 1 --files
2727
}
2828

2929
function usage {

entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/sh
22
set -e
33

4+
# activate Python venv
5+
. /app/kiwix-python/bin/activate
6+
47
mkdir -p /storage
58

69
if [ ! -z "${CLI_MODE}" ] ; then

0 commit comments

Comments
 (0)