0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-14 01:29:11 +00:00
netdata_netdata/packaging
vkalintiris e99da8b64b
Run the agent as a Windows service. ()
* Run the agent as a Windows service.

This commit contains the boilerplate code for running the agent as a
Windows service.

We start the agent's main as a separate thread, although this is not
strictly required based on my experiments. We need similar logic for
calling netdata's exit function when someone wants to stop the agent.

However, at this point we need to resolve the issue of gaps when
running the agent as a service. It seems that sleeping for one second
with `sleep(1)`, actually sleeps for 2 to 4 seconds on my setup.

Once we resolve this, the work that remains concerns packaging: ie.
installing the binaries at the proper places so that the relevant
DLLs are found.

To test this PR you need to:
  - Build the agent: ./packaging/utils/compile-on-windows.sh
  - Install the files: `ninja -C build/ install`
  - Copy the main binary: `cp ./build/netdata /usr/bin/`
  - (Only once) Create the netdata service: `sc.exe config Netdata binPath="C:\msys64\usr\bin\netdata"`
  - Start the service: `sc.exe start Netdata`

A couple notes:
  - The health and the spawn client have been disabled for the time
    being. They will be re-enabled once we finish the agent-as-service
    issue and the packaging.
  - Last time I checked, the agent crashes after a while when using
    dbengine. In order to have something that works correctly, you
    should specify memory-mode ram in your netdata.conf.

* Add windows version for sleep_usec_with_now

* Split install prefix from runtime prefix

These paths are always the same for non-Windows
systems. On Windows, RFS is the top-level
installation path.

With the current setup, Netdata will be installed
at C:\msys64\opt\netdata at packaging time. However,
the layout of the application means that when the
agent starts, it'll look as if everything was installed
at /.

* Do not use mold linker on Windows.

* Use modern UI for installer.

* Make the service delayed-auto

* Use mutexes instead of spinlocks.

* Update service handling logic.

* Add proper ifdefs for spinlock implementation.

* Initialize analytics spinlock

* Add a macro to build the agent as regular cli tool.

* Add makensis dependency

* Let installer know it's installing Netdata.

* Disable pluginsd on Windows

When pluginsd is enabled, the agent freezes approximately
20% of the time during startup.

* Add service description.

* Return pthread_join result

* Print tag when we fail to join a thread.

* Do not use mutexes instead of spinlocks.

* Assorted changes to service/main code.

* Rework service functions.

With the current implementation we are not getting any
MUTEX_LOCK errors and thread joining succeeds.

The only case where joining fails is the parallel initialization
of dbengine threads, which we can easily avoid by serializing
the initialization step.

* Rework main functions

This will allow someone to run the agent either as a service
or as a command-line tool.

* Change runtime prefix only when building for packaging.

* Install binaries and dlls.

* Make netdata claiming through UI work correctly.

* Fix netdata path
2024-07-02 12:19:20 +03:00
..
cmake Enforce proper include ordering for vendored libraries. () 2024-06-26 06:59:11 -04:00
dag Bump jinja2 from 3.1.3 to 3.1.4 in /packaging/dag () 2024-05-07 08:10:41 +03:00
docker fix diskspace plugin in Docker () 2024-06-29 11:36:52 +03:00
installer Bump repository config fetched by kickstart to latest version. () 2024-06-28 10:05:00 -04:00
maintainers fix broken links and links pointing to Learn () 2024-05-16 12:54:02 +03:00
makeself add netdata journald configuration () 2024-06-14 19:18:08 +03:00
repoconfig Fix RPM repoconfig naming () 2024-06-25 07:11:07 -04:00
utils Run the agent as a Windows service. () 2024-07-02 12:19:20 +03:00
build-package.sh Use semver releases with sentry. () 2024-05-31 08:47:53 -04:00
build_package_install_test.sh Adds Docker based build system for Binary Packages, CI/CD, Smoke Testing and Development. () 2020-01-28 05:51:18 +10:00
building-native-packages-locally.md Update to use versioned base images for CI. () 2023-09-27 07:05:45 -04:00
check-for-go-toolchain.sh bump go toolchain to v1.22.0 in check-for-go-toolchain.sh () 2024-04-22 10:47:05 +00:00
check-kernel-config.sh Fix kernel test script () 2023-03-08 00:30:55 +00:00
PLATFORM_SUPPORT.md Remove Alpine 3.16 from CI. () 2024-05-24 11:34:29 -04:00
runtime-check.sh Fix DEB package builds. () 2024-05-28 13:07:35 -04:00
version [ci skip] Update changelog and version for nightly build: v1.46.0-82-nightly. 2024-07-02 00:17:43 +00:00
VERSIONING_AND_PUBLIC_API.md PR to change absolute links to relative () 2024-05-21 12:58:32 +03:00