Free Automatic TYPO3 Backup with PHPBU

Are you looking for free automatic TYPO3 backup solution? PHPBU is one the famous OpenSource PHP backup solution. Here is the quick TYPO3 PHPBU Backup example.

// .env

 

EMAIL_RECIPIENTS=email
EMAIL_ONLY_ON_ERROR=true

PHPBU_CLEANUP_AMOUNT_LOCAL=5
PHPBU_CLEANUP_AMOUNT_AWS3=5

AWS3_KEY=key
AWS3_SECRET=secret
AWS3_BUCKET=bucket
AWS3_REGION=eu-central-1

SITE_DB_USER=user
SITE_DB_NAME=database
SITE_DB_PASSWORD=password
SITE_DB_PATH_BACKUP_LOCAL=/path/to/local
SITE_DB_PATH_BACKUP_AWS3=/path/to/aws
SITE_CODE_SITE_PATH=/path/to/code
SITE_CODE_PATH_BACKUP_LOCAL=/path/to/local
SITE_CODE_PATH_BACKUP_AWS3=/path/to/aws
SITE_LOGS=/path/to/logs

 

// phpbu.database.json

 

{
    "verbose": true,
    "debug": false,
    "adapters": [
        {
            "type": "dotenv",
            "name": "environment",
            "options": {
                "file": "/path/to/.env"
            }
        }
    ],
    "logging": [
        {
            "type": "json",
            "target": "adapter:environment:SITE_LOGS"
        },
        {
            "type": "mail",
            "options": {
               "transport": "mail",
               "recipients": "adapter:environment:EMAIL_RECIPIENTS",
               "subject": "Server Database-Backup Report",
               "sendOnlyOnError": "adapter:environment:EMAIL_ONLY_ON_ERROR"
            }
        }
    ],
    "backups": [
        {
            "name": "Database",
            "source": {
                "type": "mysqldump",
                "options": {
                    "databases": "adapter:environment:SITE_DB_USER",
                    "user": "adapter:environment:SITE_DB_NAME",
                    "password": "adapter:environment:SITE_DB_PASSWORD"
                }
            },
            "target": {
                "dirname": "adapter:environment:SITE_DB_PATH_BACKUP_LOCAL",
                "filename": "nitsan.in-%Y%m%d-%H%i.sql",
                "compress": "bzip2"
            },
            "syncs": [
                {
                    "type": "amazons3",
                    "options": {
                        "key": "adapter:environment:AWS3_KEY",
                        "secret": "adapter:environment:AWS3_SECRET",
                        "bucket": "adapter:environment:AWS3_BUCKET",
                        "region": "adapter:environment:AWS3_REGION",
                        "path": "adapter:environment:SITE_DB_PATH_BACKUP_AWS3",
                        "useMultiPartUpload": "true",
                        "cleanup.type": "quantity",
                        "cleanup.amount": "adapter:environment:PHPBU_CLEANUP_AMOUNT_AWS3"
                    }
                }
            ],
            "cleanup": {
                "type": "quantity",
                "options": {
                    "amount": "adapter:environment:PHPBU_CLEANUP_AMOUNT_LOCAL"
                }
            }
        }
    ]
}

 

// phpbu.code.json

 

{
    "verbose": true,
    "debug": false,
    "adapters": [
        {
            "type": "dotenv",
            "name": "environment",
            "options": {
                "file": "/path/to/.env"
            }
        }
    ],
    "logging": [
        {
            "type": "json",
            "target": "adapter:environment:SITE_LOGS"
        },
        {
            "type": "mail",
            "options": {
               "transport": "mail",
               "recipients": "adapter:environment:EMAIL_RECIPIENTS",
               "subject": "Server Code-Backup Report",
               "sendOnlyOnError": "adapter:environment:EMAIL_ONLY_ON_ERROR"
            }
        }
    ],
    "backups": [
        {
            "name": "Code",
            "source": {
                "type": "tar",
                "options": {
                    "path": "adapter:environment:SITE_CODE_SITE_PATH"
                }
            },
            "target": {
                "dirname": "adapter:environment:SITE_CODE_PATH_BACKUP_LOCAL",
                "filename": "nitsan.in-%Y%m%d-%H%i",
                "compress": "bzip2"
            },
            "syncs": [
                {
                    "type": "amazons3",
                    "options": {
                        "key": "adapter:environment:AWS3_KEY",
                        "secret": "adapter:environment:AWS3_SECRET",
                        "bucket": "adapter:environment:AWS3_BUCKET",
                        "region": "adapter:environment:AWS3_REGION",
                        "path": "adapter:environment:SITE_CODE_PATH_BACKUP_AWS3",
                        "useMultiPartUpload": "true",
                        "cleanup.type": "quantity",
                        "cleanup.amount": "adapter:environment:PHPBU_CLEANUP_AMOUNT_AWS3"
                    }
                }
            ],
            "cleanup": {
                "type": "quantity",
                "options": {
                    "amount": "adapter:environment:PHPBU_CLEANUP_AMOUNT_LOCAL"
                }
            }
        }
    ]
}

 

// Cron

 

0 1 * * * /usr/local/bin/phpbu --configuration=/path/to/phpbu.database.json
0 1 * * * /usr/local/bin/phpbu --configuration=/path/to/phpbu.code.json

Post a Comment

×
Captcha Code Can't read the image? Click here to refresh

Got answer to the question you were looking for?