現在運用しているTrilium Notesについて、Intel Mac mini 2018 + Docker Desktop から Linux Mint Xfce 22.3のサーバマシンに移行する。
環境
- Trilium Notesのlatest
- 移行元
- Intel Mac mini 2018
- macOS Sonoma 14.6.1
- Docker Desktop for mac v4.76.0
- Intel Mac mini 2018
- 移行先
- ThinkPad L390
- Linux Mint Xfce 22.3
- Docker 29.5.2
手順
移行元のマシンで停止する。
docker compose down
docker-compose.ymlでデータディレクトリを確認する。TRILIUM_DATA_DIRがどうなっているか見る。
# Running `docker-compose up` will create/use the "trilium-data" directory in the user home
# Run `TRILIUM_DATA_DIR=/path/of/your/choice docker-compose up` to set a different directory
# To run in the background, use `docker-compose up -d`
services:
trilium:
# Optionally, replace `latest` with a version tag like `v0.90.3`
# Using `latest` may cause unintended updates to the container
image: triliumnext/trilium:latest
# Restart the container unless it was stopped by the user
restart: unless-stopped
environment:
- TRILIUM_DATA_DIR=/home/node/trilium-data
- TZ=Asia/Tokyo
ports:
# By default, Trilium will be available at http://localhost:8080
# It will also be accessible at http://<host-ip>:8080
# You might want to limit this with something like Docker Networks, reverse proxies, or firewall rules,
# however be aware that using UFW is known to not work with default Docker installations, see:
# https://docs.docker.com/engine/network/packet-filtering-firewalls/#docker-and-ufw
- '8080:8080'
volumes:
# Unless TRILIUM_DATA_DIR is set, the data will be stored in the "trilium-data" directory in the home directory.
# This can also be changed with by replacing the line below with `- /path/of/your/choice:/home/node/trilium-data
- ${TRILIUM_DATA_DIR:-~/trilium-data}:/home/node/trilium-data
# - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ここでは~/trilium-dataとなっている。ついでにMacで/etc/timezoneがなかったのでコメントアウトされているね。
とりあえずアーカイブ化しよう。
tar -czvf trilium-data-backup.tar.gz ~/trilium-data
こいつを新しいマシンに転送してやる。
scp trilium-data-backup.tar.gz ユーザ@IPアドレス:移行先のパス
新しいマシンで、これを保存先ディレクトリ上に展開する。今回はtrilium-dataにしている。
tar -xzvf trilium-data-backup.tar.gz
保存先ディレクトリに入って、もしデータベースの一時ファイルが存在したら削除する。
rm -f document.db-shm document.db-wal
準備ができたらコンテナの起動。とりあえずフロントで。
docker compose up
エラーなく起動したら、http://IPアドレス:ポートにアクセスする。以前使っていたパスワードでログインできることを確認する。
問題なければOK。Ctrl-cで停止して、改めてバックグラウンドで起動する。
docker compose up -d
これでOK。しばらく動かして、安定していることを確認したら元のコンテナは削除してよい。
<関連記事>


コメント
コメントは承認後に表示されます。
まだコメントはありません。
コメントを書く