[Rt-commit] rt branch, 4.4/external-storage, updated. rt-4.2.11-25-g0d74b22

Shawn Moore shawn at bestpractical.com
Thu May 21 18:24:24 EDT 2015


The branch, 4.4/external-storage has been updated
       via  0d74b223e223d43e2f3f0e32debc7b35e4a99e58 (commit)
       via  3b2b6b580a2e7446c575c16bb46c0433fb657c1b (commit)
       via  4f76abf62b89f6d0ef3795874cd5cade8cf1155d (commit)
       via  36f47ffeae62ef55c11cbdc017908cc4d407d0e6 (commit)
      from  f73eb383c689965841c00a5d2c0a468650260c70 (commit)

Summary of changes:
 README                         | 10 +++++++---
 docs/backups.pod               | 13 ++++++++++++
 etc/RT_Config.pm.in            | 45 ++++++++++++++++++++++++++++++++++++++++++
 lib/RT/ExternalStorage/Disk.pm | 20 +++++++++++--------
 4 files changed, 77 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit 36f47ffeae62ef55c11cbdc017908cc4d407d0e6
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu May 21 21:46:04 2015 +0000

    Include rt-externalize-attachments cronjob in README

diff --git a/README b/README
index bdd8e09..ba3221e 100644
--- a/README
+++ b/README
@@ -190,14 +190,18 @@ GENERAL INSTALLATION
  9) Set up automated recurring tasks (cronjobs):
 
     To generate email digest messages, you must arrange for the provided
-    utility to be run once daily, and once weekly. You may also want to
-    arrange for the rt-email-dashboards utility to be run hourly.  For
-    example, if your task scheduler is cron, you can configure it by
+    utility to be run once daily, and once weekly. You may also want
+    to arrange for the rt-email-dashboards utility to be run hourly. If
+    you choose to use the external storage feature, that must process
+    new attachments on a regular basis.
+
+    If your task scheduler is cron, you can configure it by
     adding the following lines as /etc/cron.d/rt:
 
         0 0 * * * root /opt/rt4/sbin/rt-email-digest -m daily
         0 0 * * 0 root /opt/rt4/sbin/rt-email-digest -m weekly
         0 * * * * root /opt/rt4/sbin/rt-email-dashboards
+        0 0 * * * root /opt/rt4/sbin/rt-externalize-attachments
 
 10) Configure the RT email gateway.  To let email flow to your RT
     server, you need to add a few lines of configuration to your mail

commit 4f76abf62b89f6d0ef3795874cd5cade8cf1155d
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu May 21 22:13:06 2015 +0000

    Describe %ExternalStorage in RT_Config.pm

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 7ece63f..c341ccd 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2512,7 +2512,52 @@ Set(%GnuPGOptions,
 
 =back
 
+=head1 External storage
 
+By default, RT stores attachments in the database.  ExternalStorage moves
+all attachments that RT does not need efficient access to (which include
+textual content and images) to outside of the database.  This may either
+be on local disk, or to a cloud storage solution.  This decreases the
+size of RT's database, in turn decreasing the burden of backing up RT's
+database, at the cost of adding additional locations which must be
+configured or backed up.  Attachment storage paths are calculated based
+on file contents; this provides de-duplication.
+
+A full description of external storage can be found by running the command
+`perldoc L<RT::ExternalStorage>` (or `perldoc lib/RT/ExternalStorage.pm`
+from your RT install directory).
+
+Note that simply configuring L<RT::ExternalStorage> is insufficient; there
+are additional steps required (including setup of a regularly-scheduled
+upload job) to enable RT to make use of external storage.
+
+=over 4
+
+=item C<%ExternalStorage>
+
+This selects which storage engine is used, as well as options for
+configuring that specific storage engine. RT ships with the following
+storage engines:
+
+L<RT::ExternalStorage::Disk>, which stores files on directly onto disk.
+
+L<RT::ExternalStorage::AmazonS3>, which stores files on Amazon's S3 service.
+
+L<RT::ExternalStorage::Dropbox>, which stores files in Dropbox.
+
+See each storage engine's documentation for the configuration it requires
+and accepts.
+
+    Set(%ExternalStorage,
+        Type => 'Disk',
+        Path => '/opt/rt4/var/attachments',
+    );
+
+=cut
+
+Set(%ExternalStorage, ());
+
+=back
 
 =head1 Lifecycles
 

commit 3b2b6b580a2e7446c575c16bb46c0433fb657c1b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu May 21 22:19:26 2015 +0000

    Describe backups with ExternalStorage

diff --git a/docs/backups.pod b/docs/backups.pod
index 554336f..768e7d5 100644
--- a/docs/backups.pod
+++ b/docs/backups.pod
@@ -188,6 +188,19 @@ the default cronjobs in place, it's one less piece to forget during a restore.
 If you have custom L<< C<rt-crontool> >> invocations, you don't want to have to
 recreate those.
 
+=item External storage
+
+If you use L<RT::ExternalStorage>, you will want to backup
+the attachments in your chosen storage engine.
+
+If you're using L<RT::ExternalStorage::Disk>, then you need only back
+up the files under the C<Path> option under C<%ExternalStorage> in your
+RT_SiteConfig.pm.
+
+If you're using a cloud storage engine like
+L<RT::ExternalStorage::AmazonS3>, consult that service's documentation
+regarding backups.
+
 =back
 
 Simply saving a tarball should be sufficient, with something like:

commit 0d74b223e223d43e2f3f0e32debc7b35e4a99e58
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu May 21 22:22:08 2015 +0000

    Use an accessor for Disk's Path attribute

diff --git a/lib/RT/ExternalStorage/Disk.pm b/lib/RT/ExternalStorage/Disk.pm
index 07d3acd..11ef078 100644
--- a/lib/RT/ExternalStorage/Disk.pm
+++ b/lib/RT/ExternalStorage/Disk.pm
@@ -56,18 +56,22 @@ use File::Path qw//;
 use Role::Basic qw/with/;
 with 'RT::ExternalStorage::Backend';
 
+sub Path {
+    my $self = shift;
+    return $self->{Path};
+}
+
 sub Init {
     my $self = shift;
 
-    my %self = %{$self};
-    if (not $self{Path}) {
+    if (not $self->Path) {
         RT->Logger->error("No path provided for local storage");
         return;
-    } elsif (not -e $self{Path}) {
-        RT->Logger->error("Path provided for local storage ($self{Path}) does not exist");
+    } elsif (not -e $self->Path) {
+        RT->Logger->error("Path provided for local storage (".$self->Path.") does not exist");
         return;
-    } elsif ($self{Write} and not -w $self{Path}) {
-        RT->Logger->error("Path provided for local storage ($self{Path}) is not writable");
+    } elsif ($self{Write} and not -w $self->Path) {
+        RT->Logger->error("Path provided for local storage (".$self->Path.") is not writable");
         return;
     }
 
@@ -79,7 +83,7 @@ sub Get {
     my ($sha) = @_;
 
     $sha =~ m{^(...)(...)(.*)};
-    my $path = $self->{Path} . "/$1/$2/$3";
+    my $path = $self->Path . "/$1/$2/$3";
 
     return (undef, "File does not exist") unless -e $path;
 
@@ -96,7 +100,7 @@ sub Store {
     my ($sha, $content) = @_;
 
     $sha =~ m{^(...)(...)(.*)};
-    my $dir  = $self->{Path} . "/$1/$2";
+    my $dir  = $self->Path . "/$1/$2";
     my $path = "$dir/$3";
 
     return (1) if -f $path;

-----------------------------------------------------------------------


More information about the rt-commit mailing list