File tree Expand file tree Collapse file tree 4 files changed +43
-6
lines changed
Expand file tree Collapse file tree 4 files changed +43
-6
lines changed Original file line number Diff line number Diff line change 5252 end
5353
5454 # Store uploaded files on the local file system (see config/storage.yml for options).
55- config . active_storage . service = if ENV [ 'S3_ACCESS_KEY_ID' ] . present? && ENV [ 'S3_ENDPOINT' ] . present?
55+ config . active_storage . service = if ENV [ 'AS_MIRROR_PRIMARY' ] . present?
56+ :mirror
57+ elsif ENV [ 'S3_ACCESS_KEY_ID' ] . present? && ENV [ 'S3_ENDPOINT' ] . present?
5658 :s3
5759 elsif ENV [ 'S3_ACCESS_KEY_ID' ] . present?
5860 :amazon
Original file line number Diff line number Diff line change 5555 # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
5656
5757 # Store uploaded files on the local file system (see config/storage.yml for options).
58- config . active_storage . service = if ENV [ 'S3_ACCESS_KEY_ID' ] . present? && ENV [ 'S3_ENDPOINT' ] . present?
58+ config . active_storage . service = if ENV [ 'AS_MIRROR_PRIMARY' ] . present?
59+ :mirror
60+ elsif ENV [ 'S3_ACCESS_KEY_ID' ] . present? && ENV [ 'S3_ENDPOINT' ] . present?
5961 :s3
6062 elsif ENV [ 'S3_ACCESS_KEY_ID' ] . present?
6163 :amazon
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ google:
6262# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
6363# container: your_container_name-<%= Rails.env %>
6464
65- # mirror:
66- # service: Mirror
67- # primary: local
68- # mirrors: [ amazon, google, microsoft ]
65+ mirror :
66+ service : Mirror
67+ primary : <%= ENV['AS_MIRROR_PRIMARY'] %>
68+ mirrors : [ <%= ENV['AS_MIRROR_SECONDARY'] %> ]
Original file line number Diff line number Diff line change 1+ # BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2+ #
3+ # Copyright (c) 2022 BigBlueButton Inc. and by respective authors (see below).
4+ #
5+ # This program is free software; you can redistribute it and/or modify it under the
6+ # terms of the GNU Lesser General Public License as published by the Free Software
7+ # Foundation; either version 3.0 of the License, or (at your option) any later
8+ # version.
9+ #
10+ # Greenlight is distributed in the hope that it will be useful, but WITHOUT ANY
11+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13+ #
14+ # You should have received a copy of the GNU Lesser General Public License along
15+ # with Greenlight; if not, see <http://www.gnu.org/licenses/>.
16+
17+ # frozen_string_literal: true
18+
19+ require_relative 'task_helpers'
20+
21+ namespace :attachments do
22+ desc 'Checks that the application was configured correctly'
23+ task start : :environment do
24+ ActiveStorage ::Blob . update_all ( service_name : 'mirror' ) # rubocop:disable Rails/SkipsModelValidations
25+ ActiveStorage ::Blob . find_each ( &:mirror_later )
26+ success ( 'Started mirroring process...' )
27+ end
28+
29+ task :finish , %i[ new_service ] => :environment do |_task , args |
30+ ActiveStorage ::Blob . update_all ( service_name : args [ :new_service ] ) # rubocop:disable Rails/SkipsModelValidations
31+ success ( 'Finished mirroring process...' )
32+ end
33+ end
You can’t perform that action at this time.
0 commit comments