Docker asset recompile error upgrading v2.7.3 -> v2.8.0

#1

I unwisely skipped v2.7.4 and upgraded my instance from 2.7.3 straight to 2.8.0.
I’m using docker. git checkout v2.8.0 complained that I had local changes (though I haven’t made any local changes to the code) so I ran git checkout -f v2.8.0 which probably wasn’t a good idea but has resolved problems previously.

I now have a running instance which works fine except that the /about and /explore pages don’t render properly. Web Console on those pages shows:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

So looks like there’s some kind of CORS problem in the HTML?

I tried to recompile assets by running:

docker-compose run --rm web rails assets:precompile

Running this with --trace shows there’s an error at the Execute assets:generate_static_pages stage:

rails aborted!
ActionView::Template::Error: Webpacker can't find error in /opt/mastodon/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.

Any suggestions for how to fix this gratefully received. I’m aware 2.8.1 has just been released but I don’t want to try a further upgrade and make the problem worse.

#2

Actually, I think the CORS issue may be a red herring. It appears that I should have /public/css and /public/js directories, but I don’t. I’m guessing this is a webpack issue but not really sure how to proceed from here.

#3

Won’t help with webpack, but can you check this Installation - Mastodon documentation and compare your nginx.conf files for changes?

#4

I’m going to try a rollback and re-upgrade tomorrow, but thanks for this tip - looks like I’m missing some proxy_cache settings amongst a couple of other things.

#5

Make some changes like replace the logo with your own logos and recompile again. I had same issue like yours before.

#6

Ok I think I’ve found the problem. I’ve been over-writing my docker-compose.yml file with each upgrade using the one I knew worked, and just updating the version number. Turns out that’s not such a great move. I commented out:

- ./public/packs:/mastodon/public/packs

from volumes in web and sidekiq and then ran docker-compose up -d. Seemed to do the trick, though I’ll probably need to do a full refresh of the docker-compose file and possibly also by nginx file as per @saper’s suggestion.

#7

I’ve updated my nginx to be exactly as per /home/mastodon/live/dist/nginx.conf and I’m still getting the CORS error on v2.8.2. I’ve checked some other sites running 2.8.2 and they have it as well, so there might be a step missing somewhere.

#8

I’d check the HTTP requests/responses if the headers are still being set properly. Sometimes your configuration change may not be effective for some strange reason.