Skip to content

Commit

Permalink
Bundle the react dashboard code into the agent repo directly. (netdat…
Browse files Browse the repository at this point in the history
…a#11139)

* Remove code for bundling the dashoard on install.

* Bundle the dashboard code directly into the agent repo.

This diffstat looks huge, but it’s actually relatively simple. The only
_actual_ changes are in the Makefiles, `configure.ac`, and the addition of
`generate_dashboard_makefile.py`. Everything else consists of removing
files that are included in the dashboard tarball, and extracting the
contents of the tarball into `web/gui/dashboard`.

* CI cleanup.

* Automate bundling of the dashboard code.

This replaces the makefile generator script with one that handles
bundling of the dashboard code in it’s entirety, and updates the GHA
workflow used for generating dashboard PRs to use that instead of the
existing shell commands.

It also removes the packaging/dashboard.* files, as they are no longer
needed.
  • Loading branch information
Ferroin authored May 14, 2021
1 parent 48dd96c commit 9574cb4
Show file tree
Hide file tree
Showing 177 changed files with 4,787 additions and 1,707 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/*{.,-}min.js
web/gui/dashboard/*
22 changes: 0 additions & 22 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,6 @@ jobs:
LOCAL_ONLY: "true"
run: |
./tests/installer/checksums.sh
dashboard-checks:
name: Dashboard
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install required packages
run: |
./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
- name: Backup dashboard.js
run: |
cp web/gui/dashboard.js /tmp/dashboard.js
- name: Regenerate dashboard.js
run: |
autoreconf -ivf
./configure --enable-maintainer-mode
make dist
- name: Compare generated Dashboard vs. Backed up Dashboard
run: |
diff -sNrdu /tmp/dashboard.js web/gui/dashboard.js
libressl-checks:
name: LibreSSL
runs-on: ubuntu-latest
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/dashboard-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ jobs:
git push -u origin dashboard-${{ github.event.inputs.dashboard_version }}
- name: Update Files
run: |
curl -o dashboard.tar.gz https://github.com/netdata/dashboard/releases/download/${{ github.event.inputs.dashboard_version }}/dashboard.tar.gz
echo ${{ github.event.inputs.dashboard_version }} > packaging/dashboard.version
sha256sum dashboard.tar.gz > packaging/dashboard.checksums
rm dashboard.tar.gz
web/gui/bundle_dashboard.py ${{ github.event.inputs.dashboard_version }}
- name: Commit Changes
uses: swinton/[email protected]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
with:
files: |
packaging/dashboard.version
Expand All @@ -47,4 +44,4 @@ jobs:
source_branch: dashboard-${{ github.event.inputs.dashboard_version }}
pr_title: 'Update dashboard to version ${{ github.event.inputs.dashboard_version }}.'
pr_body: 'See https://github.com/netdata/dashboard/releases/tag/${{ github.event.inputs.dashboard_version }} for changes.'
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ TODO.txt

web/gui/chart-info/
web/gui/control.html
web/gui/dashboard.js
web/gui/datasource.css
web/gui/gadget.xml
web/gui/index_new.html
Expand Down
3 changes: 0 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,12 @@ dist_noinst_DATA = \
netdata.cppcheck \
netdata.spec \
package.json \
packaging/bundle-dashboard.sh \
packaging/bundle-ebpf.sh \
packaging/bundle-judy.sh \
packaging/bundle-libbpf.sh \
packaging/bundle-lws.sh \
packaging/bundle-mosquitto.sh \
packaging/check-kernel-config.sh \
packaging/dashboard.checksums \
packaging/dashboard.version \
packaging/ebpf.checksums \
packaging/ebpf.version \
packaging/go.d.checksums \
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,7 @@ AC_CONFIG_FILES([
web/api/queries/sum/Makefile
web/api/health/Makefile
web/gui/Makefile
web/gui/dashboard/Makefile
web/server/Makefile
web/server/static/Makefile
claim/Makefile
Expand Down
1 change: 0 additions & 1 deletion contrib/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ override_dh_install:

# Move files that local user shouldn't be editing to /usr/share/netdata
#
packaging/bundle-dashboard.sh . ${TOP}/var/lib/netdata/www
mkdir -p "$(TOP)/usr/share/netdata/www"
for D in $$(find "$(TOP)/var/lib/netdata/www/" -maxdepth 1 -type d -printf '%f '); do \
echo Relocating $$D; \
Expand Down
34 changes: 0 additions & 34 deletions netdata-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1362,40 +1362,6 @@ fi

# -----------------------------------------------------------------------------

copy_react_dashboard() {
run cp -a $(find ${1} -mindepth 1 -maxdepth 1) "${NETDATA_WEB_DIR}"
run chown -R "${NETDATA_WEB_USER}:${NETDATA_WEB_GROUP}" "${NETDATA_WEB_DIR}"
}

install_react_dashboard() {
progress "Fetching and installing dashboard"

DASHBOARD_PACKAGE_VERSION="$(cat packaging/dashboard.version)"

tmp="$(mktemp -d -t netdata-dashboard-XXXXXX)"
DASHBOARD_PACKAGE_BASENAME="dashboard.tar.gz"

if fetch_and_verify "dashboard" \
"https://github.com/netdata/dashboard/releases/download/${DASHBOARD_PACKAGE_VERSION}/${DASHBOARD_PACKAGE_BASENAME}" \
"${DASHBOARD_PACKAGE_BASENAME}" \
"${tmp}" \
"${NETDATA_LOCAL_TARBALL_OVERRIDE_DASHBOARD}"; then
if run tar -xf "${tmp}/${DASHBOARD_PACKAGE_BASENAME}" -C "${tmp}" &&
copy_react_dashboard "${tmp}/build" &&
rm -rf "${tmp}"; then
run_ok "React dashboard installed."
else
run_failed "Failed to install React dashboard. The install process will continue, but you will not be able to use the new dashboard."
fi
else
run_failed "Unable to fetch React dashboard. The install process will continue, but you will not be able to use the new dashboard."
fi
}

install_react_dashboard

# -----------------------------------------------------------------------------

# govercomp compares go.d.plugin versions. Exit codes:
# 0 - version1 == version2
# 1 - version1 > version2
Expand Down
1 change: 0 additions & 1 deletion netdata.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ install_go() {
install_go
install -m 0640 -p go.d.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/go.d.plugin"

${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-dashboard.sh ${RPM_BUILD_DIR}/%{name}-%{version} ${RPM_BUILD_ROOT}%{_datadir}/%{name}/web
%if 0%{?have_bpf}
${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-ebpf.sh ${RPM_BUILD_DIR}/%{name}-%{version} ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d
%endif
Expand Down
14 changes: 0 additions & 14 deletions packaging/bundle-dashboard.sh

This file was deleted.

1 change: 0 additions & 1 deletion packaging/dashboard.checksums

This file was deleted.

1 change: 0 additions & 1 deletion packaging/dashboard.version

This file was deleted.

7 changes: 7 additions & 0 deletions web/gui/.dashboard-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Do not edit any files in this directory!

If you spot any errors or bugs in these files and wish to fix them, please submit your changes at
https://github.com/netdata/dashboard instead.

These files are copied from the most recent release of that repository, and any changes you make here will be
overwritten the next time there’s a new release there.
99 changes: 5 additions & 94 deletions web/gui/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
# Copyright (C) 2015 Alon Bar-Lev <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later
#
AUTOMAKE_OPTIONS = subdir-objects
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
CLEANFILES = \
version.txt \
$(NULL)

SUBDIRS = \
dashboard \
$(NULL)

DASHBOARD_JS_FILES = \
src/dashboard.js/prologue.js.inc \
src/dashboard.js/utils.js \
Expand Down Expand Up @@ -46,27 +51,11 @@ dist_noinst_DATA = \
$(NULL)

dist_web_DATA = \
demo.html \
demo2.html \
demosites.html \
demosites2.html \
dashboard.html \
dashboard.js \
dashboard_info.js \
dashboard_info_custom_example.js \
dashboard.css \
dashboard.slate.css \
favicon.ico \
goto-host-from-alarm.html \
index.html \
main.css \
main.js \
console.html \
infographic.html \
robots.txt \
refresh-badges.js \
sitemap.xml \
tv.html \
version.txt \
$(NULL)

Expand All @@ -80,90 +69,12 @@ dist_webstatic_DATA = \
static/img/netdata-logomark.svg \
$(NULL)

weblibdir=$(webdir)/lib
dist_weblib_DATA = \
lib/bootstrap-3.3.7.min.js \
lib/bootstrap-slider-10.0.0.min.js \
lib/bootstrap-table-1.11.0.min.js \
lib/bootstrap-table-export-1.11.0.min.js \
lib/bootstrap-toggle-2.2.2.min.js \
lib/clipboard-polyfill-be05dad.js \
lib/d3-4.12.2.min.js \
lib/d3pie-0.2.1-netdata-3.js \
lib/dygraph-c91c859.min.js \
lib/dygraph-smooth-plotter-c91c859.js \
lib/fontawesome-all-5.0.1.min.js \
lib/gauge-1.3.2.min.js \
lib/jquery-2.2.4.min.js \
lib/jquery.easypiechart-97b5824.min.js \
lib/jquery.peity-3.2.0.min.js \
lib/jquery.sparkline-2.1.2.min.js \
lib/lz-string-1.4.4.min.js \
lib/pako-1.0.6.min.js \
lib/perfect-scrollbar-0.6.15.min.js \
lib/tableExport-1.6.0.min.js \
$(NULL)

webcssdir=$(webdir)/css
dist_webcss_DATA = \
css/morris-0.5.1.css \
css/bootstrap-3.3.7.css \
css/bootstrap-theme-3.3.7.min.css \
css/bootstrap-slate-flat-3.3.7.css \
css/bootstrap-slider-10.0.0.min.css \
css/bootstrap-toggle-2.2.2.min.css \
css/c3-0.4.18.min.css \
$(NULL)

webfontsdir=$(webdir)/fonts
dist_webfonts_DATA = \
fonts/glyphicons-halflings-regular.eot \
fonts/glyphicons-halflings-regular.svg \
fonts/glyphicons-halflings-regular.ttf \
fonts/glyphicons-halflings-regular.woff \
fonts/glyphicons-halflings-regular.woff2 \
$(NULL)

webimagesdir=$(webdir)/images
dist_webimages_DATA = \
images/netdata-logomark.svg \
images/alert-128-orange.png \
images/alert-128-red.png \
images/alert-multi-size-orange.ico \
images/alert-multi-size-red.ico \
images/animated.gif \
images/check-mark-2-128-green.png \
images/check-mark-2-multi-size-green.ico \
images/netdata.svg \
images/post.png \
images/android-icon-36x36.png \
images/android-icon-48x48.png \
images/android-icon-72x72.png \
images/android-icon-96x96.png \
images/android-icon-144x144.png \
images/android-icon-192x192.png \
images/apple-icon-57x57.png \
images/apple-icon-60x60.png \
images/apple-icon-72x72.png \
images/apple-icon-76x76.png \
images/apple-icon-114x114.png \
images/apple-icon-120x120.png \
images/apple-icon-144x144.png \
images/apple-icon-152x152.png \
images/apple-icon-180x180.png \
images/apple-icon-precomposed.png \
images/apple-icon.png \
images/favicon-16x16.png \
images/favicon-32x32.png \
images/favicon-96x96.png \
images/favicon.ico \
images/ms-icon-70x70.png \
images/ms-icon-144x144.png \
images/ms-icon-150x150.png \
images/ms-icon-310x310.png \
images/banner-icon-144x144.png \
$(NULL)

dashboard.js: $(DASHBOARD_JS_FILES)
if test -f $@; then rm -f $@; fi
cat $(DASHBOARD_JS_FILES) > $@.tmp && mv $@.tmp $@
Expand Down
Loading

0 comments on commit 9574cb4

Please sign in to comment.