new backup sw
This commit is contained in:
parent
7f38106002
commit
b3840c5037
6 changed files with 86 additions and 37 deletions
|
@ -1,39 +1,18 @@
|
|||
FROM alpine:latest
|
||||
FROM rust AS builder
|
||||
|
||||
MAINTAINER Didier <dev@faulty.nl>
|
||||
LABEL Description="Faulty's (totally original) backup app"
|
||||
|
||||
# Add a non root user
|
||||
RUN adduser -s /bin/sh -D backups
|
||||
RUN addgroup containers
|
||||
RUN addgroup backups containers
|
||||
|
||||
# python
|
||||
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
|
||||
|
||||
# directories
|
||||
RUN mkdir /app
|
||||
RUN mkdir /config
|
||||
RUN mkdir /data
|
||||
RUN mkdir /remote
|
||||
RUN mkdir /local
|
||||
|
||||
# chown
|
||||
RUN chown -R backups:containers /app
|
||||
RUN chown -R backups:containers /config
|
||||
RUN chown -R backups:containers /data
|
||||
RUN chown -R backups:containers /local
|
||||
RUN chown -R backups:containers /remote
|
||||
|
||||
# copy files
|
||||
COPY ./repo/src/main.py /app/main.py
|
||||
COPY ./repo/src/lib /app/lib
|
||||
COPY ./repo/src/sample_configs /app/default_config
|
||||
|
||||
# copy config
|
||||
COPY ./config /config
|
||||
|
||||
USER backups
|
||||
WORKDIR /app
|
||||
ENV PYTHONUNBUFFERED=true
|
||||
ENTRYPOINT python3 main.py
|
||||
|
||||
COPY ./repo /app
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
COPY --from=builder /app/target/release/bits-backups /app/bits-backups
|
||||
|
||||
COPY ./config/config.toml /app/config.toml
|
||||
|
||||
COPY ./config/tasks/* /app/tasks/
|
||||
|
||||
WORKDIR /app
|
||||
ENTRYPOINT ["/app/bits-backups"]
|
||||
|
|
7
custom/backups/config/config.toml
Normal file
7
custom/backups/config/config.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
tasks_dir = "tasks"
|
||||
|
||||
[ftp]
|
||||
hostname = "u303160.your-storagebox.de"
|
||||
username = "u303160-sub2"
|
||||
password = "emFXcCedActkOxDS"
|
||||
|
29
custom/backups/config/tasks/00-general.toml
Normal file
29
custom/backups/config/tasks/00-general.toml
Normal file
|
@ -0,0 +1,29 @@
|
|||
# name
|
||||
name = "general"
|
||||
|
||||
# cron as in https://lib.rs/crate/cron
|
||||
# <second> <minute> <hours> <day of month> <month> <day of the week>
|
||||
cron = "0 0 0 2 * *"
|
||||
|
||||
# retention on local server
|
||||
local_retention_time = "1d"
|
||||
|
||||
# retention on the ftp server
|
||||
remote_retention_time = "60d"
|
||||
|
||||
# ??? - Likely the local path
|
||||
backups_dir = "/data/backups"
|
||||
|
||||
# base dir of what to backup
|
||||
base_dir = "/host/srv"
|
||||
paths = [
|
||||
"cryptpad",
|
||||
"gitlab",
|
||||
"dendrite"
|
||||
]
|
||||
|
||||
# run pre-backup
|
||||
pre_commands = []
|
||||
# run post-backup
|
||||
post_commands = []
|
||||
|
30
custom/backups/config/tasks/10-minecraft.toml
Normal file
30
custom/backups/config/tasks/10-minecraft.toml
Normal file
|
@ -0,0 +1,30 @@
|
|||
# name
|
||||
name = "minecraft"
|
||||
|
||||
# cron as in https://lib.rs/crate/cron
|
||||
# <second> <minute> <hours> <day of month> <month> <day of the week>
|
||||
cron = "0 0 0 2 * *"
|
||||
|
||||
# retention on local server
|
||||
local_retention_time = "1d"
|
||||
|
||||
# retention on the ftp server
|
||||
remote_retention_time = "30d"
|
||||
|
||||
# ??? - Likely the local path
|
||||
backups_dir = "/data/backups"
|
||||
|
||||
# base dir of what to backup
|
||||
base_dir = "/host/srv"
|
||||
paths = [
|
||||
"smpxmc",
|
||||
"vanilla",
|
||||
"smpxterraria",
|
||||
"enneacraft"
|
||||
]
|
||||
|
||||
# run pre-backup
|
||||
pre_commands = []
|
||||
# run post-backup
|
||||
post_commands = []
|
||||
|
1
custom/backups/repo
Submodule
1
custom/backups/repo
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 51b987fa1e1e3a0991a31f97b57b67be9ad5613f
|
Reference in a new issue