Skip to content
Merged
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
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PRE_COMMIT_VERSION ?= 4.3.0
# Env file is always instances/$(PROJECT_NAME).env — generated by scripts/generate-env.sh.
PROJECT_NAME ?= $(notdir $(CURDIR))
ENV_FILE = instances/$(PROJECT_NAME).env
BACKUP_DIR ?= ./backups/$(PROJECT_NAME)

.PHONY: init playwright test reinit check backup-database backup-file-storage backup restore-database restore-file-storage restore docs generate-stack-envs create-instance launch-postgres launch-instance launch-traefik launch-monitoring ensure-networks stop-instance clean clean-all config get-backup-timestamp

Expand Down Expand Up @@ -48,7 +49,7 @@ POSTGRES_COMPOSE_CMD = docker compose \
--env-file $(ENV_FILE) \
-f stacks/postgres/docker-compose.yml

BACKUP_COMPOSE_CMD = docker compose \
BACKUP_COMPOSE_CMD = BACKUP_DIR=$(BACKUP_DIR) docker compose \
--project-name $(PROJECT_NAME) \
--env-file $(ENV_FILE) \
-f docker-compose.yml \
Expand All @@ -58,11 +59,11 @@ get-backup-timestamp:
@echo $(BACKUP_TIMESTAMP)

backup-database:
mkdir -p ./backups
mkdir -p $(BACKUP_DIR)
$(BACKUP_COMPOSE_CMD) run -e BACKUP_TIMESTAMP=$(BACKUP_TIMESTAMP) --rm backup-database

backup-file-storage:
mkdir -p ./backups
mkdir -p $(BACKUP_DIR)
$(BACKUP_COMPOSE_CMD) run -e BACKUP_TIMESTAMP=$(BACKUP_TIMESTAMP) --rm backup-file-storage

backup: backup-database backup-file-storage
Expand Down
8 changes: 4 additions & 4 deletions stacks/backup/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ x-file-storage-image: &file-storage-image
services:
backup-database:
volumes:
- ./backups:/backups
- ${BACKUP_DIR}:/backups
- ./scripts/backup-database.sh:/backup-database.sh:ro
environment:
# -- Database hostname
Expand All @@ -32,7 +32,7 @@ services:
backup-file-storage:
volumes:
- dhis2:/opt/dhis2:ro
- ./backups:/backups
- ${BACKUP_DIR}:/backups
- ./scripts/backup-file-storage.sh:/backup-file-storage.sh:ro
environment:
# -- Backup timestamp. Used to name the backup directory and the backup file. Since those are created by different containers, we need to ensure the backup timestamp is the same for both containers.
Expand All @@ -48,7 +48,7 @@ services:

restore-database:
volumes:
- ./backups:/backups:ro
- ${BACKUP_DIR}:/backups:ro
- ./scripts/restore-database.sh:/restore-database.sh:ro
- ./scripts/fix-ownership.sh:/fix-ownership.sh:ro
environment:
Expand Down Expand Up @@ -76,7 +76,7 @@ services:
restore-file-storage:
volumes:
- dhis2:/opt/dhis2
- ./backups:/backups:ro
- ${BACKUP_DIR}:/backups:ro
- ./scripts/restore-file-storage.sh:/restore-file-storage.sh:ro
environment:
# -- Directory to restore from
Expand Down
Loading