(Mastodon Upgrade)

From Bgzashtita Official wiki
Revision as of 00:15, 22 May 2025 by 192.168.0.1 (talk) (solve mismatch collation pysql)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

sudo cp /var/lib/redis/dump.rdb /tmp/backup.rdb

sudo su - mastodon

pg_dump mastodon_production > /tmp/backup.psqld

cp live/.env.production /tmp/.env.production

sudo su - mastodon

cd live

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.0.4

rbenv global 3.0.4

git fetch && git checkout v4.0.2

git -C /home/mastodon/.rbenv/plugins/ruby-build pull


bundle install

yarn install

SKIP_POST_DEPLOYMENT_MIGRATIONS=true RAILS_ENV=production bundle exec rails db:migrate


RAILS_ENV=production bundle exec rails assets:precompile " Ako ima greshka da se probva sus: NODE_OPTIONS=--openssl-legacy-provider RAILS_ENV=production bundle exec rails assets:precompile " https://github.com/mastodon/mastodon/issues/24141

exit

sudo systemctl restart 'mastodon*'

sudo su - mastodon

cd live && RAILS_ENV=production bundle exec rails db:migrate

exit

sudo systemctl restart 'mastodon*'

https://techbits.io/mastodon-4-upgrade/





WARNING: database "mastodon_production" has a collation version mismatch DETAIL: The database was created using collation version 2.40, but the operating system provides version 2.41. HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE mastodon_production REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.


1. make backup of postresql of mastodon:

pg_dump mastodon_production > mastodon_backup.sql

In case you dont need make backup skip point 1.

2. Connect with user postgres and psql:

sudo -u postgres psql

3. This generate all index with database using collation actual

REINDEX DATABASE "mastodon_production";


4. Refresh version of collation:

ALTER DATABASE mastodon_production REFRESH COLLATION VERSION;

5. Verify that it dont appear mismatch collation:

psql \q

and return connect

6. connect to database:

\c mastodon_production