Skip to main content

Backup solution for Masonite.

Project description

Masonite Package GitHub Workflow Status (branch) PyPI Python Version GitHub release (latest by date including pre-releases) License Code style: black

Masonite Backup

Backup solution for Masonite.

Features

  • Backup Database
  • Backup Files
  • Store Backup Locally in the filesystem
  • Email Backup
  • Store Backup in other Masonite Supported Storage Drivers [s3]

Installation

pip install masonite-backup

Configuration

Add BackupProvider to your project in config/providers.py:

# config/providers.py
# ...
from backup import BackupProvider

# ...
PROVIDERS = [
    # ...
    # Third Party Providers
    BackupProvider,
    # ...
]

Then you can publish the package resources (if needed) by doing:

python craft package:publish backup

Usage

Once you publish the package resources, you can use the backup command to backup your database and files. Before that if you want to configure options of backup then you can do that by updating config/backup.py configuration file.

# config/backup.py

FILENAME = "backup"
DIRECTORY = "backup"
SOURCE = {
    "root": base_path(),
    "excludes": [
        ".git",
        "storage",
        "venv",
        "node_modules",
        "__pycache__",
        # add more...
    ],
}

S3_BACKUP = False # Whether or not to backup to S3.
EMAIL_BACKUP = False  # Whether or not to email the backup.
EMAIL_BACKUP_TO = ""  # The email address to send the backup to.
EMAIL_SUBJECT = "System Backup"  # The email subject.

Note: Make sure you have EMAIL_BACKUP set to True and EMAIL_BACKUP_TO set to a valid email address, to send the backup via email. Also don't forget to setup SMTP in config/mail.py configuration file or in .env file. In case you want to backup to S3, then make sure you have S3_BACKUP set to True and S3 storage configuration.

MAIL_DRIVER=smtp
MAIL_FROM=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=

AWS_CLIENT=
AWS_SECRET=
AWS_BUCKET=
AWS_REGION=

Backup Database and Files

python craft backup:run

Backup Database Only

python craft backup:run --only-db

Backup Files Only

python craft backup:run --only-files

License

Backup is open-sourced software licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

masonite-backup-0.0.4.tar.gz (12.0 kB view hashes)

Uploaded Source

Built Distribution

masonite_backup-0.0.4-py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page