diff --git a/.gitmodules b/.gitmodules index e887ff7..f8c8b33 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,3 +8,6 @@ [submodule "custom/faulty-site"] path = custom/faulty-site url = git@git.ixvd.net:didier/site +[submodule "custom/backups/repo"] + path = custom/backups/repo + url = https://git.bits.team/Bits/bits-backups diff --git a/custom/backups/Dockerfile b/custom/backups/Dockerfile index 61d1905..2057fa9 100755 --- a/custom/backups/Dockerfile +++ b/custom/backups/Dockerfile @@ -1,39 +1,18 @@ -FROM alpine:latest +FROM rust AS builder -MAINTAINER Didier -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 \ No newline at end of file + +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"] diff --git a/custom/backups/config/config.toml b/custom/backups/config/config.toml new file mode 100644 index 0000000..89c4193 --- /dev/null +++ b/custom/backups/config/config.toml @@ -0,0 +1,7 @@ +tasks_dir = "tasks" + +[ftp] +hostname = "u303160.your-storagebox.de" +username = "u303160-sub2" +password = "emFXcCedActkOxDS" + diff --git a/custom/backups/config/tasks/00-general.toml b/custom/backups/config/tasks/00-general.toml new file mode 100644 index 0000000..ea4faaf --- /dev/null +++ b/custom/backups/config/tasks/00-general.toml @@ -0,0 +1,29 @@ +# name +name = "general" + +# cron as in https://lib.rs/crate/cron +# +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 = [] + diff --git a/custom/backups/config/tasks/10-minecraft.toml b/custom/backups/config/tasks/10-minecraft.toml new file mode 100644 index 0000000..2ee62b5 --- /dev/null +++ b/custom/backups/config/tasks/10-minecraft.toml @@ -0,0 +1,30 @@ +# name +name = "minecraft" + +# cron as in https://lib.rs/crate/cron +# +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 = [] + diff --git a/custom/backups/repo b/custom/backups/repo new file mode 160000 index 0000000..51b987f --- /dev/null +++ b/custom/backups/repo @@ -0,0 +1 @@ +Subproject commit 51b987fa1e1e3a0991a31f97b57b67be9ad5613f