[DRE-maint] Bug#1101504: redmine: served via unicorn and nginx, errors due to 'GET /assets/...'

Jörg-Volker Peetz jvpeetz at web.de
Sat Mar 29 10:59:22 GMT 2025


Hi Soren,

Soren Stoutner wrote on 28/03/2025 23:43:
> Jörg
>
> On Friday, March 28, 2025 3:03:29 PM Mountain Standard Time Jörg-
> Volker Peetz wrote:
>> Yes. And meanwhile, I found this in the redmine issues:
>>
>> Defect #41734 wrong url for assets in public/assets
>> https://www.redmine.org/issues/41734
>>
>> It is known upstream. And as far as I understand, after choosing a
>> sub-uri I have to re-generate the files in the
>> /var/cache/redmine/default/public/assets directory. The wrong path
>> is embedded in the css files in that directory.
>>
>> How could this re-generation be accomplished? Maybe, every time
>> before deploying redmine?
>
> It looks the the command you need to run is:
>
> bundle exec rake assets:precompile RAILS_ENV="production" \
>      RAILS_RELATIVE_URL_ROOT=/sub-uri
>
> https://salsa.debian.org/ruby-team/redmine/-/blob/master/doc/UPGRADING
>
> I have added this information to README.Debian.
>
> https://salsa.debian.org/ruby-team/redmine/-/blob/master/debian/
> README.Debian?ref_type=heads#L43-55
>

Yes, I used your hint and refined it a little bit:

First, the old assets have to be removed:

   # rm -rf /var/cache/redmine/default/public/assets/*

then rebuild the assets, taking some wisdom from the redmine.postinst script:

   # su -s <REDMINE_CURRENT_USER> /bin/sh -c "cd /usr/share/redmine ;
REDMINE_INSTANCE=<INSTANCE> bundle exec rake assets:precompile
RAILS_ENV="production" RAILS_RELATIVE_URL_ROOT=/<SUB-URI>"

(the line breaks are horrible, please correct it in the README)
Using 'assets:clobber' instead of 'assets:precompile' fails because rake then
tries to remove the link '/var/lib/redmine/default/public/assets' owned by user
root.

In the UPGRADING document it says: "By default, Redmine automatically recompiles
assets in production mode when the application starts."
And indeed, doing

   # service unicorn stop
   # rm -rf /var/cache/redmine/default/public/assets/*
   # service unicorn start

the assets are rebuild correctly by redmine. Only difference is the ownership of
the files in /var/cache/redmine/default/public/assets/ which now belong to user
root.

Thanks for taking care.

Regards,
Jörg.



More information about the Pkg-ruby-extras-maintainers mailing list