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を保持します
sudo su -
または他の有効な方法でroot
としてログインします。- SemaphoreUIのsnapバージョンを停止します。
snap stop semaphore.semaphored
- snapから新しいディレクトリにファイルをコピーします。このディレクトリは、新しいシステムユーザー
semaphore
のホームディレクトリになります。cp -rf /root/snap/semaphore/common /home/semaphore
repositories
フォルダーを新しい一時フォルダーの場所に移動します。mv -f /home/semaphore/repositories /tmp/semaphore
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
/home/semaphore
をホームフォルダーとして持つ新しいシステムユーザーおよびグループsemaphore
を作成します。adduser --system --group --home /home/semaphore --no-create-home --shell /bin/bash semaphore
/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