mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2026-11-13 16:47:14 +00:00
feat: mysql-bkup v2 on bkupkit
MysQL backup and restore built on the shared bkupkit core: streaming end to end, with no dump held in memory or written to local disk.
This commit is contained in:
1 parent
ccb3fcdf26
commit
28de0d7b52
65 files changed
+3453
-3871
No files matched your search
@@ -23,15 +23,16 @@ This section explains how to set up and configure SSH-based backups.
|
||||
3. **Required Environment Variables**
|
||||
The following environment variables are mandatory for SSH-based backups:
|
||||
|
||||
- `SSH_HOST`: The hostname or IP address of the remote server.
|
||||
- `SSH_USER`: The username for SSH authentication.
|
||||
- `SFTP_HOST`: The hostname or IP address of the remote server.
|
||||
- `SFTP_USER`: The username for SSH authentication.
|
||||
- `REMOTE_PATH`: The directory on the remote server where backups will be stored.
|
||||
- `SSH_IDENTIFY_FILE`: The path to the private key file for SSH authentication.
|
||||
- `SSH_PORT`: The SSH port (default is `22`).
|
||||
- `SSH_PASSWORD`: (Optional) Use this only if you are not using a private key for authentication.
|
||||
- `SFTP_IDENTITY_FILE`: The path to the private key file for SSH authentication (`SFTP_IDENTITY_FILE` still works).
|
||||
- `SFTP_KNOWN_HOSTS`: A `known_hosts` file used to verify the server's host key. Host keys are verified by default since v2; `SFTP_INSECURE_IGNORE_HOST_KEY=true` turns the check off (not recommended).
|
||||
- `SFTP_PORT`: The SSH port (default is `22`).
|
||||
- `SFTP_PASSWORD`: (Optional) Use this only if you are not using a private key for authentication.
|
||||
|
||||
{: .note }
|
||||
**Security Recommendation**: Using a private key (`SSH_IDENTIFY_FILE`) is strongly recommended over password-based authentication (`SSH_PASSWORD`) for better security.
|
||||
**Security Recommendation**: Using a private key (`SFTP_IDENTITY_FILE`) is strongly recommended over password-based authentication (`SFTP_PASSWORD`) for better security.
|
||||
|
||||
---
|
||||
|
||||
@@ -54,16 +55,17 @@ services:
|
||||
- DB_PORT=3306
|
||||
- DB_HOST=mysql
|
||||
- DB_NAME=database
|
||||
- DB_USERNAME=username
|
||||
- DB_USER=username
|
||||
- DB_PASSWORD=password
|
||||
## SSH Configuration
|
||||
- SSH_HOST="hostname"
|
||||
- SSH_PORT=22
|
||||
- SSH_USER=user
|
||||
- SFTP_HOST=hostname
|
||||
- SFTP_PORT=22
|
||||
- SFTP_USER=user
|
||||
- REMOTE_PATH=/home/jkaninda/backups
|
||||
- SSH_IDENTIFY_FILE=/tmp/id_ed25519
|
||||
- SFTP_IDENTITY_FILE=/tmp/id_ed25519
|
||||
- SFTP_KNOWN_HOSTS=/config/known_hosts
|
||||
## Optional: Use password instead of private key (not recommended)
|
||||
#- SSH_PASSWORD=password
|
||||
#- SFTP_PASSWORD=password
|
||||
|
||||
# Ensure the mysql-bkup container is connected to the same network as your database
|
||||
networks:
|
||||
@@ -97,18 +99,19 @@ services:
|
||||
- DB_PORT=3306
|
||||
- DB_HOST=postgres
|
||||
- DB_NAME=database
|
||||
- DB_USERNAME=username
|
||||
- DB_USER=username
|
||||
- DB_PASSWORD=password
|
||||
## SSH Configuration
|
||||
- SSH_HOST="hostname"
|
||||
- SSH_PORT=22
|
||||
- SSH_USER=user
|
||||
- SFTP_HOST=hostname
|
||||
- SFTP_PORT=22
|
||||
- SFTP_USER=user
|
||||
- REMOTE_PATH=/home/jkaninda/backups
|
||||
- SSH_IDENTIFY_FILE=/tmp/id_ed25519
|
||||
- SFTP_IDENTITY_FILE=/tmp/id_ed25519
|
||||
- SFTP_KNOWN_HOSTS=/config/known_hosts
|
||||
## Optional: Delete old backups after a specified number of days
|
||||
#- BACKUP_RETENTION_DAYS=7
|
||||
## Optional: Use password instead of private key (not recommended)
|
||||
#- SSH_PASSWORD=password
|
||||
#- SFTP_PASSWORD=password
|
||||
|
||||
# Ensure the mysql-bkup container is connected to the same network as your database
|
||||
networks:
|
||||
@@ -124,6 +127,6 @@ networks:
|
||||
|
||||
- **Cron Expression**: Use the `--cron-expression` flag or `BACKUP_CRON_EXPRESSION` environment variable to define the backup schedule. For example, `0 1 * * *` runs the backup daily at 1:00 AM.
|
||||
- **Backup Retention**: Optionally, use the `BACKUP_RETENTION_DAYS` environment variable to automatically delete backups older than a specified number of days.
|
||||
- **Security**: Always prefer private key authentication (`SSH_IDENTIFY_FILE`) over password-based authentication (`SSH_PASSWORD`) for enhanced security.
|
||||
- **Security**: Always prefer private key authentication (`SFTP_IDENTITY_FILE`) over password-based authentication (`SFTP_PASSWORD`) for enhanced security.
|
||||
|
||||
---
|
||||
Reference in new issue
Block a user