Upgrade Mastodon: Difference between revisions

2,119 bytes added ,  03:26, 1 December 2023
no edit summary
(Added some feature contribution guidelines from another page)
No edit summary
 
Line 86: Line 86:
RAILS_ENV=production bundle exec rails db:migrate
RAILS_ENV=production bundle exec rails db:migrate
</syntaxhighlight>
</syntaxhighlight>
== Problems ==
(and solutions)
=== Precompilation Failed ===
You might see something like this:
<pre>
mastodon@localhost:~/live$ RAILS_ENV=production bundle exec rails assets:precompile
DEPRECATION WARNING: Support for `config.active_support.cache_format_version = 6.1` has been deprecated and will be removed in Rails 7.2.
Check the Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
for more information on how to upgrade.
(called from <main> at /home/mastodon/live/config/environment.rb:7)
Compiling...
Compilation failed:
`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration`
    at isModuleDeclaration (/home/mastodon/live/node_modules/babel-plugin-lodash/node_modules/@babel/types/lib/validators/generated/index.js:2740:35)
    at PluginPass.Program (/home/mastodon/live/node_modules/babel-plugin-lodash/lib/index.js:102:44)
</pre>
and assume that the compilation fails because of the deprecation error that follows immediately after "compilation failed:" but it is not so.
This is an OOM error, see: https://github.com/glitch-soc/mastodon/issues/2423
To remedy:
1) Switch back to your user (from the <code>mastodon</code> user) that has root permissions and stop the [[ElasticSearch]] process. Return to the mastodon user.
<syntaxhighlight lang="bash">
# previously...
# sudo su mastodon
exit # assuming you're the mastodon user
sudo systemctl stop elasticsearch
# return to mastodon user
sudo su mastodon
</syntaxhighlight>
2) Since disrupting the asset precompilation may leave you in a state where webpack thinks it has successfully compiled, you need to clobber the previous assets
<syntaxhighlight lang="bash">
cd ~/live
RAILS_ENV=production bundle exec rails assets:clobber
</syntaxhighlight>
3) Proceed with precompilation...
<syntaxhighlight lang="bash">
RAILS_ENV=production bundle exec rails assets:precompile
</syntaxhighlight>
4) Remember to restart elasticsearch afterwards!
<syntaxhighlight lang="bash">
exit
sudo systemctl start elasticsearch
</syntaxhighlight>


== Discord ==
== Discord ==