From patchwork Sat Oct 6 21:45:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 980003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42SKv82w59z9s8T for ; Sun, 7 Oct 2018 08:46:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="jUqCwD16"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42SKv80zGMzF3Mp for ; Sun, 7 Oct 2018 08:46:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="jUqCwD16"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.3; helo=relay-direct21.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="jUqCwD16"; dkim-atps=neutral Received: from relay-direct21.mxroute.com (relay-direct21.mxroute.com [185.234.75.3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42SKtd5551zF3KV for ; Sun, 7 Oct 2018 08:45:45 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay-direct21.mxroute.com (Postfix) with ESMTP id 8B6573F358 for ; Sat, 6 Oct 2018 21:45:12 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 71D813F3AE for ; Sat, 6 Oct 2018 21:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vTpPLjSvNV6lOYmj4onKppZcRA7WQZgcY0FaJgllIDY=; b=jUqCwD16cPDILOV/AJndaxMA80 AtyUjm45qydhPyjloWEJEMkI7EqRi3q+IJhT4aizgGaSrBS00Pd3KCrF6Kfo6K1OpG4YAGjUjDUvz t1vjrOYlVI+eYMKqHIIL/DQ51zaQsYWJdrC4CfRQavmeilz6BeE8bLC6MOIo8Pn9v8p9Qsi1U+OfX uvQxHUWl106VUwKecS/FADxLo8d2pVVk1IuVY0lwCf7tQUqI0wjhEl3za2lg2x926RmmlJWkzlvcz c3imFH619X389ZqsbNM+3Dm2thMAo5bZlyAnlAQOpxjGsEwVxblrWRJ6dq9yzOBeJV91R4Z7wl6rx xV5CJDTA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 3/4] Add support for 'django-dbbackup' Date: Sat, 6 Oct 2018 22:45:05 +0100 Message-Id: <20181006214506.22720-4-stephen@that.guru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181006214506.22720-1-stephen@that.guru> References: <20181006214506.22720-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" 'parsemail' and 'parsearchive' are slow. When messing with models and migrations, it can be very useful to backup the database in its current state and restore it if/when you mess up. Currently, we've documented how to do this via some commands run in the shell of the container, but we can do things easier via an application designed for this purpose: 'django-dbshell'. Signed-off-by: Stephen Finucane --- .gitignore | 3 +++ patchwork/settings/dev.py | 13 +++++++++++++ requirements-dev.txt | 1 + 3 files changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index 57376bdd..a33d1029 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ patchwork/settings/production.py # docker-compose configuration files /.env + +# django-dbbackup files +/.backups diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py index 4bb5a93c..711177c9 100644 --- a/patchwork/settings/dev.py +++ b/patchwork/settings/dev.py @@ -9,6 +9,11 @@ Design based on: from .base import * # noqa +try: + import dbbackup +except ImportError: + dbbackup = None + # # Core settings # https://docs.djangoproject.com/en/1.11/ref/settings/#core-settings @@ -72,6 +77,14 @@ INTERNAL_IPS = [ '172.18.0.1' ] +# django-dbbackup + +if dbbackup: + INSTALLED_APPS += [ + 'dbbackup', + ] + + DBBACKUP_STORAGE_OPTIONS = {'location': '.backups'} # # Patchwork settings diff --git a/requirements-dev.txt b/requirements-dev.txt index b0cdd0de..ed98c30e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,4 +3,5 @@ Django==1.11.15; python_version < '3.0' # pyup: ignore djangorestframework==3.8.2 django-filter==2.0.0; python_version >= '3.4' django-filter==1.1.0; python_version < '3.0' # pyup: ignore +django-dbbackup==3.2.0 -r requirements-test.txt