FEATURE: Add dash warning for using S3 without CDN (#11561)

Over the years we had some admins complaining that most of their costs
running Discourse is on S3 uploads.

That only happens when they are using S3 without a CDN, which is widely
considered a bad pratice for public websites, as egress bandwidth can
get expensive quite fast.

Related:

https://meta.discourse.org/t/download-avatars-locally-from-s3-shutting-down-s3-in-my-site/174001/3?u=falco

https://meta.discourse.org/t/use-webtorrent-to-load-media-objects/155873/2?u=falco
This commit is contained in:
Rafael dos Santos Silva
2020-12-28 12:43:48 -03:00
committed by GitHub
parent c92415d402
commit 330ef3700f
2 changed files with 8 additions and 1 deletions

View File

@ -92,7 +92,7 @@ class AdminDashboardData
add_problem_check :rails_env_check, :host_names_check, :force_https_check,
:ram_check, :google_oauth2_config_check,
:facebook_config_check, :twitter_config_check,
:github_config_check, :s3_config_check,
:github_config_check, :s3_config_check, :s3_cdn_check,
:image_magick_check, :failing_emails_check,
:subfolder_ends_in_slash_check,
:pop3_polling_configuration, :email_polling_errored_recently,
@ -190,6 +190,12 @@ class AdminDashboardData
nil
end
def s3_cdn_check
if (GlobalSetting.use_s3? || SiteSetting.enable_s3_uploads) && SiteSetting.Upload.s3_cdn_url.blank?
I18n.t('dashboard.s3_config_warning')
end
end
def image_magick_check
I18n.t('dashboard.image_magick_warning') if SiteSetting.create_thumbnails && !system("command -v convert >/dev/null;")
end