Split volumes and add backup (WIP)

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2024-05-05 22:38:14 +02:00
parent 5e3b93ac20
commit 2eaaf1f936
No known key found for this signature in database
GPG Key ID: 15D0B1525584D383
9 changed files with 87 additions and 46 deletions

View File

@ -13,7 +13,7 @@
DOCKER := docker DOCKER := docker
PROFILES := webserver wordpress adminer uptime-kuma portainer qbittorrent gitea jellyfin watchtower PROFILES := webserver wordpress adminer uptime-kuma portainer qbittorrent gitea jellyfin watchtower backup
PROFILE_CMD := $(addprefix --profile ,$(PROFILES)) PROFILE_CMD := $(addprefix --profile ,$(PROFILES))
COMPOSE_FILES := $(shell find docker-compose*.yml | sed -e 's/^/--file /') COMPOSE_FILES := $(shell find docker-compose*.yml | sed -e 's/^/--file /')
@ -56,11 +56,14 @@ state:
docker compose $(COMPOSE_FILES) ps docker compose $(COMPOSE_FILES) ps
docker compose $(COMPOSE_FILES) top docker compose $(COMPOSE_FILES) top
.PHONY: update .PHONY: update-docker
update: update-docker:
docker compose $(COMPOSE_FILES) $(PROFILE_CMD) pull docker compose $(COMPOSE_FILES) $(PROFILE_CMD) pull
git submodule update --init --recursive --remote
git pull --recurse-submodules --all --progress .PHONY: update
update: update-docker
# git submodule update --init --recursive --remote
# git pull --recurse-submodules --all --progress
.PHONY: clean .PHONY: clean
clean: clean:

25
docker-compose.backup.yml Normal file
View File

@ -0,0 +1,25 @@
version: '3.9'
services:
# Backup
backup:
image: offen/docker-volume-backup:latest
container_name: backup
profiles:
- backup
restart: on-failure
env_file:
- env/backup.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- caddy_data:/backup/caddy_data:ro
- caddy_config:/backup/caddy_config:ro
- backup:/archive
networks:
- infra-network
security_opt:
- no-new-privileges:true
volumes:
backup:
name: backup

View File

@ -30,3 +30,8 @@ services:
# - SETUID # - SETUID
# - NET_BIND_SERVICE # - NET_BIND_SERVICE
volumes:
caddy_data:
name: caddy_data
caddy_config:
name: caddy_config

View File

@ -41,3 +41,11 @@ services:
- infra-network - infra-network
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
volumes:
gitea_data:
name: gitea_data
gitea_config:
name: gitea_config
gitea_db:
name: gitea_db

View File

@ -18,3 +18,11 @@ services:
- infra-network - infra-network
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
volumes:
jellyfin_config:
name: jellyfin_config
jellyfin_data:
name: jellyfin_data
jellyfin_cache:
name: jellyfin_cache

View File

@ -19,3 +19,9 @@ services:
- infra-network - infra-network
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
volumes:
qbittorrent_config:
name: qbittorrent_config
qbittorrent_data:
name: qbittorrent_data

View File

@ -1,29 +1,5 @@
version: '3.9' version: '3.9'
volumes: volumes:
database:
name: database
wordpress:
name: wordpress
caddy_data:
name: caddy_data
caddy_config:
name: caddy_config
qbittorrent_config:
name: qbittorrent_config
qbittorrent_data:
name: qbittorrent_data
uptimekuma_data: uptimekuma_data:
name: uptimekuma_data name: uptimekuma_data
gitea_data:
name: gitea_data
gitea_config:
name: gitea_config
gitea_db:
name: gitea_db
jellyfin_config:
name: jellyfin_config
jellyfin_data:
name: jellyfin_data
jellyfin_cache:
name: jellyfin_cache

View File

@ -21,23 +21,6 @@ services:
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
# Adminer
adminer:
image: adminer:latest
container_name: adminer
profiles:
- adminer
restart: on-failure
env_file:
- env/adminer.env
depends_on:
- wordpress_db
- caddy
networks:
- infra-network
security_opt:
- no-new-privileges:true
# Database wordpress # Database wordpress
wordpress_db: wordpress_db:
image: mariadb:latest image: mariadb:latest
@ -57,3 +40,26 @@ services:
- infra-network - infra-network
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
# Adminer
adminer:
image: adminer:latest
container_name: adminer
profiles:
- adminer
restart: on-failure
env_file:
- env/adminer.env
depends_on:
- wordpress_db
- caddy
networks:
- infra-network
security_opt:
- no-new-privileges:true
volumes:
database:
name: database
wordpress:
name: wordpress

4
env/backup.env vendored Normal file
View File

@ -0,0 +1,4 @@
BACKUP_COMPRESSION="zst"
BACKUP_CRON_EXPRESSION="0 2 * * *"
# BACKUP_RETENTION_DAYS: '7'
# BACKUP_FILENAME="backup-%Y-%m-%dT%H-%M-%S.{{ .Extension }}"