Skip to content

Commit

Permalink
Pull in new datasources and upgrade dependencies (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisStrykesAgain authored Feb 7, 2024
1 parent c894eda commit 97bf7ef
Show file tree
Hide file tree
Showing 32 changed files with 44,977 additions and 98,631 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Create .npmrc
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "systemlink-grafana-plugins"]
path = systemlink-grafana-plugins
url = https://github.com/ni/systemlink-grafana-plugins.git
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# grafana-plugins
Grafana plugins for SystemLink

## Configuring SystemLink to host Grafana
## Configuring SystemLink Server to host Grafana for the first time
To configure a SystemLink instance to host Grafana, this repo provides a PowerShell script `Setup-Grafana.ps1` that automatically installs Grafana to the machine, copies over the necessary configuration to show Grafana as a plugin within SystemLink, and installs the latest release of the plugins sourced here.

To run the script, [download the latest release](https://github.com/ni/grafana-plugins/releases) from GitHub to the machine where SystemLink is installed, and then execute `Setup-Grafana.ps1` by right-clicking > "Run With PowerShell" or by running it from the PowerShell console. If the script immediately closes without executing, you may need to configure your [Execution Policy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies).
Expand All @@ -10,6 +10,15 @@ Caveats:
- This setup assumes a standard install of SystemLink and Grafana. If you have custom paths, you may need to modify the variables at the start of the script.
- Grafana v8.3.6 will be installed by default. If you need a different Grafana version, manually install it before running the script.

## Updating an existing Grafana installation on a SystemLink Server instance
*Note: If you have installed any custom datasources or altered config files, the changes may be overwritten. In that scenario, you should review the install powershell script and manually work through it as appropriate.*

To update an existing install, first upgrade Grafana by downloading and running the following MSI: https://dl.grafana.com/oss/release/grafana-10.2.2.windows-amd64.msi

Following that, execute the powershell script in the release archive.

To run the script, download the latest release from GitHub to the machine where SystemLink is installed, extract it, and then execute `Setup-Grafana.ps1` by right-clicking > "Run With PowerShell" or by running it from the PowerShell console.
=======
### Troubleshooting

#### Grafana UI shows `Error: Fetch error: 404 Not Found Instantiating` when loading a plugin
Expand Down
2 changes: 1 addition & 1 deletion Setup-Grafana.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent
$IsInstalled = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).displayname -contains "GrafanaOSS"
if (-Not $IsInstalled) {
Write-Output 'Grafana not found - downloading installer'
Start-BitsTransfer -Source 'https://dl.grafana.com/oss/release/grafana-8.3.6.windows-amd64.msi' -Destination 'grafana.msi'
Start-BitsTransfer -Source 'https://dl.grafana.com/oss/release/grafana-10.2.2.windows-amd64.msi' -Destination 'grafana.msi'
Write-Output "Installing GrafanaOSS..."
Start-Process msiexec.exe -Wait -ArgumentList '/I grafana.msi /qr'
Remove-Item './grafana.msi'
Expand Down
38 changes: 30 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
#!/usr/bin/env bash
set -e

external_datasources=("workspace" "system" "tag")
external_panels=("plotly")
local_plugins=("systemlink-test-monitor-datasource" "systemlink-notebook-datasource")

rm -rf build
mkdir -p build/{plugins,config,examples}
mkdir -p systemlink-grafana-plugins/dist

cd systemlink-grafana-plugins

npm ci
npm run build

for n in ${external_datasources[@]};
do
cp -r dist/datasources/${n} ../build/plugins/${n}
done

for p in ${external_panels[@]};
do
cp -r dist/panels/${p} ../build/plugins/${p}
done

cd ..

for d in ./*/; do
cd $d
if test -f package.json; then
echo $(pwd)
npm ci
npm run build
cp -r dist ../build/plugins/${d}
fi
for d in ${local_plugins[@]};
do
cd ${d}
echo $(pwd)
npm ci
npm run build
cp -r dist ../build/plugins/${d}

cd ..
done

Expand Down
2 changes: 1 addition & 1 deletion config/custom.ini
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ auto_sign_up = true
;enable_alpha = false
;app_tls_skip_verify_insecure = false
# Enter a comma-separated list of plugin identifiers to identify plugins that are allowed to be loaded even if they lack a valid signature.
allow_loading_unsigned_plugins = systemlink-notebook-datasource, ni-systemlink-test-monitor, ni-plotly-panel
allow_loading_unsigned_plugins = ni-slsystem-datasource,ni-sltag-datasource,ni-slworkspace-datasource,ni-plotly-panel,systemlink-notebook-datasource,ni-systemlink-test-monitor
;marketplace_url = https://grafana.com/grafana/plugins/

#################################### Grafana Image Renderer Plugin ##########################
Expand Down
33 changes: 23 additions & 10 deletions config/datasources.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
apiVersion: 1

datasources:
- name: SystemLink Notebooks
type: systemlink-notebook-datasource
access: direct
url: /
version: 1
- name: SystemLink Test Monitor
type: ni-systemlink-test-monitor
access: direct
url: /
version: 1
- name: SystemLink Notebooks
type: systemlink-notebook-datasource
access: direct
url: /
- name: SystemLink Systems
type: ni-slsystem-datasource
uid: system
access: direct
url: /
- name: SystemLink Tags
type: ni-sltag-datasource
uid: tag
access: direct
url: /
- name: SystemLink Workspaces
type: ni-slworkspace-datasource
uid: workspace
access: direct
url: /
- name: SystemLink Test Monitor
type: ni-systemlink-test-monitor
access: direct
url: /
16 changes: 0 additions & 16 deletions plotly-panel/.editorconfig

This file was deleted.

29 changes: 0 additions & 29 deletions plotly-panel/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions plotly-panel/.prettierrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions plotly-panel/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit 97bf7ef

Please sign in to comment.