diff options
author | George Claghorn <george@basecamp.com> | 2019-05-22 15:07:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-22 15:07:35 -0400 |
commit | d5a2f7ec148726d7547e367d7a968e3b4be9b509 (patch) | |
tree | 1818959b09d3bdde9b43440fe5ca8fa402984ec3 /guides | |
parent | ff34f78248e367fdc7d59b42b37610427f7339c8 (diff) | |
download | rails-d5a2f7ec148726d7547e367d7a968e3b4be9b509.tar.gz rails-d5a2f7ec148726d7547e367d7a968e3b4be9b509.tar.bz2 rails-d5a2f7ec148726d7547e367d7a968e3b4be9b509.zip |
Mirror direct uploads
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_storage_overview.md | 26 | ||||
-rw-r--r-- | guides/source/configuring.md | 6 |
2 files changed, 24 insertions, 8 deletions
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md index 615f576797..2986850cef 100644 --- a/guides/source/active_storage_overview.md +++ b/guides/source/active_storage_overview.md @@ -189,14 +189,21 @@ gem "google-cloud-storage", "~> 1.11", require: false ### Mirror Service -You can keep multiple services in sync by defining a mirror service. When a file -is uploaded or deleted, it's done across all the mirrored services. Mirrored -services can be used to facilitate a migration between services in production. -You can start mirroring to the new service, copy existing files from the old -service to the new, then go all-in on the new service. Define each of the -services you'd like to use as described above and reference them from a mirrored +You can keep multiple services in sync by defining a mirror service. A mirror +service replicates uploads and deletes across two or more subordinate services. + +A mirror service is intended to be used temporarily during a migration between +services in production. You can start mirroring to a new service, copy +pre-existing files from the old service to the new, then go all-in on the new service. +NOTE: Mirroring is not atomic. It is possible for an upload to succeed on the +primary service and fail on any of the subordinate services. Before going +all-in on a new service, verify that all files have been copied. + +Define each of the services you'd like to mirror as described above. Reference +them by name when defining a mirror service: + ```yaml s3_west_coast: service: S3 @@ -219,9 +226,12 @@ production: - s3_west_coast ``` -NOTE: Files are served from the primary service. +Although all secondary services receive uploads, downloads are always handled +by the primary service. -NOTE: This is not compatible with the [direct uploads](#direct-uploads) feature. +Mirror services are compatible with direct uploads. New files are directly +uploaded to the primary service. When a directly-uploaded file is attached to a +record, a background job is enqueued to copy it to the secondary services. Attaching Files to Records -------------------------- diff --git a/guides/source/configuring.md b/guides/source/configuring.md index ae720e6a05..0b54683b5a 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -852,6 +852,12 @@ text/javascript image/svg+xml application/postscript application/x-shockwave-fla config.active_storage.queues.purge = :low_priority ``` +* `config.active_storage.queues.mirror` accepts a symbol indicating the Active Job queue to use for direct upload mirroring jobs. The default is `:active_storage_mirror`. + + ```ruby + config.active_storage.queues.mirror = :low_priority + ``` + * `config.active_storage.logger` can be used to set the logger used by Active Storage. Accepts a logger conforming to the interface of Log4r or the default Ruby Logger class. ```ruby |