Compare commits

..

50 commits
v0.0.1 ... main

Author SHA1 Message Date
0ae4e4dee6
chore: nix flake update 2025-02-01 12:44:52 +01:00
32c2b63775
feat: upgrade postgres client to v17 2025-02-01 12:44:25 +01:00
semantic-release-bot
fa9e1e4526
chore(release): 0.14.0 [skip ci] 2024-12-15 20:06:34 +01:00
50438b4737
feat: update to kopia 0.18 2024-12-15 20:05:57 +01:00
semantic-release-bot
d49df9490b
chore(release): 0.13.0 [skip ci] 2024-03-04 14:48:12 +01:00
2e54c4f3a7
feat: upgrade to postgresql 15 2024-03-04 14:47:42 +01:00
786e1b5fc4
build: fix current semantic-release compatibility 2024-02-29 10:53:30 +01:00
semantic-release-bot
79c69793b8
chore(release): 0.12.0 [skip ci] 2024-02-29 10:51:21 +01:00
83f20d76c4
feat: update to kopia 0.15.0 2024-02-29 09:47:16 +01:00
6625f052ac
chore: nix flake update 2024-02-29 09:45:42 +01:00
semantic-release-bot
bde4645527
chore(release): 0.11.0 [skip ci] 2023-09-17 10:33:20 +02:00
62d0aeda3a
feat: upgrade to kopia 0.14 2023-09-17 10:33:00 +02:00
semantic-release-bot
518fe2ac49
chore(release): 0.10.0 [skip ci] 2023-08-24 11:00:52 +02:00
9547f357ce
feat: enable ftp backups 2023-08-24 10:58:04 +02:00
semantic-release-bot
d565465665
chore(release): 0.9.0 [skip ci] 2023-08-19 21:38:19 +02:00
a9c96d5854
feat: set backup path as arg 2023-08-19 12:13:19 +02:00
semantic-release-bot
6077666731
chore(release): 0.8.2 [skip ci] 2023-08-19 12:08:04 +02:00
37e9eec1d0
fix: remove ftp test 2023-08-19 12:07:45 +02:00
semantic-release-bot
1539a357b3
chore(release): 0.8.1 [skip ci] 2023-08-19 12:05:20 +02:00
4d7a1107c1
fix: print date at end of backup 2023-08-19 12:05:05 +02:00
semantic-release-bot
fbd294bc93
chore(release): 0.8.0 [skip ci] 2023-08-19 12:04:18 +02:00
90890fb5d3
feat: print time at start of backup 2023-08-19 12:03:58 +02:00
semantic-release-bot
160437f93e
chore(release): 0.7.0 [skip ci] 2023-08-18 21:19:59 +02:00
7adba5a4ab
feat: add postgresql-client 2023-08-18 21:19:37 +02:00
semantic-release-bot
421b277acf
chore(release): 0.6.1 [skip ci] 2023-08-18 21:11:33 +02:00
9ea4fc4489
fix: bump version 2023-08-18 21:11:16 +02:00
semantic-release-bot
efafb8c206
chore(release): 0.6.0 [skip ci] 2023-08-18 16:09:07 +02:00
62569d9abf
feat: run in cron or one-shot mode depending if KOPIA_CRON_SCHEDULE is set 2023-08-18 16:08:31 +02:00
semantic-release-bot
2be4717780
chore(release): 0.5.2 [skip ci] 2023-08-17 17:36:47 +02:00
59c6e28c2d
fix: use /etc/environment 2023-08-17 17:36:27 +02:00
semantic-release-bot
6da89c61fc
chore(release): 0.5.1 [skip ci] 2023-08-17 17:26:23 +02:00
73281c75b5
fix: open repository on container entry 2023-08-17 17:25:57 +02:00
semantic-release-bot
c887b11391
chore(release): 0.5.0 [skip ci] 2023-08-17 17:16:51 +02:00
2342c94ccd
feat: show backup log in docker log 2023-08-17 17:16:22 +02:00
semantic-release-bot
9dfb370dc9
chore(release): 0.4.0 [skip ci] 2023-08-17 17:13:34 +02:00
ee578dad39
feat: log to /var/log/kopia-backup.log 2023-08-17 17:13:14 +02:00
semantic-release-bot
2b390f1915
chore(release): 0.3.2 [skip ci] 2023-08-17 17:07:51 +02:00
bde3ea553f
fix: remove stdout redirect from crontab 2023-08-17 17:07:32 +02:00
semantic-release-bot
e268c20f89
chore(release): 0.3.1 [skip ci] 2023-08-17 17:04:10 +02:00
550e7857a6
fix: rename KOPIA_CRON_TIMES to KOPIA_CRON_SCHEDULE 2023-08-17 17:03:39 +02:00
semantic-release-bot
a31e7fca38
chore(release): 0.3.0 [skip ci] 2023-08-17 17:00:40 +02:00
6dc493b37e
feat: use cron to run backups 2023-08-17 17:00:22 +02:00
semantic-release-bot
d2a3aa0b32
chore(release): 0.2.2 [skip ci] 2023-08-17 12:09:35 +02:00
8d176abaea
fix: entrypoint 2023-08-17 12:09:17 +02:00
semantic-release-bot
0c4abe1922
chore(release): 0.2.1 [skip ci] 2023-08-17 10:53:59 +02:00
39f4506b27
fix: entrypoint 2023-08-17 10:53:39 +02:00
semantic-release-bot
5779b3ce01
chore(release): 0.2.0 [skip ci] 2023-08-17 10:48:03 +02:00
e8902aded4
feat: open repo on entry 2023-08-17 10:47:34 +02:00
semantic-release-bot
d355a06c10
chore(release): 0.1.0 [skip ci] 2023-08-17 10:39:27 +02:00
194be79fa6
feat: add entrypoint script 2023-08-17 10:35:51 +02:00
7 changed files with 89 additions and 14 deletions

