From f39afb768112925ff71f55b4b903bc39863b79d9 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:35:21 -0600 Subject: [PATCH 01/12] First pass at Linux installer --- install_plugin_linux.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 install_plugin_linux.sh diff --git a/install_plugin_linux.sh b/install_plugin_linux.sh new file mode 100755 index 0000000..0e3b4a3 --- /dev/null +++ b/install_plugin_linux.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +echo "Installing Cloudfuse plugin" + +apt-get install libssl-dev +apt-get install ./cloudfuse*.deb +systemctl stop networkoptix-mediaserver.service +cp cloudfuse_plugin.so /opt/networkoptix/mediaserver/bin/plugins/ +systemctl restart networkoptix-mediaserver.service + +echo "Finished installing Cloudfuse plugin" + From 40c1328aa59561a22b4c4a1f60650911536e61c0 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:17:30 -0600 Subject: [PATCH 02/12] Cleanup install script linux --- install_plugin_linux.sh | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/install_plugin_linux.sh b/install_plugin_linux.sh index 0e3b4a3..dd85e84 100755 --- a/install_plugin_linux.sh +++ b/install_plugin_linux.sh @@ -1,13 +1,34 @@ #!/bin/bash set -e -echo "Installing Cloudfuse plugin" +### Setup Fuse Allow Other +FUSE_CONF="/etc/fuse.conf" + +# Check if "user_allow_other" is already in the file +if grep -q "^user_allow_other" "$FUSE_CONF" +then + echo "user_allow_other is already set in $FUSE_CONF" +else + # Check if "user_allow_other" is in the file but commented out + if grep -q "^#user_allow_other" "$FUSE_CONF" + then + sudo sed -i 's/^#user_allow_other/user_allow_other/' "$FUSE_CONF" + echo "Uncommented user_allow_other in $FUSE_CONF" + else + # If not found, add "user_allow_other" to the file + echo "user_allow_other" | sudo tee -a "$FUSE_CONF" > /dev/null + echo "Added user_allow_other added to $FUSE_CONF" + fi +fi +### Install Cloudfuse +echo "Installing Cloudfuse plugin" apt-get install libssl-dev apt-get install ./cloudfuse*.deb + +### Install plugin systemctl stop networkoptix-mediaserver.service cp cloudfuse_plugin.so /opt/networkoptix/mediaserver/bin/plugins/ -systemctl restart networkoptix-mediaserver.service +systemctl start networkoptix-mediaserver.service echo "Finished installing Cloudfuse plugin" - From 6ddcb36cf3230b99c49a2e3c291b063a4746cbce Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:31:56 -0600 Subject: [PATCH 03/12] Cleanup install scripts. Add windows script --- .github/workflows/release.yml | 5 +++-- install_plugin_linux.sh | 5 ++++- install_plugin_windows.bat | 20 ++++++++++++++++++++ setup_fuse_allow_other.sh | 19 ------------------- 4 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 install_plugin_windows.bat delete mode 100755 setup_fuse_allow_other.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ceea186..8dd5c6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,7 +53,7 @@ jobs: run: | mkdir nx-lyve-cloud-plugin-${{ matrix.os }} mv ../nx-lyve-cloud-plugin-build/cloudfuse_plugin/*.so nx-lyve-cloud-plugin-${{ matrix.os }}/cloudfuse_plugin.so - cp ./setup_fuse_allow_other.sh nx-lyve-cloud-plugin-${{ matrix.os }}/ + cp ./install_plugin_linux.sh nx-lyve-cloud-plugin-${{ matrix.os }}/ zip -r nx-lyve-cloud-plugin-${{ matrix.os }}.zip nx-lyve-cloud-plugin-${{ matrix.os }} - name: Package Artifacts Windows @@ -61,7 +61,8 @@ jobs: if: ${{ Contains(matrix.os, 'windows') }} run: | mkdir nx-lyve-cloud-plugin-windows - mv ..\nx-lyve-cloud-plugin-build\cloudfuse_plugin\Release\cloudfuse_plugin.dll nx-lyve-cloud-plugin-windows/cloudfuse_plugin.dll + mv ..\nx-lyve-cloud-plugin-build\cloudfuse_plugin\Release\cloudfuse_plugin.dll nx-lyve-cloud-plugin-windows\cloudfuse_plugin.dll + cp .\install_plugin_windows.bat nx-lyve-cloud-plugin-windows\ Compress-Archive nx-lyve-cloud-plugin-windows nx-lyve-cloud-plugin-windows.zip - name: Archive production artifacts from Ubuntu diff --git a/install_plugin_linux.sh b/install_plugin_linux.sh index dd85e84..03279e8 100755 --- a/install_plugin_linux.sh +++ b/install_plugin_linux.sh @@ -1,4 +1,6 @@ #!/bin/bash + +## Copyright © 2024 Seagate Technology LLC and/or its Affiliates set -e ### Setup Fuse Allow Other @@ -22,11 +24,12 @@ else fi ### Install Cloudfuse -echo "Installing Cloudfuse plugin" +echo "Installing Cloudfuse" apt-get install libssl-dev apt-get install ./cloudfuse*.deb ### Install plugin +echo "Installing Cloudfuse plugin" systemctl stop networkoptix-mediaserver.service cp cloudfuse_plugin.so /opt/networkoptix/mediaserver/bin/plugins/ systemctl start networkoptix-mediaserver.service diff --git a/install_plugin_windows.bat b/install_plugin_windows.bat new file mode 100644 index 0000000..0811b3b --- /dev/null +++ b/install_plugin_windows.bat @@ -0,0 +1,20 @@ +:: Copyright © 2024 Seagate Technology LLC and/or its Affiliates +@echo off + +set installer=cloudfuse*.exe + +REM Check if the installer file exists +if exist "%installer%" ( + echo "Installing Cloudfuse" + "%installer%" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART +) else ( + echo "Installer file not found" +) + +echo "Installing plugin" + +copy ".\cloudfuse_plugin.dll" "C:\Program Files\Network Optix\Nx Meta\MediaServer\plugins\" + +echo "Finished installing Cloudfuse plugin" + +pause diff --git a/setup_fuse_allow_other.sh b/setup_fuse_allow_other.sh deleted file mode 100755 index cc01f00..0000000 --- a/setup_fuse_allow_other.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -FUSE_CONF="/etc/fuse.conf" - -# Check if "user_allow_other" is already in the file -if grep -q "^user_allow_other" "$FUSE_CONF" -then - echo "user_allow_other is already set in $FUSE_CONF" -else - # Check if "user_allow_other" is in the file but commented out - if grep -q "^#user_allow_other" "$FUSE_CONF" - then - sudo sed -i 's/^#user_allow_other/user_allow_other/' "$FUSE_CONF" - echo "Uncommented user_allow_other in $FUSE_CONF" - else - # If not found, add "user_allow_other" to the file - echo "user_allow_other" | sudo tee -a "$FUSE_CONF" > /dev/null - echo "Added user_allow_other added to $FUSE_CONF" - fi -fi From 8be5c312d0a71e63258ab66f0fd81d18d5ad15cd Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:54:03 -0600 Subject: [PATCH 04/12] Cleanup linux --- install_plugin_linux.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install_plugin_linux.sh b/install_plugin_linux.sh index 03279e8..26a75e2 100755 --- a/install_plugin_linux.sh +++ b/install_plugin_linux.sh @@ -30,8 +30,8 @@ apt-get install ./cloudfuse*.deb ### Install plugin echo "Installing Cloudfuse plugin" -systemctl stop networkoptix-mediaserver.service -cp cloudfuse_plugin.so /opt/networkoptix/mediaserver/bin/plugins/ -systemctl start networkoptix-mediaserver.service +systemctl restart networkoptix-mediaserver.service +cp cloudfuse_plugin.so /opt/networkoptix-metavms/mediaserver/bin/plugins/ +systemctl restart networkoptix-mediaserver.service echo "Finished installing Cloudfuse plugin" From af07519b5998a0df6802c9d16d78c9c2b93fae2b Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:15:59 -0600 Subject: [PATCH 05/12] Bundle release of cloudfuse in zip for installation --- .github/workflows/release.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8dd5c6d..73facb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,12 +48,27 @@ jobs: .\build_samples.bat --no-tests + - name: Download cloudfuse for Windows + if: ${{ Contains(matrix.os, 'windows') }} + shell: pwsh + run: | + $download_url = Invoke-RestMethod -Uri "https://api.github.com/repos/Seagate/cloudfuse/releases/latest" | Select-Object -ExpandProperty assets | Where-Object { $_.name -like "*windows_amd64.exe" } | Select-Object -ExpandProperty browser_download_url + $file_name = $download_url.Split('/')[-1] + Invoke-WebRequest -Uri $download_url -OutFile $file_name + + - name: Download cloudfuse for Linux (no_gui) + if: ${{ Contains(matrix.os, 'ubuntu') }} + run: | + download_url=$(curl -s https://api.github.com/repos/Seagate/cloudfuse/releases/latest | jq -r '.assets[] | select(.name | contains("linux_amd64.deb")) | .browser_download_url') + curl -LO $download_url + - name: Package Artifacts Linux if: ${{ Contains(matrix.os, 'ubuntu') }} run: | mkdir nx-lyve-cloud-plugin-${{ matrix.os }} mv ../nx-lyve-cloud-plugin-build/cloudfuse_plugin/*.so nx-lyve-cloud-plugin-${{ matrix.os }}/cloudfuse_plugin.so - cp ./install_plugin_linux.sh nx-lyve-cloud-plugin-${{ matrix.os }}/ + mv ./install_plugin_linux.sh nx-lyve-cloud-plugin-${{ matrix.os }}/ + mv ./cloudfuse*_linux_amd64.deb nx-lyve-cloud-plugin-${{ matrix.os }}/ zip -r nx-lyve-cloud-plugin-${{ matrix.os }}.zip nx-lyve-cloud-plugin-${{ matrix.os }} - name: Package Artifacts Windows @@ -62,7 +77,8 @@ jobs: run: | mkdir nx-lyve-cloud-plugin-windows mv ..\nx-lyve-cloud-plugin-build\cloudfuse_plugin\Release\cloudfuse_plugin.dll nx-lyve-cloud-plugin-windows\cloudfuse_plugin.dll - cp .\install_plugin_windows.bat nx-lyve-cloud-plugin-windows\ + mv .\install_plugin_windows.bat nx-lyve-cloud-plugin-windows\ + mv .\cloudfuse*_windows_amd64.deb nx-lyve-cloud-plugin-windows\ Compress-Archive nx-lyve-cloud-plugin-windows nx-lyve-cloud-plugin-windows.zip - name: Archive production artifacts from Ubuntu From 98605469f1975f9f68f851270c12a6c855ef13c3 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:10:55 -0600 Subject: [PATCH 06/12] Cleanup windows install --- install_plugin_windows.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install_plugin_windows.bat b/install_plugin_windows.bat index 0811b3b..a3e3019 100644 --- a/install_plugin_windows.bat +++ b/install_plugin_windows.bat @@ -1,7 +1,10 @@ :: Copyright © 2024 Seagate Technology LLC and/or its Affiliates @echo off -set installer=cloudfuse*.exe +for %%I in (cloudfuse*.exe) do ( + set "installer=%%I" + break +) REM Check if the installer file exists if exist "%installer%" ( From 3fed3be535619eca0302e5643ab13bb4db52bee8 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:00:59 -0600 Subject: [PATCH 07/12] Cleanup start/stop for installing plugin --- install_plugin_linux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_plugin_linux.sh b/install_plugin_linux.sh index 26a75e2..b6e4dd9 100755 --- a/install_plugin_linux.sh +++ b/install_plugin_linux.sh @@ -30,8 +30,8 @@ apt-get install ./cloudfuse*.deb ### Install plugin echo "Installing Cloudfuse plugin" -systemctl restart networkoptix-mediaserver.service +systemctl stop networkoptix-mediaserver.service cp cloudfuse_plugin.so /opt/networkoptix-metavms/mediaserver/bin/plugins/ -systemctl restart networkoptix-mediaserver.service +systemctl start networkoptix-mediaserver.service echo "Finished installing Cloudfuse plugin" From f0b80dffdd1e64119e63284b632fd6967416ac55 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:32:16 -0600 Subject: [PATCH 08/12] Cleanup windows install script --- install_plugin_windows.bat | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/install_plugin_windows.bat b/install_plugin_windows.bat index a3e3019..6421460 100644 --- a/install_plugin_windows.bat +++ b/install_plugin_windows.bat @@ -1,23 +1,46 @@ :: Copyright © 2024 Seagate Technology LLC and/or its Affiliates @echo off +:: Find the installer file for %%I in (cloudfuse*.exe) do ( set "installer=%%I" break ) -REM Check if the installer file exists +:: Check if the installer file exists and if so install it if exist "%installer%" ( - echo "Installing Cloudfuse" + echo Installing Cloudfuse "%installer%" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART ) else ( - echo "Installer file not found" + echo Installer file not found + exit /b ) -echo "Installing plugin" +echo Installing plugin +:: Stop the VMS server +set serviceName="metavmsMediaServer" +echo Attempting to stop %serviceName% +sc stop %serviceName% >NUL 2>&1 +echo Service stopped successfully. + +:: Copy the plugin file +echo Attempting to copy the plugin file copy ".\cloudfuse_plugin.dll" "C:\Program Files\Network Optix\Nx Meta\MediaServer\plugins\" +if %errorlevel% neq 0 ( + echo Failed to copy the plugin file + exit /b +) + +:: Restart the VMS +echo Attempting to start %serviceName% +sc start %serviceName% >NUL 2>&1 +if %errorlevel% neq 0 ( + echo Failed to start %serviceName% + exit /b +) -echo "Finished installing Cloudfuse plugin" +echo Service started successfully. +echo Finished installing Cloudfuse plugin pause From 718410dfb2dffbc8fd66671ed35a17eefd54570b Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:38:01 -0600 Subject: [PATCH 09/12] Use restart on linux to start and stop --- install_plugin_linux.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install_plugin_linux.sh b/install_plugin_linux.sh index b6e4dd9..ee3a96c 100755 --- a/install_plugin_linux.sh +++ b/install_plugin_linux.sh @@ -30,8 +30,7 @@ apt-get install ./cloudfuse*.deb ### Install plugin echo "Installing Cloudfuse plugin" -systemctl stop networkoptix-mediaserver.service cp cloudfuse_plugin.so /opt/networkoptix-metavms/mediaserver/bin/plugins/ -systemctl start networkoptix-mediaserver.service +systemctl restart networkoptix-mediaserver.service echo "Finished installing Cloudfuse plugin" From 2d390b2eb12fafdbada6a9f9a7c8d0161413d9a6 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:57:47 -0600 Subject: [PATCH 10/12] Improve error handling for windows script --- install_plugin_windows.bat | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/install_plugin_windows.bat b/install_plugin_windows.bat index 6421460..fc72969 100644 --- a/install_plugin_windows.bat +++ b/install_plugin_windows.bat @@ -27,19 +27,25 @@ echo Service stopped successfully. :: Copy the plugin file echo Attempting to copy the plugin file copy ".\cloudfuse_plugin.dll" "C:\Program Files\Network Optix\Nx Meta\MediaServer\plugins\" -if %errorlevel% neq 0 ( +set copyError=%errorlevel% +if %copyError% neq 0 ( echo Failed to copy the plugin file - exit /b ) :: Restart the VMS echo Attempting to start %serviceName% sc start %serviceName% >NUL 2>&1 if %errorlevel% neq 0 ( - echo Failed to start %serviceName% + echo Installation failed: Unable to restart %serviceName%. It must be restarted manually. + exit /b +) + +if %copyError% neq 0 ( + echo Installation failed: Unable to copy plugin file exit /b ) + echo Service started successfully. echo Finished installing Cloudfuse plugin From 3435f326396ac83a60ad793b8fb527610630b13e Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:59:31 -0600 Subject: [PATCH 11/12] Use net to start and stop service --- install_plugin_windows.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_plugin_windows.bat b/install_plugin_windows.bat index fc72969..696f436 100644 --- a/install_plugin_windows.bat +++ b/install_plugin_windows.bat @@ -21,7 +21,7 @@ echo Installing plugin :: Stop the VMS server set serviceName="metavmsMediaServer" echo Attempting to stop %serviceName% -sc stop %serviceName% >NUL 2>&1 +net stop %serviceName% >NUL 2>&1 echo Service stopped successfully. :: Copy the plugin file @@ -34,7 +34,7 @@ if %copyError% neq 0 ( :: Restart the VMS echo Attempting to start %serviceName% -sc start %serviceName% >NUL 2>&1 +net start %serviceName% >NUL 2>&1 if %errorlevel% neq 0 ( echo Installation failed: Unable to restart %serviceName%. It must be restarted manually. exit /b From e0d48fa2743ea4e2a2ee08ab7eae95e74aea2193 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 7 Aug 2024 15:02:44 -0600 Subject: [PATCH 12/12] Use cloudfuse no_gui option --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e78ed8..b31966d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,20 +48,20 @@ jobs: if: ${{ Contains(matrix.os, 'windows') }} shell: pwsh run: | - $download_url = Invoke-RestMethod -Uri "https://api.github.com/repos/Seagate/cloudfuse/releases/latest" | Select-Object -ExpandProperty assets | Where-Object { $_.name -like "*windows_amd64.exe" } | Select-Object -ExpandProperty browser_download_url + $download_url = Invoke-RestMethod -Uri "https://api.github.com/repos/Seagate/cloudfuse/releases/latest" | Select-Object -ExpandProperty assets | Where-Object { $_.name -like "*no_gui_windows_amd64.exe" } | Select-Object -ExpandProperty browser_download_url $file_name = $download_url.Split('/')[-1] Invoke-WebRequest -Uri $download_url -OutFile $file_name - name: Download cloudfuse for Linux amd64 (no_gui) if: ${{ Contains(matrix.os, 'ubuntu') }} run: | - download_url=$(curl -s https://api.github.com/repos/Seagate/cloudfuse/releases/latest | jq -r '.assets[] | select(.name | contains("linux_amd64.deb")) | .browser_download_url') + download_url=$(curl -s https://api.github.com/repos/Seagate/cloudfuse/releases/latest | jq -r '.assets[] | select(.name | contains("no_gui_linux_amd64.deb")) | .browser_download_url') curl -LO $download_url - name: Download cloudfuse for Linux arm64 (no_gui) if: ${{ Contains(matrix.os, 'ubuntu') }} run: | - download_url=$(curl -s https://api.github.com/repos/Seagate/cloudfuse/releases/latest | jq -r '.assets[] | select(.name | contains("linux_arm64.deb")) | .browser_download_url') + download_url=$(curl -s https://api.github.com/repos/Seagate/cloudfuse/releases/latest | jq -r '.assets[] | select(.name | contains("no_gui_linux_arm64.deb")) | .browser_download_url') curl -LO $download_url - name: Run build script for Linux x64