YunoHost-Apps / mastodon_ynh

Free, open-source social network for YunoHost
https://joinmastodon.org/
GNU Affero General Public License v3.0
84 stars 34 forks source link

Unstyled pages after upgrade #267

Closed fflorent closed 2 years ago

fflorent commented 3 years ago

Describe the bug

After an upgrade from version 3.3.0~ynh1 to version 3.3.0~ynh2, the pages looked unstyled.

image

Context

The yaml of the upgrade (which succeeded):

ended_at: 2021-04-26 08:14:04.856550
env:
  YNH_APP_CURRENT_VERSION: 3.3.0~ynh1
  YNH_APP_ID: mastodon
  YNH_APP_INSTANCE_NAME: mastodon
  YNH_APP_INSTANCE_NUMBER: '1'
  YNH_APP_MANIFEST_VERSION: 3.3.0~ynh2
  YNH_APP_UPGRADE_TYPE: UPGRADE_PACKAGE
  YNH_CWD: /var/cache/yunohost/from_file/scripts
  YNH_INTERFACE: cli
  YNH_STDINFO: /tmp/tmpfWsp4o/stdinfo
  YNH_STDRETURN: /tmp/tmpCrTH1e/stdreturn
error: null
interface: cli
operation: app_upgrade
parent: null
related_to:
- - app
  - mastodon
started_at: 2021-04-26 03:00:13.575068
success: true
yunohost_version: 4.1.8

Workaround

In the logs, I found that some styles were removed:

2021-04-26 10:11:55,813: DEBUG - + sudo -u mastodon RAILS_ENV=production PATH=/opt/rbenv/versions/mastodon/bin:/opt/rbenv/shims:/opt/rbenv/bin:/opt/node_n/n/versions/node/12/bin:/opt/node_n/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin bin/bundle exec rails assets:clean^M                             
2021-04-26 10:12:23,404: DEBUG - Removed /var/www/mastodon/live/public/packs/report.html^M                                 
2021-04-26 10:12:23,404: DEBUG - Removed /var/www/mastodon/live/public/packs/css/mailer-7b14325b.chunk.css^M
2021-04-26 10:12:23,404: DEBUG - Removed /var/www/mastodon/live/public/packs/css/common-3623162d.css.map^M
.....

The workaround I found consisted in removing the /var/www/mastodon/live/public/packs folder and then run RAILS_ENV=production bin/rails assets:precompile as suggested in the troubleshooting.

$ sudo su - mastodon -s /bin/bash # to be run as root
$ cd /var/www/mastodon/live/
$ mv public/packs/ /tmp/ # or use `rm -rf public/packs/` if you're sure about what you are doing
$ RAILS_ENV=production bin/rails assets:precompile

Thanks for your work :pray:. I am a bit in a hurry, don't hesitate to ask me further details and/or to follow more accurately your template! Cheers!

nocci-sl commented 3 years ago

same here... thank you for opening that issue...

yalh76 commented 3 years ago

OK, I will look at that

clawfire commented 3 years ago

I encounter similar issue with 3.3.0~ynh4 and tried your commands but got several issues.

First, the ruby version available in the system doesn't match the .ruby-version Tried this instead:

$ RAILS_ENV=production PATH=/opt/rbenv/versions/mastodon/bin bin/rails assets:precompile

But then I got errors about not having yarn nor node installed >.< Any idea how to proceed ?

yalh76 commented 2 years ago

Feel free to reopen this issue if needed