[Asterisk-code-review] contrib/systemd: Added note on common issues with systemd and asterisk (asterisk[16])

Mark Petersen asteriskteam at digium.com
Thu Jan 7 09:18:24 CST 2021


Attention is currently required from: Jaco Kroon.
Hello Jaco Kroon,

I'd like you to do a code review. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/15309

to review the following change.


Change subject: contrib/systemd: Added note on common issues with systemd and asterisk
......................................................................

contrib/systemd: Added note on common issues with systemd and asterisk

With newer version of linux /var/run/ is a symlink to /run/ that has
been turned into tmpfs.

Added note that if asterisk has to bind to a specific IP that
systemd has to wait until the network is up.

Added note on how to make sure that the environment variable
HOSTNAME is included.

ASTERISK-29216
Reported by: Mark Petersen
Tested by: Mark Petersen

Change-Id: Ib3e560655befd3e99eec743687144f5569533379
---
M configure
M configure.ac
M contrib/systemd/asterisk.service
3 files changed, 19 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/09/15309/1

diff --git a/configure b/configure
index cd3c7c1..9b96fde 100755
--- a/configure
+++ b/configure
@@ -1043,6 +1043,7 @@
 MISDN_DIR
 MISDN_INCLUDE
 MISDN_LIB
+LUA_VERSIONS
 PBX_LUA
 LUA_DIR
 LUA_INCLUDE
@@ -1469,6 +1470,7 @@
 CXXCPP
 JANSSON_CONFIGURE_OPTS
 PJPROJECT_CONFIGURE_OPTS
+LUA_VERSIONS
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
@@ -2227,6 +2229,8 @@
               Additional configure options to pass to bundled jansson
   PJPROJECT_CONFIGURE_OPTS
               Additional configure options to pass to bundled pjproject
+  LUA_VERSIONS
+              A space separated list of target lua versions to test.
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
               directories to add to pkg-config's search path
@@ -29515,7 +29519,7 @@
 
 
 
-for ver in 5.4 5.3 5.2 5.1; do
+for ver in ${LUA_VERSIONS:-5.4 5.3 5.2 5.1}; do
 
 if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
    pbxlibdir=""
@@ -29626,6 +29630,7 @@
 done
 
 # Some distributions (like openSUSE and NetBSD) remove the 5.x suffix.
+if test "x${LUA_VERSIONS}" = "x"; then
 
 if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
    pbxlibdir=""
@@ -29722,6 +29727,7 @@
 fi
 
 
+fi
 
 # Accept either RADIUS client library, their APIs are fully compatible,
 # just different header filenames and different SONAMEs
diff --git a/configure.ac b/configure.ac
index 62d02ec..03e141d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -511,6 +511,7 @@
 AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt])
 AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt])
 AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
+AC_ARG_VAR([LUA_VERSIONS],[A space separated list of target lua versions to test.])
 AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn])
 AST_EXT_LIB_SETUP([MYSQLCLIENT], [MySQL client], [mysqlclient])
 AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
@@ -2555,7 +2556,7 @@
 fi
 AST_EXT_LIB_CHECK([OPUSFILE], [opusfile], [op_open_callbacks], [opus/opusfile.h], [], [$__opus_include])
 
-for ver in 5.4 5.3 5.2 5.1; do
+for ver in ${LUA_VERSIONS:-5.4 5.3 5.2 5.1}; do
 	AST_EXT_LIB_CHECK([LUA], lua${ver}, [luaL_newstate], lua${ver}/lua.h, [-lm])
 	if test "x${PBX_LUA}" = "x1" ; then
 		if test x"${LUA_DIR}" = x; then
@@ -2568,7 +2569,9 @@
 done
 
 # Some distributions (like openSUSE and NetBSD) remove the 5.x suffix.
-AST_EXT_LIB_CHECK([LUA], [lua], [luaL_newstate], [lua.h], [-lm])
+if test "x${LUA_VERSIONS}" = "x"; then
+	AST_EXT_LIB_CHECK([LUA], [lua], [luaL_newstate], [lua.h], [-lm])
+fi
 
 # Accept either RADIUS client library, their APIs are fully compatible,
 # just different header filenames and different SONAMEs
diff --git a/contrib/systemd/asterisk.service b/contrib/systemd/asterisk.service
index c3d4648..e654f50 100644
--- a/contrib/systemd/asterisk.service
+++ b/contrib/systemd/asterisk.service
@@ -1,15 +1,22 @@
 [Unit]
 Description=Asterisk PBX and telephony daemon.
 After=network.target
+#include these if asterisk need to bind to a specific IP (other than 0.0.0.0)
+#Wants=network-online.target
+#After=network-online.target network.target
 
 [Service]
 Type=notify
 Environment=HOME=/var/lib/asterisk
+#if systemd do not provide hostname and you need to use ${ENV(HOSTNAME)}
+#Environment=HOSTNAME=%H
 WorkingDirectory=/var/lib/asterisk
 User=asterisk
 Group=asterisk
 ExecStart=/usr/sbin/asterisk -mqf -C /etc/asterisk/asterisk.conf
 ExecReload=/usr/sbin/asterisk -rx 'core reload'
+#if /var/run is a tmpfs, this will create /var/run/asterisk on start
+#RuntimeDirectory=asterisk
 
 #Nice=0
 #UMask=0002

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15309
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ib3e560655befd3e99eec743687144f5569533379
Gerrit-Change-Number: 15309
Gerrit-PatchSet: 1
Gerrit-Owner: Mark Petersen <bugs.digium.com at zombie.dk>
Gerrit-Reviewer: Jaco Kroon <jaco at uls.co.za>
Gerrit-Attention: Jaco Kroon <jaco at uls.co.za>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210107/fe8e367c/attachment.html>


More information about the asterisk-code-review mailing list