Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
120 lines (105 loc) · 4.74 KB
/
Copy path.env.example
File metadata and controls
120 lines (105 loc) · 4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Copy this file to .env (next to dbbackup.py) and adjust the values:
# cp .env.example .env && chmod 600 .env
# Or pass a different file with: ./dbbackup.py --env-file /path/to/file.env
#
# Variables already set in the environment take precedence over this file.
# Put comments on their own line; "KEY=value # comment" is read as part of the value.
# ---------------------------------------------------------------
# Databases
# ---------------------------------------------------------------
# Comma or space separated list of database names, the path to a file
# containing one database name per line, or "all" for every database on the
# server except information_schema, performance_schema, sys and mysql
# (list those explicitly if you want them).
DB_NAMES=db_name_to_backup
#DB_NAMES=/backup/dbnameslist.txt
#DB_NAMES=all
# Databases to skip, comma or space separated. Wildcards are allowed.
#DB_EXCLUDE=test_*, staging_db
# Local directory for backups. A sub-folder like 20260910-123433 is created per run.
BACKUP_PATH=/backup/dbbackup
# Extra options passed to mysqldump. --single-transaction gives a consistent
# snapshot of InnoDB tables without locking them.
MYSQLDUMP_OPTS=--single-transaction --routines --triggers
# gzip/pigz compression level, 1 (fastest) to 9 (smallest).
COMPRESS_LEVEL=6
# ---------------------------------------------------------------
# Retention
# ---------------------------------------------------------------
# Each target (LOCAL_, S3_, SCP_) has its own *_RETENTION_DAYS and
# *_RETENTION_COUNT. A backup is deleted only when it is older than
# RETENTION_DAYS *and* not one of the newest RETENTION_COUNT backups, so
# COUNT also acts as a safety net if backups stop running for a while.
# Either one can be used alone. Empty or 0 disables it.
#
# Cleanup is skipped when any database failed in the current run, and only
# folders named like 20260910-123433 are ever deleted.
LOCAL_RETENTION_DAYS=7
LOCAL_RETENTION_COUNT=3
# ---------------------------------------------------------------
# MySQL connection
# ---------------------------------------------------------------
MYSQL_HOST=localhost
#MYSQL_PORT=3306
#MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
# Set to false to skip user/password and rely on ~/.my.cnf or socket
# authentication (e.g. running as root with auth_socket on Ubuntu/Debian).
MYSQL_AUTH_ENABLED=true
MYSQL_USER=root
MYSQL_PASSWORD=_mysql_user_password_
# ---------------------------------------------------------------
# Amazon S3 / S3-compatible upload
# ---------------------------------------------------------------
# Uses boto3 when installed (pip install boto3), otherwise the aws CLI.
S3_ENABLED=false
S3_BUCKET=my-backup-bucket
# Files are uploaded to s3://S3_BUCKET/S3_PREFIX/<run folder>/<db>.sql.gz
S3_PREFIX=mysql
# e.g. STANDARD_IA, GLACIER_IR, DEEP_ARCHIVE. Leave empty for STANDARD.
S3_STORAGE_CLASS=
# For S3-compatible storage (MinIO, Wasabi, DigitalOcean Spaces, Backblaze B2...).
S3_ENDPOINT_URL=
# Retention for backups under s3://S3_BUCKET/S3_PREFIX/ (see Retention above).
# An S3 lifecycle rule on the prefix is an alternative for day-based cleanup.
S3_RETENTION_DAYS=30
S3_RETENTION_COUNT=7
# Leave these unset to use ~/.aws/credentials or an EC2/ECS instance role.
#AWS_ACCESS_KEY_ID=
#AWS_SECRET_ACCESS_KEY=
#AWS_DEFAULT_REGION=us-east-1
# ---------------------------------------------------------------
# SCP upload to a remote server
# ---------------------------------------------------------------
# Requires key-based SSH login; password prompts are disabled so cron never hangs.
SCP_ENABLED=false
SCP_HOST=backup.example.com
SCP_PORT=22
SCP_USER=backup
SCP_KEY_FILE=~/.ssh/id_ed25519
# Absolute path on the remote server; created if missing.
SCP_REMOTE_PATH=/backup/mysql
# Retention for backup folders in SCP_REMOTE_PATH (see Retention above).
SCP_RETENTION_DAYS=30
SCP_RETENTION_COUNT=7
# ---------------------------------------------------------------
# Alerts
# ---------------------------------------------------------------
# Notifications are sent when a dump, upload or retention cleanup fails,
# or the configuration is invalid. Set to true to also get one on success.
ALERT_ON_SUCCESS=false
# Webhook that accepts {"text": "..."}: Slack, Mattermost, Rocket.Chat,
# Google Chat. For Discord, add /slack to the end of the webhook URL.
ALERT_WEBHOOK_URL=
# Healthchecks.io (or self-hosted Healthchecks) ping URL. Pinged on every run:
# <url> on success, <url>/fail on failure. It also alerts you when the
# backup doesn't run at all, which the other alerts can't do.
HEALTHCHECK_URL=
# Email alerts. Several recipients can be comma separated.
ALERT_EMAIL_TO=
#ALERT_EMAIL_FROM=dbbackup@example.com
SMTP_HOST=
# starttls (port 587), ssl (port 465) or none (port 25).
SMTP_SECURITY=starttls
#SMTP_PORT=587
SMTP_USER=
SMTP_PASSWORD=