Defect #41734
openwrong url for assets in public/assets
0%
Description
The root url is https://domain/redmine
I get
https://domain/assets/jstoolbar/code-099ac2b5.svg
but it should be
https://domain/redmine/assets/jstoolbar/code-099ac2b5.svg
With my custom theme it's working:
#grep -R url\(\"/redmine/ public/assets/themes/zmt/application-e1a40028.css:@import url("/redmine/assets/application-f596000d.css"); public/assets/themes/zmt/application-e1a40028.css: background: #507AAA url("/redmine/themes/zmt/zmt.png") no-repeat 2px; public/assets/themes/zmt/application-e1a40028.css: background-image: url("/redmine/themes/zmt/images/zmt.png"); public/assets/themes/zmt/application-42af7287.css: background: #507AAA url("/redmine/themes/zmt/zmt.png") no-repeat 2px; public/assets/themes/zmt/application-42af7287.css: background-image: url("/redmine/themes/zmt/images/zmt.png"); public/assets/themes/zmt/application-66bf4852.css:@import url("/redmine/assets/application-f596000d.css"); public/assets/themes/zmt/application-66bf4852.css: background: #507AAA url("/redmine/themes/zmt/zmt.png") no-repeat 2px; public/assets/themes/zmt/responsive-1380294f.css:@import url("/redmine/assets/responsive-8ac0f530.css"); public/assets/themes/zmt/application-b5a77b1a.css: background: #507AAA url("/redmine/themes/zmt/zmt.png") no-repeat 2px; public/assets/themes/zmt/application-b5a77b1a.css: background-image: url("/redmine/themes/zmt/zmt.png"); public/assets/themes/zmt/application-1f7c1274.css:@import url("/redmine/assets/application-f596000d.css"); public/assets/themes/zmt/application-1f7c1274.css: background: #507AAA url("/redmine/themes/zmt/zmt.png") no-repeat 2px; public/assets/themes/zmt/application-1f7c1274.css: background-image: url("/redmine/assets/themes/zmt/zmt-951000c2.png");
grep -R url\(\"/assets/ | head -n 10 public/assets/jstoolbar-632454e7.css:.jstElements .help a {padding: 2px 0 2px 20px; background: url("/assets/help-872ce501.png") no-repeat 0 50%;} public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/bold-9488b1ca.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/italic-581bb903.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/underline-7f1532c4.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/strikethrough-845fb06b.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/letter-c-828e6ed3.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/h1-2c820a9f.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/h2-e48db650.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/h3-97122049.svg"); public/assets/jstoolbar-632454e7.css: background-image: url("/assets/jstoolbar/list-3397686a.svg")
There are a lot of files with wrong url:
# grep -R url\(\"/assets/ public/assets | wc -l 205
Related issues
Updated by Grischa Zengel about 1 month ago
The embedded themes (alt & classic) don't work:
# grep -R url\(\"/assets/app public/assets public/assets/alternate/stylesheets/application-49fdd258.css:@import url("/assets/application-f596000d.css"); public/assets/themes/alternate/application-49fdd258.css:@import url("/assets/application-f596000d.css"); public/assets/themes/classic/application-daa03208.css:@import url("/assets/application-f596000d.css"); public/assets/classic/stylesheets/application-daa03208.css:@import url("/assets/application-f596000d.css");
Updated by Marius BĂLTEANU about 1 month ago
Can you give me a little bit more details about your environment? Is your method documented in HowTo_Install_Redmine_in_a_sub-URI?
Updated by Grischa Zengel about 1 month ago
I still use
RailsBaseURI /redmine
from
https://www.redmine.org/projects/redmine/wiki/Install_Redmine_with_git_and_svn_support_over_https_on_Debian_wheezy_using_the_Debian_repository
should I change it?
Updated by Grischa Zengel about 1 month ago
The problem is:
rake db:migrate RAILS_ENV=production
It creates the assets with the wrong base path.
Which environment variable should be set for BaseURI? This info should be in doc/UPGRADE.
No combination with default_scope or relative_url_root works for me. I get "path not found" or "something went wrong" or the content of /opt/redmine/public.
Updated by Grischa Zengel about 1 month ago
I found it:
RAILS_RELATIVE_URL_ROOT=/redmine
Updated by Go MAEDA about 1 month ago
- File 41734-precompile-assets-instruction.patch added
- Category set to Documentation
- Target version set to 6.0.2
Probably we should add the following step to doc/INSTALL and doc/UPGRADING:
6. Compile assets Compile the assets such as stylesheets, javascripts and images. This generates the files into the public/assets directory for delivery by the web server. using: bundle exec rake assets:precompile RAILS_ENV="production" If deploying to a sub-uri, set the relative URL root as follows: bundle exec rake assets:precompile RAILS_ENV="production" RAILS_RELATIVE_URL_ROOT=/sub-uri If you experience issues with missing assets in the browser, try removing the public/assets directory before re-running the precompile: bundle exec rake assets:clobber RAILS_ENV="production"
Updated by Grischa Zengel about 1 month ago
I don't know, which rake tasks will compile the assets. So I think RAILS_RELATIVE_URL_ROOT should always been set, even with a single slash it should work.
Perhabs it's better to delete all assets in the last step and recreate them.
As first step I prefer to export the needed variables to avoid redundant usage.
There I export HTTP-proxy settings, too.
export RAILS_ENV="production" RAILS_RELATIVE_URL_ROOT=/sub-uri http_proxy=proxy-server https_proxy=proxy-server
I put this to my cron jobs, too, because they could run while upgrading.
[Unit] Description=Redmine Send Reminders [Service] User=www-data Group=www-data Type=simple #Nice=19 #IOSchedulingClass=2 #IOSchedulingPriority=7 Environment="RAILS_ENV=production" Environment="RAILS_RELATIVE_URL_ROOT=/redmine" WorkingDirectory=/opt/redmine ExecStart=/usr/local/rvm/wrappers/default/rake redmine:send_reminders StandardOutput=append:/opt/redmine/log/%N.log StandardError=append:/opt/redmine/log/%N.err.log
Updated by Go MAEDA about 1 month ago
- Related to Feature #41754: Add asset precompilation instructions to doc/INSTALL and doc/UPGRADING added