mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2025-12-07 05:59:43 +01:00
doc: reviewed docs
This commit is contained in:
@@ -4,41 +4,72 @@ layout: default
|
||||
parent: How Tos
|
||||
nav_order: 4
|
||||
---
|
||||
# Backup to FTP remote server
|
||||
|
||||
# Backup to FTP Remote Server
|
||||
|
||||
As described for SSH backup section, to change the storage of your backup and use FTP Remote server as storage. You need to add `--storage ftp`.
|
||||
You need to add the full remote path by adding `--path /home/jkaninda/backups` flag or using `REMOTE_PATH` environment variable.
|
||||
To store your backups on an FTP remote server, you can configure the backup process to use the `--storage ftp` option.
|
||||
|
||||
{: .note }
|
||||
These environment variables are required for SSH backup `FTP_HOST`, `FTP_USER`, `REMOTE_PATH`, `FTP_PORT` or `FTP_PASSWORD`.
|
||||
This section explains how to set up and configure FTP-based backups.
|
||||
|
||||
```yml
|
||||
---
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
1. **Specify the Storage Type**
|
||||
Add the `--storage ftp` flag to your backup command.
|
||||
|
||||
2. **Set the Remote Path**
|
||||
Define the full remote path where backups will be stored using the `--path` flag or the `REMOTE_PATH` environment variable.
|
||||
Example: `--path /home/jkaninda/backups`.
|
||||
|
||||
3. **Required Environment Variables**
|
||||
The following environment variables are mandatory for FTP-based backups:
|
||||
|
||||
- `FTP_HOST`: The hostname or IP address of the FTP server.
|
||||
- `FTP_PORT`: The FTP port (default is `21`).
|
||||
- `FTP_USER`: The username for FTP authentication.
|
||||
- `FTP_PASSWORD`: The password for FTP authentication.
|
||||
- `REMOTE_PATH`: The directory on the FTP server where backups will be stored.
|
||||
|
||||
---
|
||||
|
||||
## Example Configuration
|
||||
|
||||
Below is an example `docker-compose.yml` configuration for backing up to an FTP remote server:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mysql-bkup:
|
||||
# In production, it is advised to lock your image tag to a proper
|
||||
# release version instead of using `latest`.
|
||||
# Check https://github.com/jkaninda/mysql-bkup/releases
|
||||
# for a list of available releases.
|
||||
# In production, lock your image tag to a specific release version
|
||||
# instead of using `latest`. Check https://github.com/jkaninda/mysql-bkup/releases
|
||||
# for available releases.
|
||||
image: jkaninda/mysql-bkup
|
||||
container_name: mysql-bkup
|
||||
command: backup --storage ftp -d database
|
||||
environment:
|
||||
- DB_PORT=3306
|
||||
- DB_HOST=postgres
|
||||
- DB_HOST=mysql
|
||||
- DB_NAME=database
|
||||
- DB_USERNAME=username
|
||||
- DB_PASSWORD=password
|
||||
## FTP config
|
||||
## FTP Configuration
|
||||
- FTP_HOST="hostname"
|
||||
- FTP_PORT=21
|
||||
- FTP_USER=user
|
||||
- FTP_PASSWORD=password
|
||||
- REMOTE_PATH=/home/jkaninda/backups
|
||||
|
||||
# pg-bkup container must be connected to the same network with your database
|
||||
# Ensure the mysql-bkup container is connected to the same network as your database
|
||||
networks:
|
||||
- web
|
||||
|
||||
networks:
|
||||
web:
|
||||
```
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Notes
|
||||
|
||||
- **Security**: FTP transmits data, including passwords, in plaintext. For better security, consider using SFTP (SSH File Transfer Protocol) or FTPS (FTP Secure) if supported by your server.
|
||||
- **Remote Path**: Ensure the `REMOTE_PATH` directory exists on the FTP server and is writable by the specified `FTP_USER`.
|
||||
Reference in New Issue
Block a user