canvas-lms/config
Ahmad Amireh e61659ffdf refactor RevManifest to simplify the CDN interface
refs FOO-2520
flag = none

[pin-commit-multiple_root_accounts=2a9bf89895f38df6bf8f54828af66aced594abf0]

revisit the API for resolving asset names to their (real)path on disk,
because adding to the existing logic to support an alternative bundler
made things hard to understand.

This patch brings a new simplified interface Canvas::Cdn::Registry to
query assets and resolve their location.

- Registry#include?(path) tells whether a realpath points to a static
  asset
- Registry#statics_available? tells whether static assets are available
- Registry#scripts_available? tells whether JS assets are available
- Registry#scripts_for(bundle) provides the realpaths to all the JS
  files in the specified bundle
- Registry#url_for(name) provides the realpath to the static asset

The Registry is a good place to house the BrandableCSS resolving logic
in the future for even more consistency. It can also support an
alternative bundler internally without leaking. Eventually, it would be
nice to have it as a gem.

CHANGES
-------

- helper "font_url_for()" has been removed as it was a duplicate of
  existing logic; instead use "font_path(...)" to achieve the correct
  result. As a result, BrandableCSS is no longer querying Gulp's
  manifest.
- preloaded fonts are now aware of the asset host and work for CDN
- InfoController uses the new Registry API to tell whether Gulp and
  Webpack have produced their assets successfully
- ApplicationHelper no longer re-computes the base URL for JavaScripts,
  now only the Registry is concerned with that
- ?optimized_js query parameter is no longer supported as it has no real
  benefit now that we have access to sourcemaps on production
- ENV['USE_OPTIMIZED_JS'] is now more consistent as there is a single
  source of truth for it. The Registry can be instantiated with
  {environment: "production"} to point to the optimized version of the
  scripts.
- "css:compile" task no longer writes BrandConfig records to the DB,
  that is now done as part of the "compile_assets" task, which you can
  opt out of doing by setting COMPILE_ASSETS_BRAND_CONFIGS=0

TEST PLAN
---- ----

- load your dashboard and verify all the assets are loaded correctly
- set up a CDN, restart your Rails server and reload the dashboard
  - verify all assets are loaded from the CDN
  - verify the Lato fonts are pre-loaded from the CDN
- (optional) add custom JS to a sub-account and visit it
  - verify the custom JS is loaded and evaluated *after* Canvas's main
    javascript bundles

Change-Id: I8198de747cdd5892d6a831cb6c61ba0ef9afa789
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276537
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-01-06 20:20:40 +00:00
..
environments RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
feature_flags Remove cc_in_rce_video_tray flag 2021-12-21 21:16:02 +00:00
initializers refactor RevManifest to simplify the CDN interface 2022-01-06 20:20:40 +00:00
locales update nn translation 2021-12-22 05:48:02 +00:00
saml
amazon_s3.yml.example
application.rb refactor RevManifest to simplify the CDN interface 2022-01-06 20:20:40 +00:00
boot.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
bounce_notifications.yml.example
brakeman.ignore ignore spurious brakeman error 2021-10-19 18:00:41 +00:00
brandable_css.yml refactor RevManifest to simplify the CDN interface 2022-01-06 20:20:40 +00:00
browsers.yml Add clarification text to browsers file 2020-09-03 20:37:32 +00:00
cache_store.yml.example add the ability to run parallel rspec processes in container 2021-01-14 21:12:45 +00:00
canvas_cdn.yml.example Remove enabled: setting from canvs_cdn.yml.example 2019-07-22 20:22:10 +00:00
canvas_rails_switcher.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
cassandra.yml.example
consul.yml.example
copyright-template.js
credentials.test.yml Introduce release notes data model 2021-04-05 16:09:59 +00:00
crystalball.yml Add new file crystalball predictor to enqueue complete re-run 2021-12-21 18:12:29 +00:00
cutycapt.yml.example
database.yml.example create read-only "secondary" db user for dev/test 2021-11-10 22:21:23 +00:00
database.yml.travis
delayed_jobs.yml.example
docker-compose.override.yml.example fix Dockerfile bundle directory inconsistency 2021-12-14 19:44:48 +00:00
domain.yml.example Use same_site none for session store for relative file links 2020-02-27 21:01:01 +00:00
dynamic_settings.yml.example BBB link support for planner Join buttons 2021-12-08 17:02:30 +00:00
dynamodb.yml.example dynamo is optional for dev 2020-08-31 19:05:02 +00:00
environment.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
external_migration.yml.example
file_store.yml.example
incoming_mail.yml.example
linked_in.yml.example
local_cache.yml.example allow local cache to use local redis 2020-08-27 19:08:56 +00:00
logging.yml.example
marginalia.yml.example
memcache.yml.example
notification_failures.yml.example
notification_service.yml.example
offline_web.yml.sample
outgoing_mail.yml.example
periodic_jobs.yml.example
puma.rb RuboCop: Layout config 2021-09-22 15:57:46 +00:00
raven.yml.example
redis.yml.example add the ability to run parallel rspec processes in container 2021-01-14 21:12:45 +00:00
routes.rb Create endpoint for "apply score to ungraded" 2021-12-20 20:09:04 +00:00
saml.yml.example
security.yml.example
selenium.yml.example update chrome version and cleanup SELENIUM_VERSION 2021-12-07 14:18:47 +00:00
session_store.yml.example Use same_site none for session store for relative file links 2020-02-27 21:01:01 +00:00
spring.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
statsd.yml.example
styleguide.yml
testrail.yml.example
twilio.yml.example
twitter.yml.example
vault.yml.example file-based local solution for vault 2020-09-02 15:46:27 +00:00
vault_contents.yml.example Add missing vault_contents.yml.example 2021-10-22 16:06:43 +00:00