Update agent version to 1.8.3 (#119)

* Update agent version to 1.8.3

Changes:
 - amplify.agent.common.runner migrated to latest PEP 3143 implementation,
 - added support for packaging Ubuntu 24.04 "noble",
 - fixed package building for RHEL 9.

* packages: fixed issues found by internal CI
master
Andrei Belov 2025-01-14 11:32:56 +04:00 committed by GitHub
parent 0b04168a5f
commit 0ec1e18444
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 112 additions and 18 deletions

View File

@ -2,8 +2,8 @@
The NGINX Amplify Agent is a Python application that provides system and NGINX metric collection. It is part of NGINX Amplify — a free configuration monitoring tool for NGINX.
Please check the list of the supported operating systems [here](https://docs.nginx.com/amplify/faq/nginx-amplify-agent/#what-operating-systems-are-supported).
Please check the list of the supported operating systems [here](https://docs.nginx.com/nginx-amplify/faq/nginx-amplify-agent/#what-operating-systems-are-supported).
This repository is not for installation purposes. To install the agent, please follow [this](https://docs.nginx.com/amplify/nginx-amplify-agent/install/installing-amplify-agent/) document.
This repository is not for installation purposes. To install the agent, please follow [this](https://docs.nginx.com/nginx-amplify/nginx-amplify-agent/install/installing-amplify-agent/) document.
For more information about NGINX Amplify, please check the official documentation [here](https://docs.nginx.com/nginx-amplify/).

View File

@ -37,7 +37,7 @@ class Context(Singleton):
# define vars
self.cpu_last_check = 0
self.version_semver = (1, 8, 2)
self.version_semver = (1, 8, 3)
self.version_build = 1
self.uuid = None
self.version = '%s-%s' % ('.'.join(map(str, self.version_semver)), self.version_build)

View File

@ -1,32 +1,42 @@
# -*- coding: utf-8 -*-
import signal
from daemon import runner
import daemon
from daemon.pidfile import PIDLockFile
from amplify.agent.common.context import context
__author__ = "Mike Belov"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "Mike Belov"
__email__ = "dedm@nginx.com"
__maintainer__ = "Andrei Belov"
__email__ = "a.belov@f5.com"
class Runner(runner.DaemonRunner):
class Runner:
def __init__(self, app):
super(Runner, self).__init__(app)
def cleanup(signum, frame):
app.stop()
self.daemon_context = daemon.DaemonContext()
self.app = app
self.daemon_context.detach_process = True
self.daemon_context.pidfile = PIDLockFile('/var/run/amplify-agent/amplify-agent.pid')
self.daemon_context.files_preserve = context.get_file_handlers()
self.daemon_context.signal_map = {
signal.SIGTERM: cleanup
}
self._open_streams_from_app_stream_paths(app)
def _open_streams_from_app_stream_paths(self, app):
self.daemon_context.stdin = open(app.stdin_path, 'rt')
self.daemon_context.stdout = open(app.stdout_path, 'w+t')
self.daemon_context.stderr = open(app.stderr_path, 'w+t')
def do_action(self):
"""
Stub function to mock old DaemonRunner behavior
"""
with self.daemon_context:
self.app.run()

View File

@ -75,9 +75,19 @@ start() {
chown -f $user /etc/amplify-agent/agent.conf
chown -f $user /var/log/amplify-agent/agent.log
daemon --user=$user $binary start --config=$conffile --pid=$pidfile
fi;
fi
RETVAL="$?"
echo
return $RETVAL
if [ "$RETVAL" -ne 0 ]; then
return "$RETVAL"
fi
for i in 1 2 3 4 5; do
if [ -e "$pidfile" ]; then
return 0
fi
sleep 1
done
return 1
}
stop() {
@ -123,6 +133,13 @@ debug() {
case "$1" in
start)
if status -p $pidfile amplify-agent >/dev/null 2>&1; then
echo "amplify-agent is already running" >&2
exit 0
fi
if [ -e "$pidfile" ]; then
rm -f "$pidfile"
fi
start
RETVAL=$?
;;
@ -135,7 +152,7 @@ case "$1" in
RETVAL=$?
;;
status)
status -p $pidfile amplify-agent
status -p $pidfile amplify-agent
RETVAL=$?
;;
configtest)

View File

@ -66,7 +66,16 @@ do_start()
chown -f $USER /var/log/amplify-agent/agent.log
start-stop-daemon --start --chuid $USER --exec $DAEMON start -- $DAEMON_ARGS
RETVAL="$?"
return "$RETVAL"
if [ "$RETVAL" -ne 0 ]; then
return "$RETVAL"
fi
for i in 1 2 3 4 5; do
if [ -e "$PIDFILE" ]; then
return 0
fi
sleep 1
done
return 1
}
do_stop()
@ -94,6 +103,13 @@ do_debug() {
case "$1" in
start)
if status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" >/dev/null 2>&1; then
echo " * $NAME is already running" >&2
exit 0
fi
if [ -e "$PIDFILE" ]; then
rm -f "$PIDFILE"
fi
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
do_start
case "$?" in

View File

@ -467,7 +467,7 @@ case "$os" in
incr_step
case "$codename" in
buster|bullseye|bookworm|bionic|focal|jammy)
buster|bullseye|bookworm|bionic|focal|jammy|noble)
check_python 3
python_supported=3
;;

View File

@ -1,3 +1,9 @@
nginx-amplify-agent (1.8.3-1) stable; urgency=low
* migrated to the most recent daemonizing logic (PEP 3143)
-- Andrei Belov <a.belov@f5.com> Wed, 8 Jan 2025 16:08:40 +0400
nginx-amplify-agent (1.8.2-1) stable; urgency=low
* pyMySQL updated to 1.1.1

View File

@ -0,0 +1,35 @@
Source: nginx-amplify-agent
Homepage: https://github.com/nginxinc/nginx-amplify-agent
Maintainer: NGINX Packaging <nginx-packaging@f5.com>
Section: python
Priority: optional
Build-Depends: debhelper (>= 13),
dpkg-dev (>= 1.22),
python3,
dh-python
Standards-Version: 4.5.0
Package: nginx-amplify-agent
Description: Agent for NGINX Amplify monitoring platform
The NGINX Amplify Agent is a small, Python application that provides
system and NGINX metric collection. It is part of NGINX Amplify -
the monitoring and configuration assistance service for NGINX.
.
This package installs and runs NGINX Amplify Agent daemon.
.
See http://nginx.com/amplify for more information
Architecture: any
Depends: ${misc:Depends},
${python3:Depends},
python3-daemon,
python3-pyasyncore,
python3-setproctitle,
python3-greenlet,
python3-gevent,
python3-requests,
python3-ujson,
python3-netifaces,
python3-pymysql,
python3-psutil,
lsb-release,
adduser

View File

@ -7,3 +7,4 @@ rstr==3.0.0
python-daemon==2.2.4
ujson==5.4.0
PyMySQL==1.1.1
setuptools<=70.3.0

View File

@ -0,0 +1,4 @@
netaddr==0.8.0
flup==1.0.3
crossplane==0.5.8
rstr==3.0.0

View File

@ -157,6 +157,10 @@ fi
%changelog
* Wed Jan 8 2025 Andrei Belov <a.belov@f5.com> 1.8.3-1
- 1.8.3-1
- migrated to the most recent daemonizing logic (PEP 3143)
* Mon May 27 2024 Andrei Belov <a.belov@f5.com> 1.8.2-1
- 1.8.2-1
- pyMySQL updated to 1.1.1

View File

@ -33,7 +33,7 @@ elif is_deb():
setup(
name="nginx-amplify-agent",
version="1.8.2",
version="1.8.3",
author="Mike Belov",
author_email="dedm@nginx.com",
description="NGINX Amplify Agent",

View File

@ -33,7 +33,7 @@ elif is_deb():
setup(
name="nginx-amplify-agent",
version="1.8.2",
version="1.8.3",
author="Mike Belov",
author_email="dedm@nginx.com",
description="NGINX Amplify Agent",

View File

@ -33,7 +33,7 @@ elif is_deb():
setup(
name="nginx-amplify-agent",
version="1.8.2",
version="1.8.3",
author="Mike Belov",
author_email="dedm@nginx.com",
description="NGINX Amplify Agent",

View File

@ -1 +1 @@
1.8.2-1
1.8.3-1

View File

@ -19,6 +19,7 @@ COMPAT_LEVELS = {
'bullseye': 13,
'jammy': 13,
'bookworm': 13,
'noble': 13,
}