Skip to content

Commit

Permalink
Create installer (#37)
Browse files Browse the repository at this point in the history
* First pass at Linux installer

* Cleanup install script linux

* Cleanup install scripts. Add windows script

* Cleanup linux

* Bundle release of cloudfuse in zip for installation

* Cleanup windows install

* Cleanup start/stop for installing plugin

* Cleanup windows install script

* Use restart on linux to start and stop

* Improve error handling for windows script

* Use net to start and stop service

* Use cloudfuse no_gui option
  • Loading branch information
jfantinhardesty authored Aug 7, 2024
1 parent af11885 commit 388c34d
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 1 deletion.
28 changes: 27 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ jobs:
with:
# The vcpkg.json file, which will be part of cache key computation.
vcpkgJsonGlob: '**/src/vcpkg.json'

- 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 "*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("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("no_gui_linux_arm64.deb")) | .browser_download_url')
curl -LO $download_url
- name: Run build script for Linux x64
if: ${{ Contains(matrix.os, 'ubuntu') }}
Expand All @@ -56,6 +76,8 @@ jobs:
run: |
mkdir nx-lyve-cloud-plugin-${{ matrix.os }}_x64
mv ../nx-lyve-cloud-plugin-build/cloudfuse_plugin/*.so nx-lyve-cloud-plugin-${{ matrix.os }}_x64/cloudfuse_plugin.so
mv ./cloudfuse*_linux_amd64.deb nx-lyve-cloud-plugin-${{ matrix.os }}/
cp ./install_plugin_linux.sh nx-lyve-cloud-plugin-${{ matrix.os }}_x64/
cp ./setup_fuse_allow_other.sh nx-lyve-cloud-plugin-${{ matrix.os }}_x64/
zip -r nx-lyve-cloud-plugin-${{ matrix.os }}_x64.zip nx-lyve-cloud-plugin-${{ matrix.os }}_x64
Expand All @@ -76,6 +98,8 @@ jobs:
run: |
mkdir nx-lyve-cloud-plugin-${{ matrix.os }}_arm64
mv ../nx-lyve-cloud-plugin-build/cloudfuse_plugin/*.so nx-lyve-cloud-plugin-${{ matrix.os }}_arm64/cloudfuse_plugin.so
mv ./cloudfuse*_linux_arm64.deb nx-lyve-cloud-plugin-${{ matrix.os }}/
cp ./install_plugin_linux.sh nx-lyve-cloud-plugin-${{ matrix.os }}_arm64/
cp ./setup_fuse_allow_other.sh nx-lyve-cloud-plugin-${{ matrix.os }}_arm64/
zip -r nx-lyve-cloud-plugin-${{ matrix.os }}_arm64.zip nx-lyve-cloud-plugin-${{ matrix.os }}_arm64
Expand All @@ -91,7 +115,9 @@ 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
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 x64
Expand Down
17 changes: 17 additions & 0 deletions setup_fuse_allow_other.sh → install_plugin_linux.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

## Copyright © 2024 Seagate Technology LLC and/or its Affiliates
set -e

### Setup Fuse Allow Other
FUSE_CONF="/etc/fuse.conf"

# Check if "user_allow_other" is already in the file
Expand All @@ -17,3 +22,15 @@ else
echo "Added user_allow_other added to $FUSE_CONF"
fi
fi

### Install Cloudfuse
echo "Installing Cloudfuse"
apt-get install libssl-dev
apt-get install ./cloudfuse*.deb

### Install plugin
echo "Installing Cloudfuse plugin"
cp cloudfuse_plugin.so /opt/networkoptix-metavms/mediaserver/bin/plugins/
systemctl restart networkoptix-mediaserver.service

echo "Finished installing Cloudfuse plugin"
52 changes: 52 additions & 0 deletions install_plugin_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
:: 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
)

:: Check if the installer file exists and if so install it
if exist "%installer%" (
echo Installing Cloudfuse
"%installer%" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART
) else (
echo Installer file not found
exit /b
)

echo Installing plugin

:: Stop the VMS server
set serviceName="metavmsMediaServer"
echo Attempting to stop %serviceName%
net 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\"
set copyError=%errorlevel%
if %copyError% neq 0 (
echo Failed to copy the plugin file
)

:: Restart the VMS
echo Attempting to start %serviceName%
net start %serviceName% >NUL 2>&1
if %errorlevel% neq 0 (
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

pause

0 comments on commit 388c34d

Please sign in to comment.