ラズパイで動かしていたPleromaインスタンスが死にそうだったので移行に挑戦!

はじめに
パソコン何もわからないままインスタンスを立ててしまった人です。多分参考にならないです。 それを理解した上で読んでもらえると嬉しいです
Pleniya滅亡の危機
以前ラズパイでPleromaインスタンスを立ててみたのですが、最近調子が悪い・・・というかそもそもラズパイが起動しなくなってしまった。
ラズパイが起動しなくなってしまった原因は多分何回か強制的に電源をきったからですね・・・
watchdogタイマー?なるものを設定したのでフリーズすると勝手に再起動してくれるはずなのですが時々ずーっとssh接続もpingも返事してくれないときがあって、そんなときは強制的に電源を切っていたのですのよね。
このままでは良くない
と考え、一縷の望みにかけてPleromaインスタンスの移行に挑戦してみましたまずはラズパイを救う
まずはラズパイが起動するようにならないと話になりません。
・・・定期的にバックアップを取っていなかったのかって??取っているわけがない!!!
なので
どうにかうまく行ってくれ・・・
と祈りながらラズパイを救う方法を調べました。
色々調べてみたところfsckコマンドなるものを利用することで生き返らせることができるという情報を聞きましたのでその方法を試してみました。
ラズパイからSDカードを取り出して、ノートパソコン(Linuxmintを入れている。一ミリも使いこなせていない)に接続します
ブログを参考に何をしているのか全くわからないコマンド達を実行していきます
こちらのブログを参考に進めていきました RaspberryPi3で使っているmicroSD壊れLinuxコマンドfsckで検証
sudo fdisk -l
というコマンドを実行してみます
kamosika@kamosika-ThinkPad-E460:~$ sudo fdisk -l
Disk /dev/sda: 111.8 GiB, 120040980480 bytes, 234455040 sectors
Disk model: SanDisk SSD PLUS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: toriaezuokikaeteokuwakrankara
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 234452991 233402368 111.3G Linux filesystem
Disk /dev/mmcblk0: 7.42 GiB, 7963934720 bytes, 15554560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: toriaezuokikaeteokuwakrankara
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 532480 15554559 15022080 7.2G 83 Linux
SDカードが接続されているのがわかるっぽいです。
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 532480 15554559 15022080 7.2G 83 Linux
この子達みたいです
fsckコマンドはmount状態では使えないのでunmountというものをする必要があるみたいです
mount
コマンドを実行すると色々わかるそうです
(マウントってなんやねん・・・ファイルシステムってなんやねん・・・パーティションってなんやねん・・・という状態です進めています)
実行したらこんな感じ
kamosika@kamosika-ThinkPad-E460:~$ mount
省略
/dev/mmcblk0p1 on /media/kamosika/bootfs type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
以下のコマンドを実行するとunmountができるっぽい??ので実行します
kamosika@kamosika-ThinkPad-E460:~$ umount /dev/mmcblk0*
umount: /dev/mmcblk0: not mounted.
umount: /dev/mmcblk0p2: not mounted.
この状態でfsckコマンドを実行していくみたいなので実行していきます
1つ目
amosika@kamosika-ThinkPad-E460:~$ sudo fsck -V /dev/mmcblk0p1
fsck from util-linux 2.37.2
[/usr/sbin/fsck.vfat (1) -- /dev/mmcblk0p1] fsck.vfat /dev/mmcblk0p1
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
何も問題がないっぽい・・・?ので3番を選択して言ってそのまま何もしないままにしました
2つ目
kamosika@kamosika-ThinkPad-E460:~$ sudo fsck -V /dev/mmcblk0p2
fsck from util-linux 2.37.2
[/usr/sbin/fsck.ext4 (1) -- /dev/mmcblk0p2] fsck.ext4 /dev/mmcblk0p2
e2fsck 1.46.5 (30-Dec-2021)
rootfs: recovering journal
Journal transaction 354711 was corrupt, replay was aborted.
rootfs contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix<y>?
ん!?問題があるっぽい!!!yを連打していきます!!
kamosika@kamosika-ThinkPad-E460:~$ sudo fsck -V /dev/mmcblk0p2
fsck from util-linux 2.37.2
[/usr/sbin/fsck.ext4 (1) -- /dev/mmcblk0p2] fsck.ext4 /dev/mmcblk0p2
e2fsck 1.46.5 (30-Dec-2021)
rootfs: recovering journal
Journal transaction 354711 was corrupt, replay was aborted.
rootfs contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix<y>? yes
Inode 144506 was part of the orphaned inode list. FIXED.
Deleted inode 144537 has zero dtime. Fix<y>? yes
Inode 144538 was part of the orphaned inode list. FIXED.
Inode 144539 was part of the orphaned inode list. FIXED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(534174--534175) -534555 -534559
Fix<y>? yes
Free blocks count wrong for group #16 (20959, counted=20963).
Fix<y>? yes
Free blocks count wrong (1054417, counted=1052306).
Fix<y>? yes
Inode bitmap differences: -144506 -(144537--144539)
Fix<y>? yes
Free inodes count wrong for group #18 (7130, counted=7134).
Fix<y>? yes
Directories count wrong for group #18 (44, counted=40).
Fix<y>? yes
Free inodes count wrong (401636, counted=401635).
Fix<y>? yes
rootfs: ***** FILE SYSTEM WAS MODIFIED *****
rootfs: 61437/463072 files (0.4% non-contiguous), 825454/1877760 blocks
これで治ったのか・・・?恐る恐るもう一度ラズパイにSDカードを差し込んでみると
なんと起動するようになりました!!3>
すげぇ・・・!!
感謝・・・感謝・・・奇跡と情報、ツールへ感謝・・・
Pleromaインスタンスを移行する
ラズパイ側(移行元)で色々する
Pleromaインスタンスを移行する
ラズパイ側(移行元)で色々する
Backup/Restore/Move/Remove your instance
こちらを参考に進めていきます。
ラズパイにssh接続します
バックアップ先のディレクトリは書き込みができる必要があるみたいなのでこんな感じ
kamosika@komaniya:/opt/pleroma $ mkdir ~/pleroma_backup
kamosika@komaniya:/opt/pleroma $ ls ~/
pleroma_backup src
kamosika@komaniya:/opt/pleroma $ ls -l ~/
total 8
drwxr-xr-x 2 kamosika kamosika 4096 Nov 9 23:43 pleroma_backup
drwxr-xr-x 2 kamosika kamosika 4096 Oct 16 21:51 src
kamosika@komaniya:/opt/pleroma $ chmod 777 ~/pleroma_backup
kamosika@komaniya:/opt/pleroma $ ls -l ~/
total 8
drwxrwxrwx 2 kamosika kamosika 4096 Nov 9 23:43 pleroma_backup
どんどん手順に従っていきます
sudo -Hu postgres pg_dump -d <pleroma_db> --format=custom -f </path/to/backup_location/pleroma.pgdump>
今コマンドを実行する必要があるみたいなのですが、**<pleroma_db>ってなんじゃぁ・・・**なりました
多分設定ファイルに書かれているこれじゃろう・・・と適当に目星をつけて実行しました
onfig :pleroma, Pleroma.Repo,
adapter: Ecto.Adapters.Postgres,
username: "pleroma",
password: "miserarenaiyo",
database: "pleroma",
hostname: "localhost",
prepare: :named,
parameters: [
plan_cache_mode: "force_custom_plan"
]
設定ファイルの中のこれdatabase: “pleroma”
なのでこんな感じで実行して見ました
sudo -Hu postgres pg_dump -d pleroma --format=custom -f /home/kamosika/pleroma_backup/pleroma.pgdump
kamosika@komaniya:/opt/pleroma $ ls -l ~/pleroma_backup/
total 332
-rw-r--r-- 1 postgres postgres 339395 Nov 9 23:51 pleroma.pgdump
ちゃんとバックアップ?が作成されているっぽかったので良かったです。
次に進みます。
次の手順が・・・
Copy pleroma.pgdump, config/prod.secret.exs, config/setup_db.psql (if still available) and the uploads folder to your backup destination. If you have other modifications, copy those changes too.
となっているのですが、prod.secret.exsもsetup_db.psqlも見つからん・・・
多分prod.secret.exsは設定ファイル(自分の環境では/etc/pleroma/config.exsってなっているっぽい)だと目星をつけてバックアップとして保存しておきました。
setup_db.psqlは見つからないので諦めました(if still availableって書いてあるしまあいいでしょう!)
google Coumpute Engine(移行先)で色々する
GCE無料枠・・・というものがあるということを知り、**本当に!??**と思いつつ使ってみることにしました。
色々なサイトを参考にssh接続とかできるようにして・・・(無知は自分はそこそこ苦労した)
(2023年版) Google Cloud 無料枠 ホントに課金されない?の検証
移行先で一旦は普通にPleromaの導入をする必要があるっぽいので
こちらを参考に進めていきました
しかし、
wget -P /tmp/ https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
sudo dpkg -i /tmp/erlang-solutions_2.0_all.deb
sudo apt update
ここまで進めた際に
kamosika@pleniya:~$ sudo apt update
Get:1 file:/etc/apt/mirrors/debian.list Mirrorlist [30 B]
Get:2 file:/etc/apt/mirrors/debian-security.list Mirrorlist [39 B]
Hit:7 https://packages.cloud.google.com/apt google-compute-engine-bookworm-stable InRelease
Hit:3 https://deb.debian.org/debian bookworm InRelease
Hit:8 https://packages.cloud.google.com/apt cloud-sdk-bookworm InRelease
Hit:4 https://deb.debian.org/debian bookworm-updates InRelease
Ign:9 http://binaries.erlang-solutions.com/debian bookworm InRelease
Hit:5 https://deb.debian.org/debian bookworm-backports InRelease
Err:10 http://binaries.erlang-solutions.com/debian bookworm Release
404 Not Found [IP: 13.224.14.42 80]
Hit:6 https://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists... Done
E: The repository 'http://binaries.erlang-solutions.com/debian bookworm Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
こんな感じで文句を言われるようになっちゃいました・・・
(aptもどんな仕組みで動いているのか全くわからん)
気まぐれで英語の方の導入方法説明ページを見たところ
Installing on Debian Based Distributions
sudo apt update
sudo apt install elixir erlang-dev erlang-nox
なんか別の方法で作業を進めている!!
ことに気づいたので英語のページを参考にしながら進めて行くことにしました。
ちなみに
/etc/apt/sources.list.d/erlang-solutions.list
この子をrmコマンドで消して上げるとsudo update
でエラーが出なくなりました
aptで取って来れるelixir?elangのバージョンが上がってきているので別の方法でも問題なくなって理解であっているのでしょうか・・・? Package: elixir (1.14.0.dfsg-2)
どんどん手順通りに進めていきます(割愛)
sudo -Hu pleroma MIX_ENV=prod mix phx.server
ここまで実行したあとに(実行が止まらない?のでctrl+cをしたあとにabort?っていうのを選択して中断した)
Nginxの設定部分は無視して、(cloudflaretunnelを利用する予定なので)
Systemd serviceって書かれた部分の設定を済ませました。
その後に一旦ブラウザからちゃんとページが見えているかな?って確認しました。
ここからが移行の本番?
移行元で保存しておいたファイル達を移行先に送ってあげました
移行方法を確認すると
Copy the above mentioned files back to their original position.
・・・とありますが、original positionてなに!?!?色々ファイル構成変わっているけど!?ってなりました。
多分移行元の方ではOTPインストール?方法を利用していたこともあって色々違いがあるのでしょうね・・・
ここで正直**移行うまく行かないかも・・・**となりながらダメ元で作業を進めていきました
まあ仕方ないので勘で進めました
kamosika@pleniya:/opt/pleroma$ sudo cp -r ~/pleroma_backup/uploads/* uploads/
kamosika@pleniya:/opt/pleroma$ ls uploads/
1def4686ab0dc60dbe287e6eb86ac4171f1db56cbc39d665c1c35cd3444926e6.jpeg
1eb6c409da4a7a850ba46c090b9339e43e8c8c28268b2ea5e0ba51b3226b681b.png
uploadsのファイルをコピーしてあげて
kamosika@pleniya:/opt/pleroma$ sudo chown pleroma uploads/*
kamosika@pleniya:/opt/pleroma$ ls -l uploads/
total 15632
-rw-r--r-- 1 pleroma root 1931823 Nov 11 18:02 1def4686ab0dc60dbe287e6eb86ac4171f1db56cbc39d665c1c35cd3444926e6.jpeg
所有者とか変更しないと怒られそ~~~と思ったのでなんとなく変えました(正しいかわからないけど)
次は設定ファイルを置き換えていくのですが
kamosika@pleniya:/opt/pleroma$ sudo -Hu pleroma cp config/prod.secret.exs config/prod.secret_back.exs
一旦バックアップを取っておきます
kamosika@pleniya:/opt/pleroma$ sudo ls -l config/prod.secret.exs
-rw-r----- 1 pleroma pleroma 2655 Nov 11 17:16 config/prod.secret.exs
kamosika@pleniya:/opt/pleroma$ sudo rm config/prod.secret.exs
kamosika@pleniya:/opt/pleroma$ sudo cp ~/pleroma_backup/
config.exs pleroma.pgdump uploads/
kamosika@pleniya:/opt/pleroma$ sudo cp ~/pleroma_backup/config.exs config/prod.secret.exs
kamosika@pleniya:/opt/pleroma$ ls -l config/prod.secret.exs
-rw-r----- 1 root root 2765 Nov 11 18:10 config/prod.secret.exs
コピーしてー
kamosika@pleniya:/opt/pleroma$ ls -l config/prod.secret.exs
-rw-r----- 1 root root 2765 Nov 11 18:10 config/prod.secret.exs
kamosika@pleniya:/opt/pleroma$ chown pleroma:pleroma config/prod.secret.exs
chown: changing ownership of 'config/prod.secret.exs': Operation not permitted
kamosika@pleniya:/opt/pleroma$ sudo chown pleroma:pleroma config/prod.secret.exs
kamosika@pleniya:/opt/pleroma$ ls -l config/prod.secret.exs
-rw-r----- 1 pleroma pleroma 2765 Nov 11 18:10 config/prod.secret.exs
所有者とか変えました
その後に
sudo -Hu postgres psql -c 'DROP DATABASE pleroma;'; sudo -Hu postgres psql -c 'DROP USER pleroma;'
を実行して上げました。
次の手順
Restore the database schema and pleroma postgres role the with the original setup_db.psql if you have it: sudo -Hu postgres psql -f config/setup_db.psql.
とありますが、移行元にそのファイルが無かったんです・・・
と思っていたのですが、移行先でPleomaインスタンスを立てる際に作られたsetup_db.psqlでもいいっぽい!?のでそういうことにして進めていきます
kamosika@pleniya:/opt/pleroma$ ls config/
benchmark.exs dev.exs emoji.txt prod.secret_back.exs
config.exs docker.exs prod.exs setup_db.psql
description.exs dokku.exs prod.secret.exs test.exs
kamosika@pleniya:/opt/pleroma$ sudo -Hu postgres psql -f config/setup_db.psql
CREATE ROLE
CREATE DATABASE
You are now connected to database "pleroma" as user "postgres".
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
そして次の手順に進みます
kamosika@pleniya:/opt/pleroma$ sudo -Hu postgres pg_restore -d pleroma -v -1 ~/pleroma_backup/pleroma.pgdump
pg_restore: connecting to database for restore
絶対に新しいバージョンをいれている気がするので次の手順もやります
何を行っているのかわからない(英語弱者) 多分こうするんだろう(適当)
kamosika@pleniya:/opt/pleroma$ MIX_ENV=prod mix ecto.migrate
fatal: detected dubious ownership in repository at '/opt/pleroma'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/pleroma
fatal: detected dubious ownership in repository at '/opt/pleroma'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/pleroma
fatal: detected dubious ownership in repository at '/opt/pleroma'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/pleroma
** (File.Error) could not read file "/opt/pleroma/config/prod.secret.exs": permission denied
(elixir 1.14.0) lib/file.ex:358: File.read!/1
(elixir 1.14.0) lib/config.ex:273: Config.__import__!/1
(stdlib 4.2) erl_eval.erl:744: :erl_eval.do_apply/7
(stdlib 4.2) erl_eval.erl:136: :erl_eval.exprs/6
(elixir 1.14.0) lib/code.ex:422: Code.validated_eval_string/3
(stdlib 4.2) erl_eval.erl:744: :erl_eval.do_apply/7
えーーーーん!!!!えーん!!!
怒られました。
ん!sudoつけ忘れただけかも!!!
amosika@pleniya:/opt/pleroma$ sudo MIX_ENV=prod mix ecto.migrate
fatal: detected dubious ownership in repository at '/opt/pleroma'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/pleroma
fatal: detected dubious ownership in repository at '/opt/pleroma'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/pleroma
fatal: detected dubious ownership in repository at '/opt/pleroma'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/pleroma
Could not find Hex, which is needed to build dependency :phoenix
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn]
えーーーーん!!!!えーん!!!
一応yにします・・・ただ結局エラー出ている・・・ あ!!!!!!!!違う!!!!!!!!!!pleromaとして実行しないとだよ・・・!!途中で中断!!! まにあった・・?だめ・・・?
git config --global --add safe.directory /opt/pleroma
Could not find Hex, which is needed to build dependency :phoenix
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn]
* creating /root/.mix/archives/hex-2.0.6
==> restarter
Generated restarter app
==> pleroma
Compiling 599 files (.ex)
^C
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
(l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
a
kamos
お願いセーフってことにして・・・
kamosika@pleniya:/opt/pleroma$ sudo -Hu pleroma MIX_ENV=prod mix ecto.migrate
Compiling 599 files (.ex)
18:30:23.462 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.QuoteToLinkTagPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.NoEmptyPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.EnsureRePrepended is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.FollowBotPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.DropPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.TagPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.521 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:30:23.522 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.NoOpPolicy 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
18:32:02.049 [error] Postgrex.Protocol (#PID<0.4662.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "pleroma"
18:32:02.050 [error] Postgrex.Protocol (#PID<0.4661.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "pleroma"
18:32:03.299 [error] Postgrex.Protocol (#PID<0.4661.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "pleroma"
18:32:04.548 [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 2978ms. 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.14.0) lib/enum.ex:1658: 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.6.0) lib/mix/tasks/pleroma/ecto/migrate.ex:63: Mix.Tasks.Pleroma.Ecto.Migrate.run/1
えーーーーん!!!!えーん!!!!!!
うん・・・?パスワードが間違っているっぽい・・・?
なるほど、移行元の設定ファイルをそのままコピーしたから移行元のデータベースのパスワードになってなのか・・・
設定ファイルを取っておいてよかったぁ~!!
設定ファイル内のデータベースのパスワードを設定する項目を変更してもう一度実行してみます
kamosika@pleniya:/opt/pleroma$ sudo -Hu pleroma vim config/prod.secret.exs
kamosika@pleniya:/opt/pleroma$ sudo -Hu pleroma MIX_ENV=prod mix ecto.migrate
==> restarter
Generated restarter app
==> pleroma
Compiling 599 files (.ex)
18:38:51.880 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.QuoteToLinkTagPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.NoEmptyPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.EnsureRePrepended is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.FollowBotPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.DropPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.TagPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicy is excluded from config descriptions, because does not implement `config_description/0` method.
18:38:51.915 [debug] Elixir.Pleroma.Web.ActivityPub.MRF.NoOpPolicy 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
18:40:31.351 [info] == Running 20221216052127 Pleroma.Repo.Migrations.AddStateToBackups.up/0 forward
18:40:31.351 [info] alter table backups
18:40:31.359 [info] == Migrated 20221216052127 in 0.0s
18:40:31.601 [info] == Running 20230306112859 Pleroma.Repo.Migrations.InstancesAddMetadata.change/0 forward
18:40:31.602 [info] alter table instances
18:40:31.605 [info] == Migrated 20230306112859 in 0.0s
18:40:31.608 [info] == Running 20230422154018 Pleroma.Repo.Migrations.DropUnusedIndexes.up/0 forward
18:40:31.608 [info] drop index if exists activities_actor_index
18:40:31.621 [info] drop index if exists activities_to_index
18:40:31.624 [info] drop index if exists activities_cc_index
18:40:31.626 [info] drop index if exists activities_hosts
18:40:31.844 [info] drop index if exists activities_in_reply_to
18:40:31.846 [info] drop index if exists activities_likes
18:40:31.848 [info] == Migrated 20230422154018 in 0.2s
18:40:31.850 [info] == Running 20230504173400 Pleroma.Repo.Migrations.RemoveUserApEnabled.change/0 forward
18:40:31.850 [info] alter table users
18:40:31.853 [info] == Migrated 20230504173400 in 0.0s
うまくいったっぽい!!
リスタートして・・・
sudo systemctl restart pleroma
どんどん指示に従っていって
sudo -Hu postgres vacuumdb --all --analyze-in-stages
これで・・・おわり・・・?どきどきするわ・・・ 固唾をのみながらページにアクセスしてみます
す・・・すげぇ・・・画像がおかしいけどいけている・・・
設定ファイルの個々の部分を見直してみたら画像も表示されるようになりました
config :pleroma, :instance, static_dir: "/opt/pleroma/instance/static"
config :pleroma, Pleroma.Uploaders.Local, uploads: "/opt/pleroma/uploads"
きたーーー!!!!すげーーーー!!!!
本当に移行できるとは・・・(壊すつもりだった・・・)
こんな適当でも移行がうまく行ってしまうように作られているのか・・・凄すぎる・・・
よかったらフォローしてねはーと
https://plrm.komaniya.work/users/kamosika