Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CDN assets for SaaS in OCP #3199

Merged
merged 20 commits into from Feb 27, 2023
Merged

Fix CDN assets for SaaS in OCP #3199

merged 20 commits into from Feb 27, 2023

Conversation

jlledom
Copy link
Contributor

@jlledom jlledom commented Feb 7, 2023

Rebase #3085 and #3072 to master and fix merge conflicts.

This solves THREESCALE-7522

jlledom and others added 19 commits October 6, 2022 11:25
The CDN url must be hardcoded at settings.yml:asset_host during assets
compilation in order to get static assets like CSS files point to the
CDN. Otherwise, the assets are generated with relative paths and are
not loaded from the CDN, even when settings.yml:asset_host is set during
runtime. We don't want to have to provide any CDN url when building
porta docker images in order to get the assets correctly precompiled.
To avoid that, this trick assumes the assets are generated with relative
paths (settings.yml:asset_host = null during compilation time) and
prepends the CDN url in runtime.

By default, settings.yml:asset_host is set to RAILS_ASSET_HOST, which
makes this env variable the only source of truth for CDN urls.
Co-authored-by: Aleksandar N. Kostadinov <akostadinov@gmail.com>
We're not going to merge until SaaS is moved to OCP
In order to be able to load both Sprockets and Webpacker assets from a CDN, the asset host property must be empty during the webpack assets compilation time. This ensures urls are generated as relative paths and webpack can safely prepend the CDN url to them.
@jlledom jlledom changed the title [DO NOT MERGE] CDN Fix for OCP staging Fix CDN assets for SaaS in OCP Feb 23, 2023
@jlledom jlledom marked this pull request as ready for review February 23, 2023 16:34
@jlledom jlledom merged commit d025228 into master Feb 27, 2023
@jlledom jlledom deleted the cdn-fix branch February 27, 2023 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants