0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Mutagen コマンド一覧

Posted at

※ 誤りがある可能性あり。随時修正します。

インストール

  • brew install mutagen-io/mutagen/mutagen Homebrew でインストール
    • brew install mutagen-io/mutagen/mutagen-beta β版をインストール (mutagen-edge でナイトリービルド版) ※2021-03-13現在、mutagen composeコマンドはベータでしか使えない

コマンド

  • mutagen --help ``mutagen --help` ヘルプ

同期

  • mutagen sync create --name=web-app-code ~/project user@example.org:~/project ローカルの ~/project と SSH接続エンドポイントをセッション名 "web-app-code" で同期
    mutagen sync pause web-app-code 一時停止
  • mutagen sync resume web-app-code 再開
  • mutagen sync flush web-app-code 手動で同期をトリガー (監視ツール併用時に有用)
  • mutagen sync reset web-app-code リセット
  • mutagen sync terminate web-app-code 停止、セッション削除
  • mutagen sync list 同期ステータスを一覧表示
  • mutagen sync monitor web-app-code セッションのモニタリング(同期) セッション名未指定なら最近のものを表示

SSH 接続で Webサーバーに接続・同期するサンプル (エックスサーバー)

鍵作成時のパスフレーズが必要

  1. 鍵認証設定、.ssh/config で SSH 接続設定をしておく
  2. ssh-add -K ~/.ssh/XXXX_rsa 毎回パスフレーズ入力を要求されるのを防ぐため、Macのキーチェーンにパスフレーズを登録しておく
  3. mutagen sync create --name=セッション名 ~/ローカルフォルダ サーバーID@サーバーID.xsrv.jp:10022:~/サーバーID.xsrv.jp/public_html/同期フォルダパス (この時、2をしていないと、パスフレーズ4回くらい聞かれる。操作の都度聞かれる)
  4. mutagen sync terminate mutagen-test 終了時

ネットワークフォワーディング(IPフォワーディング、ポートフォワーディング)

  • mutagen forward create --name=web-app tcp:localhost:8080 docker://devcontainer:tcp:localhost:1313 ローカル localhost:8080 と Dockerコンテナ :1313 をセッション名 "web-app" で
  • mutagen forward pause web-app 一時停止
  • mutagen forward resume web-app 再開
  • mutagen forward terminate web-app
  • mutagen forward list フォワーディング中のステータスを一覧表示
  • mutagen forward monitor web-app セッションのモニタリング(フォワーディング)セッション名未指定なら最近のものを表示

デーモン

  • mutagen daemon start デーモンの起動
    (.bashrc や .profile でシェル起動時に起動も可能)
  • mutagen daemon stop デーモンの停止
  • mutagen daemon register mac、Windowsでログイン時に自動起動

project

  • mutagen project start 現在いるディレクトリにある mutagen.yml の設定で実行
  • mutagen project list
  • mutagen project flush
  • mutagen project pause
  • mutagen project resume
  • mutagen project reset
  • mutagen project terminate

mutagen.yml で設定

Mutagen のプロジェクトごとの設定ファイルは、ルートに mutagen.yml。
ユーザー/.mutagen.yml (無ければ作成) で全セッションで適用する設定 » 説明» サンプル

設定

  • mode
    • two-way-safe (Default)
    • two-way-resolved コンフリクトが起きた時、Alpha 優先で自動解決してくれる
    • one-way-safe Alpha から Beta に一方的に同期。Beta で更新・作成したファイルはコンフリクトと見なされずそのまま残る
    • one-way-replica Alpha から Beta に一方的に同期。Beta は Alpha の完全なレプリカとなる
  • ignore で vcs: true で、バージョン管理システムのファイル(.git, .svn 等)を無視する
  • permissions
  • symlink シンボリックリンク
  • watch: mode: portable 監視。デフォルトportable
  • probeMode: probe, scanMode: accelerated
  • stageMode: mutagen ステージングのファイル置き場
  • maxStagingFileSize:, maxEntryCount: 未指定か0で、2の64-1バイトが設定される
  • 前後の処理
beforeCreate:
  - docker-compose up --build --detach

afterTerminate:
  - docker-compose down --rmi=all --volumes

その他の設定

  • MUTAGEN_DISABLE_AUTOSTART=1 デーモン自動起動をオフ
  • MUTAGEN_DATA_DIRECTORY

メモ

  • Mutagen のデータフォルダ(Mac) ユーザー/.mutagen ※MUTAGEN_DATA_DIRECTORY で変更可能
  • OpenSSH
  • デフォルトのパーミッションは、ディレクトリ700、ファイル600

参考URL

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?