With snap install method for SemaphoreUI going deprecated, I recently endeavored on the process to migrate to another hosting method. I chose to install package version of Semaphore on the same system. I had originally intended use the backup and restore capabilities on a fresh install but ran into multiple issues which all appear to be bugs that have been fixed but impact the latest version of Semaphore in the snap. I then went a different route that I’m suggesting here be added as a documented path for others to migrate.

SemaphoreUIのSnapファイルをパッケージマネージャーまたはバイナリインストールで使用するための移行手順: 注: この方法では、SemaphoreUIのデータベースとしてboltdbを保持します

  1. sudo su -または他の有効な方法でrootとしてログインします。
  2. SemaphoreUIのsnapバージョンを停止します。 snap stop semaphore.semaphored
  3. snapから新しいディレクトリにファイルをコピーします。このディレクトリは、新しいシステムユーザーsemaphoreのホームディレクトリになります。 cp -rf /root/snap/semaphore/common /home/semaphore
  4. repositoriesフォルダーを新しい一時フォルダーの場所に移動します。 mv -f /home/semaphore/repositories /tmp/semaphore
  5. config.jsonを新しいdatabase.boltdbと一時フォルダーへのパスで更新します。 sed -i 's/\/root\/snap\/semaphore\/common\/database.boltdb/\/home\/semaphore\/database.boltdb/' /home/semaphore/config.json sed -i 's/\/root\/snap\/semaphore\/common\/repositories/\/tmp\/semaphore/' /home/semaphore/config.json
  6. /home/semaphoreをホームフォルダーとして持つ新しいシステムユーザーおよびグループsemaphoreを作成します。 adduser --system --group --home /home/semaphore --no-create-home --shell /bin/bash semaphore
  7. /home/semaphoreとすべてのファイルの所有権を新しいシステムユーザーに移転します。 chown -R semaphore:semaphore /tmp/semaphore chmod o-rwx /home/semaphore chown -R semaphore:semaphore /home/semaphore

これらの手順が完了したら、semaphoreをサービスユーザーまたはグループとして使用して、パッケージマネージャーを介してSemaphoreをインストールおよび設定します。すべての設定と以前の実行は、新しいSemaphoreUIインスタンスに表示されるはずです。満足したら、snapインスタンスはsudo snap remove semaphoreで削除できます。

私はこれらの手順をこのbashファイルを通じて自動化しました:

#/bin/bash
#File: migrate-semaphore-snap.sh
#Migrate SemaphoreUI from snap as root to package/binary as semaphore
sudo su -l root <<EOF
set -x
snap stop semaphore.semaphored
cp -rf /root/snap/semaphore/common /home/semaphore
mv -f /home/semaphore/repositories /tmp/semaphore
sed -i 's/\/root\/snap\/semaphore\/common\/database.boltdb/\/home\/semaphore\/database.boltdb/' /home/semaphore/config.json
sed -i 's/\/root\/snap\/semaphore\/common\/repositories/\/tmp\/semaphore/' /home/semaphore/config.json
adduser --system --group --home /home/semaphore --no-create-home --shell /bin/bash semaphore
cp /etc/skel/.* /home/semaphore/
chown -R semaphore:semaphore /tmp/semaphore
chmod o-rwx /home/semaphore
chown -R semaphore:semaphore /home/semaphore
EOF