From nobody Sun Sep 08 07:43:33 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X1hm560M0z5WGTS; Sun, 08 Sep 2024 07:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X1hm55V2bz4NSf; Sun, 8 Sep 2024 07:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725781413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1W7GcmV5rc56lDdfrpSsxuVL7ivNAsX+6AVXP7hZ0JA=; b=tRbp4uxKxa3e7vKuqMIEAMXx2M7eB6/6cQpplOyFkcn0TLIoC3+GIQKzUT9hy1pwNGP+Fc VlgLvOiHxFtvTjSdWxu1UnK9NqN5J5i4Smk1Z50foTswjEqsjTrjU+1Zy8U8dd8enVoilp eW6bLhA70xwSk5yBc4F/eNJudopXeGNNnRkeVvvWkBK7ARkpTrkpzptyixdVcWEWU5HjOi L67++YnZoDHa3MdVSfDGAgbvD6DIoAji4aFIk30XOhdG0B344tjvZ2sTK22LhcmopR4Uhi tdoeBh5vQVC/nAkI6btI3j0rwEe+PPLxJGtpP8BsIWQptGaNOji8oNgFmAEkiQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725781413; a=rsa-sha256; cv=none; b=emmqH4aTqn3o9NOQYCoK24REeseXMhmY5gBRBLjbTPaV2b+LEzOApBBmAN7on/k/TQK7oa F/i5LsDabcV/ZH8lFBowxxIAr+KPzw7EMw2ukcE8UlSBIqRZlFd5A/ZZvin6dDvAXBXirT Qj1ConaMJZNO91ui/p2Hx2Nfyd9hiVKxAmN0eIBdDTRuOHOAYtHXLu/W7bk519362EJYxY 67ox01pupQ2ARDtwJ9MSReI3Ln02ae4pDSyJ7ll0DZLuwukhzn+vmBD4PqGxr+gWJWuolN vFwC5R2zJFFmAq+wHXBP6hBIYijXsOVdIIlN4BvDlVzA30mM0N1DUOXwkOnR+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725781413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1W7GcmV5rc56lDdfrpSsxuVL7ivNAsX+6AVXP7hZ0JA=; b=gFr1q+7KZj0DIBD3gWKzdocMgAL8p7ozeuMUVNA2lIXCJEDvUJIOdDid3lDaVoRly/YGIf NmEAAJQf7HiDr8wzQqfK4DW0APG7cthxQ/dLQSzyVVrwpSZECJtk1pxqTE+XEsB36/MII/ /pZ5X/B9IUrc4sEtUjHEMMx/NwBS6l7O8zG6cjmcTkA2aS+nmRzZPeIE1LUGwbJoktVFlY W347M6QKWPgNk5M2Hn+0ddt63D6kJxvsnYzh6IXjrDqOSjHMjVZP4p4jveq+m5rAlQjsDl 7uOMqzViX4z+aL6IOKLHbN92apppBjRETWhjRafchTdUK577m42loKMe0o1rSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4X1hm554T4z19dl; Sun, 8 Sep 2024 07:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4887hX7Q006639; Sun, 8 Sep 2024 07:43:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4887hXQT006636; Sun, 8 Sep 2024 07:43:33 GMT (envelope-from git) Date: Sun, 8 Sep 2024 07:43:33 GMT Message-Id: <202409080743.4887hXQT006636@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Kurt Jaeger Subject: git: 6f192cd6ff6f - main - www/tt-rss: Simplify ttrssd rc script List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pi X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f192cd6ff6fe999d30350a814edd12dbbeca98e Auto-Submitted: auto-generated The branch main has been updated by pi: URL: https://cgit.FreeBSD.org/ports/commit/?id=6f192cd6ff6fe999d30350a814edd12dbbeca98e commit 6f192cd6ff6fe999d30350a814edd12dbbeca98e Author: Derek Schrock AuthorDate: 2024-09-08 07:40:10 +0000 Commit: Kurt Jaeger CommitDate: 2024-09-08 07:40:10 +0000 www/tt-rss: Simplify ttrssd rc script ttrssd rc script has a check if a local database is ready such that at startup ttrssd will wait 10 seconds for a database connection. With daemon you can restart the child process with a delay such that the rc script can be simplified to use command and command_args. PR: 279803 Author: Derek Schrock Reviewed-by: cy Differential Revision: https://reviews.freebsd.org/D45618 --- UPDATING | 8 +++ www/tt-rss/Makefile | 6 +- www/tt-rss/distinfo | 2 +- www/tt-rss/files/ttrss_db_check.php.in | 8 --- www/tt-rss/files/ttrssd.in | 103 +++++++++++---------------------- www/tt-rss/pkg-plist | 1 - 6 files changed, 44 insertions(+), 84 deletions(-) diff --git a/UPDATING b/UPDATING index 4217eb625b9e..f72ab255b66e 100644 --- a/UPDATING +++ b/UPDATING @@ -5,6 +5,14 @@ they are unavoidable. You should get into the habit of checking this file for changes each time you update your ports collection, before attempting any port upgrades. +20240907: + AFFECTS: www/tt-rss + AUTHOR: dereks@lifeofadishwasher.com + + The ttrssd_local_db rc var has been removed in favor of using daemon's + restart option -r to retry the ttrssd php scripts if database is not up + before ttrssd starts. + 20240829: AFFECTS: devel/binutils AUTHOR: cy@FreeBSD.org diff --git a/www/tt-rss/Makefile b/www/tt-rss/Makefile index d3e5cc102966..422d353d9f0c 100644 --- a/www/tt-rss/Makefile +++ b/www/tt-rss/Makefile @@ -1,6 +1,6 @@ PORTNAME= tt-rss PORTVERSION= g20240421 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 2 CATEGORIES= www PKGNAMESUFFIX= ${PHP_PKGNAMESUFFIX} @@ -37,7 +37,7 @@ NO_BUILD= yes # pgsql: php-pgsql php-pdo_pgsql # # from Mk/Uses/php.mk create sub vars for mysqli/pdo_mysql pgsql/pdo_pgsql values -SUB_FILES= config.php httpd-tt-rss.conf pkg-message ttrss_db_check.php +SUB_FILES= config.php httpd-tt-rss.conf pkg-message SUB_LIST= MYSQL_DEPS="${mysqli_DEPENDS:T} ${pdo_mysql_DEPENDS:T}" \ PGSQL_DEPS="${pgsql_DEPENDS:T} ${pdo_pgsql_DEPENDS:T}" \ WWWOWN=${WWWOWN} @@ -68,8 +68,6 @@ do-install: ${RM} ${STAGEDIR}${WWWDIR}/config.php-dist ${INSTALL_DATA} ${WRKDIR}/config.php \ ${STAGEDIR}${WWWDIR}/config.php.sample - ${INSTALL_DATA} ${WRKDIR}/ttrss_db_check.php \ - ${STAGEDIR}${WWWDIR}/ttrss_db_check.php ${INSTALL_DATA} ${FILESDIR}/newsyslog.sample \ ${STAGEDIR}${EXAMPLESDIR} diff --git a/www/tt-rss/distinfo b/www/tt-rss/distinfo index 7821d80336d3..2274a9a08d04 100644 --- a/www/tt-rss/distinfo +++ b/www/tt-rss/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1713836306 +TIMESTAMP = 1721519279 SHA256 (tt-rss-tt-rss-d832907125a7711397da8ade5cfb51082d802542_GL0.tar.gz) = 21754aa85eaa4a5de1aba6e076f26ca3c356a4d6e70ae7e1d9e6ea6d12de1d65 SIZE (tt-rss-tt-rss-d832907125a7711397da8ade5cfb51082d802542_GL0.tar.gz) = 8995458 diff --git a/www/tt-rss/files/ttrss_db_check.php.in b/www/tt-rss/files/ttrss_db_check.php.in deleted file mode 100644 index cbc7aaac8828..000000000000 --- a/www/tt-rss/files/ttrss_db_check.php.in +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/www/tt-rss/files/ttrssd.in b/www/tt-rss/files/ttrssd.in index a92d4464df53..7934b98a4afc 100644 --- a/www/tt-rss/files/ttrssd.in +++ b/www/tt-rss/files/ttrssd.in @@ -1,16 +1,12 @@ #! /bin/sh # PROVIDE: ttrssd -# REQUIRE: LOGIN mysql postgresql +# REQUIRE: LOGIN # KEYWORD: shutdown # Add the following lines to /etc/rc.conf to enable `ttrssd': # # ttrssd_enable="YES" -# -# ttrssd_local_db (bool): Set to "YES" by default. -# Set it to "NO" if the database is on another -# server. . /etc/rc.subr @@ -22,85 +18,52 @@ rcvar=ttrssd_enable # read settings, set default values load_rc_config "${name}" : ${ttrssd_enable="NO"} -: ${ttrssd_local_db:="YES"} -initdb_php="%%WWWDIR%%/update.php" -dbcheck_php="%%WWWDIR%%/ttrss_db_check.php" +long_name="Tiny Tiny RSS updating feeds daemon." required_files="%%WWWDIR%%/config.php" pidfile="/var/run/${name}.pid" -ppidfile="/var/run/${name}_parent.pid" +cpidfile="/var/run/${name}_child.pid" phpcli="%%LOCALBASE%%/bin/php" -command_interpreter=$phpcli -long_name="Tiny Tiny RSS updating feeds daemon." + +initdb_php="%%WWWDIR%%/update.php" phpupd="%%WWWDIR%%/update_daemon2.php" ttrssd_log="/var/log/${name}.log" -ttrssd_user="%%WWWOWN%%" -start_precmd=${name}_prestart -start_cmd=${name}_start -stop_cmd=${name}_stop +command="/usr/sbin/daemon" +command_args="-rR 10 -H -u %%WWWOWN%% \ + -P $pidfile -p $cpidfile \ + -o $ttrssd_log sh -c \ + '$initdb_php --update-schema=force-yes; \ + $phpupd;'" -MYSQL_CHECK_CMD="%%LOCALBASE%%/bin/mysqladmin -u mysqld ping" -MYSQL_CHECK_MSG="${name}: mysqladmin command failed; mysql not ready?" -PGSQL_CHECK_CMD="%%LOCALBASE%%/bin/pg_isready" -PGSQL_CHECK_MSG="${name}: postgresql status failed; postgresql not ready?" +stop_cmd="${name}_stop" -ttrssd_start() { - if ! [ -x $phpcli ]; then - echo "$phpcli not found" - exit 1 - fi +# daemon doesn't process signals if it lacks a child process. +# See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277959 +ttrssd_stop() { + local pid_daemon + local pid_child + local signal="TERM" - if [ -f $pidfile ]; then - echo "$name already running?" - exit 2 - fi + pid_daemon=$(check_pidfile ${pidfile} ${command}) + pid_child=$(check_pidfile ${cpidfile} ${phpcli}) - echo "Starting $long_name" - daemon -H -P "$ppidfile" -p "$pidfile" \ - -u "$ttrssd_user" -o "$ttrssd_log" \ - sh -c "${initdb_php} --update-schema=force-yes; $phpupd" -} + if [ -n "$pid_daemon" ]; then + echo "Stopping ${name}." -ttrssd_stop() { - if ! [ -f $pidfile ]; then - echo "$name not running?" - exit 1 - fi + if [ -z "${pid_child}" ]; then + signal="INT" + fi - echo "Stopping $long_name" - pkill -CHLD -F "$pidfile" - pkill -F "$pidfile" - pwait "$(cat $ppidfile)" -} + kill -"$signal" "${pid_daemon}" -ttrssd_prestart() { - if checkyesno ttrssd_local_db; then - # Wait for the local database to be started - - database="$("$phpcli" -f "$dbcheck_php")" - - case "$database" in - "mysql") - CHECK_CMD="$MYSQL_CHECK_CMD" - CHECK_MSG="$MYSQL_CHECK_MSG" - ;; - "pgsql") - CHECK_CMD="$PGSQL_CHECK_CMD" - CHECK_MSG="$PGSQL_CHECK_MSG" - ;; - *) - err 1 "Unknown database configured: $database" - ;; - esac - - for n in $(seq 1 10); do - if $CHECK_CMD > /dev/null 2>&1; then - return - fi - sleep 1 - done - err 1 $CHECK_MSG + wait_for_pids "${pid_daemon}" "${pid_child}" + else + if [ -n "$pid_child" ]; then + echo "${name} not running? (check ${cpidfile})." + else + echo "${name} not running? (check ${pidfile})." + fi fi } diff --git a/www/tt-rss/pkg-plist b/www/tt-rss/pkg-plist index 68506c70ab49..909f900cce5f 100644 --- a/www/tt-rss/pkg-plist +++ b/www/tt-rss/pkg-plist @@ -2373,7 +2373,6 @@ %%WWWDIR%%/themes/night_base.less %%WWWDIR%%/themes/night_blue.css %%WWWDIR%%/themes/night_blue.less -%%WWWDIR%%/ttrss_db_check.php %%WWWDIR%%/utils/phpstan-watcher.sh %%WWWDIR%%/utils/phpunit-integration.sh %%WWWDIR%%/utils/phpunit.sh