公式の手順に従ってやる
入れたいバージョンのソースをGitで持ってくる
$ cd /opt/pleroma
$ sudo -Hu pleroma git fetch --all
Fetching origin
warning: redirecting to https://git.pleroma.social/pleroma/pleroma.git/
remote: Enumerating objects: 605, done.
remote: Counting objects: 100% (605/605), done.
remote: Compressing objects: 100% (299/299), done.
remote: Total 605 (delta 405), reused 412 (delta 298), pack-reused 0
Receiving objects: 100% (605/605), 306.67 KiB | 646.00 KiB/s, done.
Resolving deltas: 100% (405/405), completed with 22 local objects.
From https://git.pleroma.social/pleroma/pleroma
2d193861d..1f4be2b34 stable -> origin/stable
+ 4b95855c5...3713791ae bugfix/elixir-1.15 -> origin/bugfix/elixir-1.15 (forced update)
e38207162..4e355b859 develop -> origin/develop
+ bcc83362c...ee62a7b29 elixir-1.12 -> origin/elixir-1.12 (forced update)
* [new branch] fix-dockerfile-perms -> origin/fix-dockerfile-perms
* [new branch] release/2.6.0 -> origin/release/2.6.0
* [new branch] test_cleanup -> origin/test_cleanup
* [new branch] tusooa/2810-punycode-mention -> origin/tusooa/2810-punycode-mention
+ e796c9a56...e448b7555 tusooa/3018-unified-stream -> origin/tusooa/3018-unified-stream (forced update)
+ 623117736...1ab4ab8d3 tusooa/extract-fix -> origin/tusooa/extract-fix (forced update)
26b499eca..bffa258a2 tusooa/quote -> origin/tusooa/quote
* [new tag] v2.5.4 -> v2.5.4
* [new tag] v2.5.3 -> v2.5.3
今回はv2.5.4にしたいのでv2.5.4をcheckoutする
$ sudo -Hu pleroma git checkout v2.5.4
M mix.lock
Note: switching to 'v2.5.4'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 1f4be2b34 Merge branch 'releases/2.5.4' into 'stable'
detached HEADになるけどどうでもいいのでOK
ライブラリ類持ってくる
そういう操作をしてるもんだと理解してるけど実際どうなのかは知らない
$ sudo -Hu pleroma mix deps.get
!!! RUNNING IN LOCALHOST DEV MODE! !!!
FEDERATION WON'T WORK UNTIL YOU CONFIGURE A dev.secret.exs
Resolving Hex dependencies...
Resolution completed in 1.824s
Unchanged:
accept 0.3.5
base62 1.2.2
bbcode_pleroma 0.2.0
略
unicode_util_compat 0.7.0
unsafe 1.0.1
web_push_encryption 0.3.1
websockex 0.4.3
Pleroma停止→マイグレーション→起動
$ sudo systemctl stop pleroma
$ sudo -Hu pleroma MIX_ENV=prod mix ecto.migrate
Compiling 592 files (.ex)
00:31:34.997 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
略
00:31:35.031 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent is excluded from config descriptions, because does not implement `config_description/0` method.
Compiling lib/pleroma/web/router.ex (it's taking more than 10s)
Generated pleroma app
00:31:46.277 [info] Migrations already up
$ sudo systemctl start pleroma
$
起動したらおわり
mix ecto.migrateでpostgresがなんか文句言ってきた場合
MIX_ENV=prod
渡してないとDBパスワード参照できなくてコケる
$ sudo -Hu pleroma mix ecto.migrate
!!! RUNNING IN LOCALHOST DEV MODE! !!!
FEDERATION WON'T WORK UNTIL YOU CONFIGURE A dev.secret.exs
Compiling 592 files (.ex)
Compiling lib/pleroma/web/router.ex (it's taking more than 10s)
!!! RUNNING IN LOCALHOST DEV MODE! !!!
FEDERATION WON'T WORK UNTIL YOU CONFIGURE A dev.secret.exs
略
00:28:59.677 [error] Postgrex.Protocol (#PID<0.4642.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
00:28:59.895 [error] Could not create schema migrations table. This error usually happens due to the following:
* The database does not exist
* The "schema_migrations" table, which Ecto uses for managing
migrations, was defined by another library
* There is a deadlock while migrating (such as using concurrent
indexes with a migration_lock)
To fix the first issue, run "mix ecto.create" for the desired MIX_ENV.
To address the second, you can run "mix ecto.drop" followed by
"mix ecto.create", both for the desired MIX_ENV. Alternatively you may
configure Ecto to use another table and/or repository for managing
migrations:
config :pleroma, Pleroma.Repo,
migration_source: "some_other_table_for_schema_migrations",
migration_repo: AnotherRepoForSchemaMigrations
The full error report is shown below.
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2954ms. This means requests are coming in and your connection pool cannot serve them fast enough. You can address this by:
1. Ensuring your database is available and that you can connect to it
2. Tracking down slow queries and making sure they are running fast enough
3. Increasing the pool_size (although this increases resource consumption)
4. Allowing requests to wait longer by increasing :queue_target and :queue_interval
See DBConnection.start_link/2 for more information
(ecto_sql 3.10.1) lib/ecto/adapters/sql.ex:913: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
(ecto_sql 3.10.1) lib/ecto/adapters/sql.ex:1005: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.10.1) lib/ecto/migrator.ex:738: Ecto.Migrator.verbose_schema_migration/3
(ecto_sql 3.10.1) lib/ecto/migrator.ex:552: Ecto.Migrator.lock_for_migrations/4
(ecto_sql 3.10.1) lib/ecto/migrator.ex:428: Ecto.Migrator.run/4
(ecto_sql 3.10.1) lib/ecto/migrator.ex:170: Ecto.Migrator.with_repo/3
(pleroma 2.5.4+dev) lib/mix/tasks/pleroma/ecto/migrate.ex:63: Mix.Tasks.Pleroma.Ecto.Migrate.run/1
(mix 1.12.2) lib/mix/task.ex:394: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.12.2) lib/mix/task.ex:452: Mix.Task.run_alias/5
(mix 1.12.2) lib/mix/cli.ex:84: Mix.CLI.run_task/2
(elixir 1.12.2) lib/code.ex:1261: Code.require_file/2
おわり
サービス停止させずにマイグレーション掛けたら何が起きるのか誰か試してみてほしい 私はやりません