12
.nix/flake.lock generated
View file

@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1692190437,
"narHash": "sha256-yJUZzmzSmDYb9ONPnMQDru66RjZgGQZRvj3tQebkexk=",
"lastModified": 1738297584,
"narHash": "sha256-AYvaFBzt8dU0fcSK2jKD0Vg23K2eIRxfsVXIPCW9a0E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9b2aa98db6b10503666a50f4eb93b2fc0d57bde5",
"rev": "9189ac18287c599860e878e905da550aa6dec1cd",
"type": "github"
},
"original": {

View file

@ -1 +1,29 @@
FROM kopia/kopia
FROM kopia/kopia:0.19
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y gnupg2 wget lsb-release
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get update && apt-get install -y cron postgresql-client-17 lftp && rm -rf /var/lib/apt/lists/*
ARG KOPIA_CRON_SCHEDULE
ENV KOPIA_CRON_SCHEDULE ${KOPIA_CRON_SCHEDULE}
ARG KOPIA_USERNAME
ENV KOPIA_USERNAME ${KOPIA_USERNAME}
ARG KOPIA_HOSTNAME
ENV KOPIA_HOSTNAME ${KOPIA_HOSTNAME}
ARG KOPIA_PASSWORD
ENV KOPIA_PASSWORD ${KOPIA_PASSWORD}
ARG KOPIA_BACKUP_PATH=/backup
ENV KOPIA_BACKUP_PATH ${KOPIA_BACKUP_PATH}
ADD run-backup.sh /
ADD entrypoint.sh /
ENTRYPOINT [ "/entrypoint.sh" ]

View file

@ -1,9 +1,10 @@
#!/usr/bin/env sh
SKIP=no-commit-to-branch,prettier CI=false npx semantic-release
VERSION="0.15.0"
VERSION=`npx semantic-release --version`
docker login git.molez.org
docker image build --tag git.molez.org/mandlm/kopia:${VERSION} --tag git.molez.org/mandlm/kopia:latest .
docker image push git.molez.org/mandlm/kopia:${VERSION}
docker image build --tag git.molez.org/mandlm/kopia:"${VERSION}" --tag git.molez.org/mandlm/kopia:latest .
docker image push git.molez.org/mandlm/kopia:"${VERSION}"
docker image push git.molez.org/mandlm/kopia:latest

21
entrypoint.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
if [[ -z ${KOPIA_CRON_SCHEDULE} ]];
then
echo "Running in one-shot mode"
/run-backup.sh
else
CRONTAB=/etc/cron.d/kopia-backup
printenv > /etc/environment
echo "Running cron with schedule ${KOPIA_CRON_SCHEDULE}"
echo "${KOPIA_CRON_SCHEDULE} /run-backup.sh > /var/log/kopia-backup.log 2>&1" > ${CRONTAB}
chmod 0644 ${CRONTAB}
crontab ${CRONTAB}
touch /var/log/kopia-backup.log
cron && tail -f /var/log/kopia-backup.log
fi

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "kopia",
"version": "0.0.1",
"version": "0.14.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "kopia",
"version": "0.0.1",
"version": "0.14.0",
"devDependencies": {
"@semantic-release/git": "^10.0.1",
"semantic-release": "^21.0.2"

View file

@ -1,6 +1,6 @@
{
"name": "kopia",
"version": "0.0.1",
"version": "0.14.0",
"private": true,
"devDependencies": {
"@semantic-release/git": "^10.0.1",

25
run-backup.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
echo "Running backup at $(date)"
if [[ -v KOPIA_PG_DATABASE ]];
then
echo "Dumping database ${KOPIA_PG_DATABASE}"
PGPASSWORD=$KOPIA_PG_PASSWORD pg_dump --host=$KOPIA_PG_HOST --username=$KOPIA_PG_USER $KOPIA_PG_DATABASE > /backup/database/$KOPIA_PG_DATABASE.sqldump || exit 1
fi
if [[ -v KOPIA_FTP_HOST ]];
then
echo "Downloading from ftp server ${KOPIA_FTP_HOST}"
lftp -u "$KOPIA_FTP_USER","$KOPIA_FTP_PASSWORD" -e "set ssl:verify-certificate no; mirror --delete --parallel=4 --use-pget-n=10 / /backup/ftp;" $KOPIA_FTP_HOST || exit 1
fi
kopia repository connect filesystem \
--path /repository \
--override-hostname ${KOPIA_HOSTNAME} \
--override-username ${KOPIA_USERNAME}
kopia snapshot create ${KOPIA_BACKUP_PATH}
echo "Finished backup at $(date)"