Remove dbbackup integration

- Data dumping and restoring is now very complex!
- We should use the invoke export-records function now, rather than relying on dbbackup / dbrestore
- Documentation will be updated to match
This commit is contained in:
Oliver Walters 2021-04-25 12:14:36 +10:00
parent 2f2354afdc
commit b08cd8da20
8 changed files with 1 additions and 54 deletions

View File

@ -18,8 +18,6 @@ def canAppAccessDatabase():
'makemirations', 'makemirations',
'migrate', 'migrate',
'check', 'check',
'dbbackup',
'mediabackup',
'dbrestore', 'dbrestore',
'mediarestore', 'mediarestore',
'shell', 'shell',

View File

@ -250,7 +250,6 @@ INSTALLED_APPS = [
# Third part add-ons # Third part add-ons
'django_filters', # Extended filter functionality 'django_filters', # Extended filter functionality
'dbbackup', # Database backup / restore
'rest_framework', # DRF (Django Rest Framework) 'rest_framework', # DRF (Django Rest Framework)
'rest_framework.authtoken', # Token authentication for API 'rest_framework.authtoken', # Token authentication for API
'corsheaders', # Cross-origin Resource Sharing for DRF 'corsheaders', # Cross-origin Resource Sharing for DRF
@ -586,17 +585,6 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
# Use database transactions when importing / exporting data # Use database transactions when importing / exporting data
IMPORT_EXPORT_USE_TRANSACTIONS = True IMPORT_EXPORT_USE_TRANSACTIONS = True
BACKUP_DIR = get_setting(
'INVENTREE_BACKUP_DIR',
CONFIG.get('backup_dir', tempfile.gettempdir()),
)
# Settings for dbbsettings app
DBBACKUP_STORAGE = 'django.core.files.storage.FileSystemStorage'
DBBACKUP_STORAGE_OPTIONS = {
'location': BACKUP_DIR,
}
# Internal IP addresses allowed to see the debug toolbar # Internal IP addresses allowed to see the debug toolbar
INTERNAL_IPS = [ INTERNAL_IPS = [
'127.0.0.1', '127.0.0.1',

View File

@ -138,12 +138,6 @@ static_root: '/home/inventree/static'
# - git # - git
# - ssh # - ssh
# Backup options
# Set the backup_dir parameter to store backup files in a specific location
# If unspecified, the local user's temp directory will be used
# Use environment variable INVENTREE_BACKUP_DIR
backup_dir: '/home/inventree/data/backup/'
# Permit custom authentication backends # Permit custom authentication backends
#authentication_backends: #authentication_backends:
# - 'django.contrib.auth.backends.ModelBackend' # - 'django.contrib.auth.backends.ModelBackend'

View File

@ -21,7 +21,6 @@ ENV INVENTREE_MNG_DIR="${INVENTREE_SRC_DIR}/InvenTree"
ENV INVENTREE_DATA_DIR="${INVENTREE_HOME}/data" ENV INVENTREE_DATA_DIR="${INVENTREE_HOME}/data"
ENV INVENTREE_STATIC_ROOT="${INVENTREE_HOME}/static" ENV INVENTREE_STATIC_ROOT="${INVENTREE_HOME}/static"
ENV INVENTREE_MEDIA_ROOT="${INVENTREE_DATA_DIR}/media" ENV INVENTREE_MEDIA_ROOT="${INVENTREE_DATA_DIR}/media"
ENV INVENTREE_BACKUP_DIR="${INVENTREE_DATA_DIR}/backup"
ENV INVENTREE_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml" ENV INVENTREE_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml"
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DATA_DIR}/secret_key.txt" ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DATA_DIR}/secret_key.txt"

View File

@ -11,11 +11,6 @@ if [[ ! -d "$INVENTREE_MEDIA_ROOT" ]]; then
mkdir $INVENTREE_MEDIA_ROOT mkdir $INVENTREE_MEDIA_ROOT
fi fi
if [[ ! -d "$INVENTREE_BACKUP_DIR" ]]; then
echo "Creating directory $INVENTREE_BACKUP_DIR"
mkdir $INVENTREE_BACKUP_DIR
fi
# Check if "config.yaml" has been copied into the correct location # Check if "config.yaml" has been copied into the correct location
if test -f "$INVENTREE_CONFIG_FILE"; then if test -f "$INVENTREE_CONFIG_FILE"; then
echo "$INVENTREE_CONFIG_FILE exists - skipping" echo "$INVENTREE_CONFIG_FILE exists - skipping"

View File

@ -11,11 +11,6 @@ if [[ ! -d "$INVENTREE_MEDIA_ROOT" ]]; then
mkdir $INVENTREE_MEDIA_ROOT mkdir $INVENTREE_MEDIA_ROOT
fi fi
if [[ ! -d "$INVENTREE_BACKUP_DIR" ]]; then
echo "Creating directory $INVENTREE_BACKUP_DIR"
mkdir $INVENTREE_BACKUP_DIR
fi
# Check if "config.yaml" has been copied into the correct location # Check if "config.yaml" has been copied into the correct location
if test -f "$INVENTREE_CONFIG_FILE"; then if test -f "$INVENTREE_CONFIG_FILE"; then
echo "$INVENTREE_CONFIG_FILE exists - skipping" echo "$INVENTREE_CONFIG_FILE exists - skipping"

View File

@ -3,7 +3,6 @@ wheel>=0.34.2 # Wheel
Django==3.2 # Django package Django==3.2 # Django package
pillow==8.1.1 # Image manipulation pillow==8.1.1 # Image manipulation
djangorestframework==3.12.4 # DRF framework djangorestframework==3.12.4 # DRF framework
django-dbbackup==3.3.0 # Database backup / restore functionality
django-cors-headers==3.2.0 # CORS headers extension for DRF django-cors-headers==3.2.0 # CORS headers extension for DRF
django-filter==2.4.0 # Extended filtering options django-filter==2.4.0 # Extended filtering options
django-mptt==0.11.0 # Modified Preorder Tree Traversal django-mptt==0.11.0 # Modified Preorder Tree Traversal

View File

@ -401,27 +401,6 @@ def import_fixtures(c):
manage(c, command, pty=True) manage(c, command, pty=True)
@task
def backup(c):
"""
Create a backup of database models and uploaded media files.
Backup files will be written to the 'backup_dir' file specified in 'config.yaml'
"""
manage(c, 'dbbackup')
manage(c, 'mediabackup')
@task
def restore(c):
"""
Restores database models and media files.
Backup files are read from the 'backup_dir' file specified in 'config.yaml'
"""
manage(c, 'dbrestore')
manage(c, 'mediarestore')
@task(help={'address': 'Server address:port (default=127.0.0.1:8000)'}) @task(help={'address': 'Server address:port (default=127.0.0.1:8000)'})
def server(c, address="127.0.0.1:8000"): def server(c, address="127.0.0.1:8000"):