@cryptotaxi247 / netdata-1 / commits / 0f4bd87af

Kickstart improved messaging (#12577)

* Add relevant links to kickstart script. * General installer mesaging updates. * Further assorted fixes and messaging improvements. * Added support link banners to most exit conditions. * Add extra info in output for unexpected exits. * Add a message pointing users at Netdata Cloud on success when not claiming.

Austin S. Hemmelgarn committed Apr 6, 2022 at 07:07 UTC 0f4bd87af901af6038d2a5ff960dbcb44ac6159a
1 file changed +89 -37
packaging/installer/kickstart.sh
+89 -37
@@ -5,9 +5,16 @@
5 # ======================================================================
6 # Constants
7
8 +AGENT_BUG_REPORT_URL="https://github.com/netdata/netdata/issues/new/choose"
9 +CLOUD_BUG_REPORT_URL="https://github.com/netdata/netdata-cloud/issues/new/choose"
10 +DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions"
11 +DISCORD_INVITE="https://discord.gg/5ygS846fR6"
12 +DOCS_URL="https://learn.netdata.cloud/docs/"
13 +FORUM_URL="https://community.netdata.cloud/"
14 KICKSTART_OPTIONS="${*}"
15 PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
16 PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
17 +PUBLIC_CLOUD_URL="https://app.netdata.cloud"
18 REPOCONFIG_URL_PREFIX="https://packagecloud.io/netdata/netdata-repoconfig/packages"
19 REPOCONFIG_VERSION="1-1"
20 TELEMETRY_URL="https://posthog.netdata.cloud/capture/"
@@ -22,7 +29,7 @@ INSTALL_TYPE="unknown"
29 INSTALL_PREFIX=""
30 NETDATA_AUTO_UPDATES="1"
31 NETDATA_CLAIM_ONLY=0
25 -NETDATA_CLAIM_URL="https://app.netdata.cloud"
32 +NETDATA_CLAIM_URL="${PUBLIC_CLOUD_URL}"
33 NETDATA_DISABLE_CLOUD=0
34 NETDATA_ONLY_BUILD=0
35 NETDATA_ONLY_NATIVE=0
@@ -198,6 +205,17 @@ trap_handler() {
205
206 printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ERROR ${TPUT_RESET} Installer exited unexpectedly (${code}-${lineno})"
207
208 + case "${code}" in
209 + 0)
210 + printf >&2 "%s\n" "This is almost certainly the result of a bug. If you have time, please report it at ${AGENT_BUG_REPORT_URL}."
211 + ;;
212 + *)
213 + printf >&2 "%s\n" "This is probably a result of a transient issue on your system. Things should work correctly if you try again."
214 + printf >&2 "%s\n" "If you continue to experience this issue, you can reacn out to us for support on:"
215 + support_list
216 + ;;
217 + esac
218 +
219 telemetry_event INSTALL_CRASH "Installer exited unexpectedly (${code}-${lineno})" "E${code}-${lineno}"
220
221 trap - EXIT
@@ -245,6 +263,23 @@ setup_terminal() {
263 return 0
264 }
265
266 +support_list() {
267 + printf >&2 "%s\n" " - GitHub: ${DISCUSSIONS_URL}"
268 + printf >&2 "%s\n" " - Discord: ${DISCORD_INVITE}"
269 + printf >&2 "%s\n" " - Our community forums: ${FORUM_URL}"
270 +}
271 +
272 +success_banner() {
273 + printf >&2 "%s\n\n" "Official documentation can be found online at ${DOCS_URL}."
274 +
275 + if [ -z "${CLAIM_TOKEN}" ]; then
276 + printf >&2 "%s\n\n" "Looking to monitor all of your infrastructure with Netdata? Check out Netdata Cloud at ${PUBLIC_CLOUD_URL}."
277 + fi
278 +
279 + printf >&2 "%s\n" "Join our community and connect with us on:"
280 + support_list
281 +}
282 +
283 cleanup() {
284 if [ -z "${NO_CLEANUP}" ]; then
285 ${ROOTCMD} rm -rf "${tmpdir}"
@@ -253,6 +288,8 @@ cleanup() {
288
289 fatal() {
290 printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${1}"
291 + printf >&2 "%s\n" "For community support, you can connect with us on:"
292 + support_list
293 telemetry_event "INSTALL_FAILED" "${1}" "${2}"
294 cleanup
295 trap - EXIT
@@ -582,7 +619,9 @@ uninstall() {
619 return 0
620 else
621 progress "Found existing netdata-uninstaller. Running it.."
585 - run ${ROOTCMD} "${uninstaller}" $FLAGS
622 + if ! run ${ROOTCMD} "${uninstaller}" $FLAGS; then
623 + warning "Uninstaller failed. Some parts of Netdata may still be present on the system."
624 + fi
625 fi
626 else
627 if [ "${DRY_RUN}" -eq 1 ]; then
@@ -593,7 +632,9 @@ uninstall() {
632 progress "Downloading netdata-uninstaller ..."
633 download "${uninstaller_url}" "${tmpdir}/netdata-uninstaller.sh"
634 chmod +x "${tmpdir}/netdata-uninstaller.sh"
596 - run ${ROOTCMD} "${tmpdir}/netdata-uninstaller.sh" $FLAGS
635 + if ! run ${ROOTCMD} "${tmpdir}/netdata-uninstaller.sh" $FLAGS; then
636 + warning "Uninstaller failed. Some parts of Netdata may still be present on the system."
637 + fi
638 fi
639 fi
640 }
@@ -702,7 +743,9 @@ handle_existing_install() {
743
744 if [ "${NETDATA_CLAIM_ONLY}" -eq 0 ]; then
745 if ! update; then
705 - warning "Unable to find usable updater script, not updating existing install at ${ndprefix}."
746 + warning "Failed to update existing Netdata install at ${ndprefix}."
747 + else
748 + progress "Successfully updated existing netdata install at ${ndprefix}."
749 fi
750 else
751 warning "Not updating existing install at ${ndprefix}."
@@ -719,12 +762,13 @@ handle_existing_install() {
762 progress "Not attempting to claim existing install at ${ndprefix} (no claiming token provided)."
763 fi
764
765 + success_banner
766 cleanup
767 trap - EXIT
768 exit $ret
769 ;;
770 oci)
727 - fatal "This is an OCI container, use the regular image lifecycle management commands in your container instead of this script for managing it." F0203
771 + fatal "This is an OCI container, use the regular container lifecycle management commands for your container tools instead of this script for managing it." F0203
772 ;;
773 *)
774 if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
@@ -914,6 +958,8 @@ claim() {
958 esac
959
960 if [ -z "${NETDATA_NEW_INSTALL}" ]; then
961 + printf >&2 "%s\n" "For community support, you can connect with us on:"
962 + support_list
963 cleanup
964 trap - EXIT
965 exit 1
@@ -1019,7 +1065,7 @@ check_special_native_deps() {
1065 try_package_install() {
1066 if [ -z "${DISTRO}" ] || [ "${DISTRO}" = "unknown" ]; then
1067 warning "Unable to determine Linux distribution for native packages."
1022 - return 1
1068 + return 2
1069 fi
1070
1071 if [ "${DRY_RUN}" -eq 1 ]; then
@@ -1167,7 +1213,7 @@ try_package_install() {
1213 if [ -n "${repo_subcmd}" ]; then
1214 # shellcheck disable=SC2086
1215 if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then
1170 - fatal "Failed to update repository metadata." F0205
1216 + fatal "Failed to refresh repository metadata." F0205
1217 fi
1218 fi
1219 else
@@ -1306,31 +1352,29 @@ install_local_build_dependencies() {
1352 return 1
1353 fi
1354
1309 - download "${PACKAGES_SCRIPT}" "${tmpdir}/install-required-packages.sh"
1355 + if ! download "${PACKAGES_SCRIPT}" "${tmpdir}/install-required-packages.sh"; then
1356 + fatal "Failed to download dependency handling script for local build." F000D
1357 + fi
1358
1311 - if [ ! -s "${tmpdir}/install-required-packages.sh" ] && [ "${DRY_RUN}" -ne 1 ]; then
1312 - warning "Downloaded dependency installation script is empty."
1359 + if [ "${DRY_RUN}" -eq 1 ]; then
1360 + progress "Would run downloaded script to install required build dependencies..."
1361 else
1314 - if [ "${DRY_RUN}" -eq 1 ]; then
1315 - progress "Would run downloaded script to install required build dependencies..."
1316 - else
1317 - progress "Running downloaded script to install required build dependencies..."
1318 - fi
1362 + progress "Running downloaded script to install required build dependencies..."
1363 + fi
1364
1320 - if [ "${INTERACTIVE}" -eq 0 ]; then
1321 - opts="--dont-wait --non-interactive"
1322 - fi
1365 + if [ "${INTERACTIVE}" -eq 0 ]; then
1366 + opts="--dont-wait --non-interactive"
1367 + fi
1368
1324 - if [ "${SYSTYPE}" = "Darwin" ]; then
1325 - sudo=""
1326 - else
1327 - sudo="${ROOTCMD}"
1328 - fi
1369 + if [ "${SYSTYPE}" = "Darwin" ]; then
1370 + sudo=""
1371 + else
1372 + sudo="${ROOTCMD}"
1373 + fi
1374
1330 - # shellcheck disable=SC2086
1331 - if ! run ${sudo} "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then
1332 - warning "It failed to install all the required packages, but installation might still be possible."
1333 - fi
1375 + # shellcheck disable=SC2086
1376 + if ! run ${sudo} "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then
1377 + warning "Failed to install all required packages, but installation might still be possible."
1378 fi
1379 }
1380
@@ -1368,10 +1412,10 @@ build_and_install() {
1412
1413 case $? in
1414 1)
1371 - fatal "netdata-installer.sh exited with error" F0007
1415 + fatal "netdata-installer.sh failed to run correctly." F0007
1416 ;;
1417 2)
1374 - fatal "Insufficient RAM to install netdata" F0008
1418 + fatal "Insufficient RAM to install netdata." F0008
1419 ;;
1420 esac
1421 }
@@ -1389,8 +1433,13 @@ try_build_install() {
1433
1434 set_source_archive_urls "${RELEASE_CHANNEL}"
1435
1392 - download "${NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"
1393 - download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-latest.tar.gz"
1436 + if ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-latest.tar.gz"; then
1437 + fatal "Failed to download source tarball for local build." F000B
1438 + fi
1439 +
1440 + if ! download "${NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"; then
1441 + fatal "Failed to download checksums for source tarball verification." F000C
1442 + fi
1443
1444 if [ "${DRY_RUN}" -eq 1 ]; then
1445 progress "Would validate SHA256 checksum of downloaded source archive."
@@ -1403,7 +1452,7 @@ try_build_install() {
1452 run tar -xf "${tmpdir}/netdata-latest.tar.gz" -C "${tmpdir}"
1453 rm -rf "${tmpdir}/netdata-latest.tar.gz" > /dev/null 2>&1
1454 if [ "${DRY_RUN}" -ne 1 ]; then
1406 - cd "$(find "${tmpdir}" -mindepth 1 -maxdepth 1 -type d -name netdata-)" || fatal "Cannot cd to netdata source tree" F0006
1455 + cd "$(find "${tmpdir}" -mindepth 1 -maxdepth 1 -type d -name netdata-)" || fatal "Cannot change directory to netdata source tree" F0006
1456 fi
1457
1458 if [ -x netdata-installer.sh ] || [ "${DRY_RUN}" -eq 1 ]; then
@@ -1413,7 +1462,7 @@ try_build_install() {
1462 if [ "$(find . -mindepth 1 -maxdepth 1 -type d | wc -l)" -eq 1 ] && [ -x "$(find . -mindepth 1 -maxdepth 1 -type d)/netdata-installer.sh" ]; then
1463 cd "$(find . -mindepth 1 -maxdepth 1 -type d)" && build_and_install || return 1
1464 else
1416 - fatal "Cannot install netdata from source (the source directory does not include netdata-installer.sh). Leaving all files in ${tmpdir}" F0009
1465 + fatal "Cannot install netdata from source (the source directory does not include netdata-installer.sh)." F0009
1466 fi
1467 fi
1468 }
@@ -1641,17 +1690,18 @@ confirm_root_support
1690 get_system_info
1691 confirm_install_prefix
1692
1693 +tmpdir="$(create_tmp_directory)"
1694 +progress "Using ${tmpdir} as a temporary directory."
1695 +cd "${tmpdir}" || fatal "Failed to change current working directory to ${tmpdir}." F000A
1696 +
1697 if [ "${ACTION}" = "uninstall" ]; then
1698 uninstall
1699 + printf >&2 "Finished uninstalling the Netdata Agent."
1700 cleanup
1701 trap - EXIT
1702 exit 0
1703 fi
1704
1651 -tmpdir="$(create_tmp_directory)"
1652 -progress "Using ${tmpdir} as a temporary directory."
1653 -cd "${tmpdir}" || fatal "Failed to change current working directory to ${tmpdir}." F000A
1654 -
1705 handle_existing_install
1706
1707 case "${SYSTYPE}" in
@@ -1668,6 +1718,8 @@ fi
1718
1719 set_auto_updates
1720
1721 +print >&2 "%s\n\n" "Successfully installed the Netdata Agent."
1722 +success_banner
1723 telemetry_event INSTALL_SUCCESS "" ""
1724 cleanup
1725 trap - EXIT