Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions backup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ ARG RCLONE_VERSION
RUN apk add --no-cache \
curl \
unzip
RUN curl -O https://raw.githubusercontent.com/simplepush/send-encrypted/master/simplepush.sh
RUN curl -O https://downloads.rclone.org/${RCLONE_VERSION}/rclone-${RCLONE_VERSION}-linux-amd64.zip

RUN unzip -j rclone-${RCLONE_VERSION}-linux-amd64.zip
RUN chmod 0700 simplepush.sh
RUN chmod 0700 rclone

FROM ghcr.io/borgmatic-collective/borgmatic:${BORGMATIC_VERSION}
COPY --from=builder simplepush.sh /usr/local/bin/
COPY --from=builder rclone /usr/local/bin/
RUN apk add openssl
RUN apk add --no-cache curl openssl
58 changes: 41 additions & 17 deletions backup/borgmatic.d/config.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
source_directories:
- /mnt/source
- /mnt/vaultwarden/attachments

repositories:
- /mnt/borg-repository
- path: /mnt/borg-repository

one_file_system: true
archive_name_format: 'backup-{now}'

keep_hourly: 2
keep_daily: 7
keep_weekly: 4
keep_monthly: 12
keep_yearly: 10

checks:
- repository
- archives
- name: repository
- name: archives

check_last: 3
before_backup:
- echo "Starting a backup job..."
after_backup:
- echo "Backup created..."
after_actions:
- echo "Uploading backup..."
- rclone sync /mnt/borg-repository nextcloud:nextcloud-backup -P --dry-run
- rclone sync /mnt/borg-repository nextcloud:nextcloud-backup -v
- simplepush.sh -t "Backup done" -m "Creation and uploading of backup successful"
on_error:
- echo "Error while creating a backup."
- simplepush.sh -t "Error creating backup" -m "Creation of backup failed. Check borgmatic logs."

commands:
- before: action
when:
- create
run:
- echo "Starting a backup job..."

- after: action
when:
- create
run:
- echo "Backup created..."

- after: action
when:
- create
- prune
- compact
- check
run:
- echo "Uploading backup..."
- rclone sync /mnt/borg-repository nextcloud:nextcloud-backup -P --dry-run
- rclone sync /mnt/borg-repository nextcloud:nextcloud-backup -v
- 'curl -d "Creation and uploading of backup successful" -H "Title: Backup done" ${NTFY_URL}/${NTFY_TOPIC}'

- after: error
run:
- echo "Error while creating a backup."
- 'curl -d "Creation of backup failed. Check borgmatic logs." -H "Title: Error creating backup" ${NTFY_URL}/${NTFY_TOPIC}'

mariadb_databases:
- name: all
hostname: db
port: 3306
username: root

sqlite_databases:
- name: vaultwarden
path: /mnt/vaultwarden/db.sqlite3

path: /mnt/vaultwarden/db.sqlite3
31 changes: 25 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ services:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- NEXTCLOUD_DATABASE=nextcloud
- MYSQL_PWD=${MYSQL_ROOT_PASSWORD}
- SIMPLEPUSH_KEY
- SIMPLEPUSH_PASSWORD
- SIMPLEPUSH_SALT
- NTFY_TOPIC=${NTFY_TOPIC}
- NTFY_URL=http://ntfy:80
- RCLONE_CONFIG_NEXTCLOUD_TYPE
- RCLONE_CONFIG_NEXTCLOUD_PROVIDER
- RCLONE_CONFIG_NEXTCLOUD_ACL
Expand All @@ -106,6 +105,25 @@ services:
- backups
- default

ntfy:
image: binwiederhier/ntfy
restart: always
command: serve
volumes:
- ntfy_cache:/var/cache/ntfy
- ntfy_config:/etc/ntfy
environment:
- TZ=${TZ}
- NTFY_BASE_URL=https://${NTFY_PREFIX}.${DNS_ADDRESS}
- NTFY_BEHIND_PROXY=true
- VIRTUAL_HOST=${NTFY_PREFIX}.${DNS_ADDRESS}
- VIRTUAL_PORT=80
- LETSENCRYPT_HOST=${NTFY_PREFIX}.${DNS_ADDRESS}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
networks:
- backups
- proxy-tier

proxy:
build: ./proxy
restart: always
Expand All @@ -117,7 +135,7 @@ services:
volumes:
- certs:/etc/nginx/certs:ro
- acme:/etc/acme.sh
- vhost.d:/etc/nginx/vhost.d
- ./proxy/vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
Expand All @@ -130,7 +148,7 @@ services:
restart: always
volumes:
- certs:/etc/nginx/certs
- vhost.d:/etc/nginx/vhost.d
- ./proxy/vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- acme:/etc/acme.sh
- /var/run/docker.sock:/var/run/docker.sock:ro
Expand All @@ -144,11 +162,12 @@ volumes:
nextcloud:
certs:
acme:
vhost.d:
html:
borg-cache:
borg-config:
vaultwarden:
ntfy_cache:
ntfy_config:

networks:
proxy-tier:
Expand Down
7 changes: 7 additions & 0 deletions proxy/vhost.d/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
location ^~ /.well-known/acme-challenge/ {
auth_basic off;
allow all;
root /usr/share/nginx/html;
try_files $uri =404;
break;
}