db-backup-s3/docker-compose.yaml

115 lines
3.1 KiB
YAML

# this file is here to facilitate development/testing
# $ docker compose up -d --build --force-recreate
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
mysql:
image: mysql:8.0
environment:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: database
MYSQL_ROOT_PASSWORD: root_password
mssql:
platform: linux/amd64
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: YourStrong@Passw0rd
MSSQL_PID: Express
ports:
- "11433:1433" # Use port 11433 externally to avoid conflicts
volumes:
- mssql-data:/var/opt/mssql # Database storage and backup location (shared with backup container)
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
ports:
- 9000:9000
- 9001:9001
environment:
MINIO_ROOT_USER: miniouser
MINIO_ROOT_PASSWORD: minioroot
volumes:
- minio-data:/data
backup-postgres:
build:
context: .
args:
ALPINE_VERSION: "3.21"
environment:
# SCHEDULE: '@weekly' # optional
BACKUP_KEEP_DAYS: 7 # optional
PASSPHRASE: passphrase # optional
# S3_REGION:
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY_ID: miniouser
S3_SECRET_ACCESS_KEY: minioroot
S3_BUCKET: backups
S3_PREFIX: postgres-backups
DATABASE_HOST: postgres
DATABASE_NAME: user
DATABASE_USER: user
DATABASE_PORT: 5432
DATABASE_SERVER: postgres
DATABASE_PASSWORD: password
backup-mysql:
build:
context: .
args:
ALPINE_VERSION: "3.21"
environment:
# SCHEDULE: '@weekly' # optional
BACKUP_KEEP_DAYS: 7 # optional
PASSPHRASE: passphrase # optional
# S3_REGION:
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY_ID: miniouser
S3_SECRET_ACCESS_KEY: minioroot
S3_BUCKET: backups
S3_PREFIX: mysql-backups
DATABASE_HOST: mysql
DATABASE_NAME: database
DATABASE_USER: root
DATABASE_PORT: 3306
DATABASE_SERVER: mysql
DATABASE_PASSWORD: root_password
backup-mssql:
platform: linux/amd64
build:
context: .
args:
ALPINE_VERSION: "3.21"
volumes:
- mssql-data:/var/opt/mssql # Shared volume for native BACKUP DATABASE command
environment:
# SCHEDULE: '@weekly' # optional
BACKUP_KEEP_DAYS: 7 # optional
# PASSPHRASE: passphrase # optional - uncomment to enable GPG encryption
# S3_REGION:
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY_ID: miniouser
S3_SECRET_ACCESS_KEY: minioroot
S3_BUCKET: backups
S3_PREFIX: mssql-backups
DATABASE_HOST: mssql
DATABASE_NAME: TestDB
DATABASE_USER: sa
DATABASE_PORT: 1433
DATABASE_SERVER: mssql
DATABASE_PASSWORD: YourStrong@Passw0rd
MSSQL_DATA_DIR: /var/opt/mssql/data # Path where MSSQL backups are stored (must match volume mount)
volumes:
mssql-data: # MSSQL database storage
minio-data: # MinIO object storage