diff options
author | B Stack <bgstack15@gmail.com> | 2022-02-15 10:19:09 -0500 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2022-02-15 10:22:01 -0500 |
commit | 1a0fbf8853496ac8725e58a1e905fb0fffc5093e (patch) | |
tree | 805bbfde5d58859ff37b03c76fc8280e59040b02 | |
parent | update doc (diff) | |
download | stackbin-1a0fbf8853496ac8725e58a1e905fb0fffc5093e.tar.gz stackbin-1a0fbf8853496ac8725e58a1e905fb0fffc5093e.tar.bz2 stackbin-1a0fbf8853496ac8725e58a1e905fb0fffc5093e.zip |
fix wsgi pidfile, user homedir, and INI loading
-rw-r--r-- | extra/Makefile | 2 | ||||
-rwxr-xr-x | extra/stackbin.init | 3 | ||||
-rw-r--r-- | extra/stackbin.service | 6 | ||||
-rw-r--r-- | extra/stackbin.spec | 2 | ||||
-rw-r--r-- | extra/stackbin.sysusers | 2 | ||||
-rwxr-xr-x | stackbin.bin | 7 | ||||
-rw-r--r-- | stackbin.wsgi.ini.example | 2 |
7 files changed, 14 insertions, 10 deletions
diff --git a/extra/Makefile b/extra/Makefile index 785d2df..d55b8c6 100644 --- a/extra/Makefile +++ b/extra/Makefile @@ -24,7 +24,7 @@ LIBEXECDIR = $(DESTDIR)$(prefix)/libexec SHAREDIR = $(DESTDIR)$(prefix)/share DOCDIR = $(SHAREDIR)/doc/$(APPNAME) APPDIR = $(SHAREDIR)/$(APPNAME) -APPVARDIR = $(DESTDIR)/var/www/$(APPNAME) +APPVARDIR = $(DESTDIR)/var/$(APPNAME) MANDIR = $(SHAREDIR)/man SYSVDIR = $(SYSCONFDIR)/init.d SYSDDIR = $(DESTDIR)$(prefix)/lib/systemd/system diff --git a/extra/stackbin.init b/extra/stackbin.init index a8cd25e..057c793 100755 --- a/extra/stackbin.init +++ b/extra/stackbin.init @@ -19,11 +19,12 @@ DAEMON=/usr/sbin/stackbin.bin DESC="stackbin" NAME=stackbin PATH=/sbin:/usr/sbin:/bin:/usr/bin -PIDFILE2=/var/run/$NAME-wsgi.pid +PIDFILE2=/var/$NAME/$NAME-wsgi.pid PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME USER=stackbin WSGIBIN=uwsgi_python39 +export STACKBIN_WSGI_INI=/etc/stackbin.wsgi.ini # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 diff --git a/extra/stackbin.service b/extra/stackbin.service index a2ef4b9..d2aad39 100644 --- a/extra/stackbin.service +++ b/extra/stackbin.service @@ -4,14 +4,14 @@ Wants=network-online.target After=network.target syslog.target [Service] -#Environment= -WorkingDirectory=/var/www +Environment=STACKBIN_WSGI_INI=/etc/stackbin.wsgi.ini +WorkingDirectory=/var/stackbin User=stackbin Group=stackbin Type=simple ExecStart=/usr/sbin/stackbin.bin TimeoutStartSec=120 -ExecStop=/usr/sbin/uwsgi --stop /var/run/stackbin-wsgi.pid +ExecStop=/usr/sbin/uwsgi --stop /var/stackbin/stackbin-wsgi.pid RestartSec=15 Restart=always KillSignal=SIGINT diff --git a/extra/stackbin.spec b/extra/stackbin.spec index f9a7792..c5abeb8 100644 --- a/extra/stackbin.spec +++ b/extra/stackbin.spec @@ -24,7 +24,7 @@ %global pythonver python3 %endif -%global _appvardir %{?_localstatedir}%{!?_localstatedir:/var}/www/stackbin +%global _appvardir %{?_localstatedir}%{!?_localstatedir:/var}/stackbin %global _appdir %{?_datarootdir}%{!?_datarootdir:%{_prefix}/share}/stackbin %global _user stackbin diff --git a/extra/stackbin.sysusers b/extra/stackbin.sysusers index e6b7b69..e36f686 100644 --- a/extra/stackbin.sysusers +++ b/extra/stackbin.sysusers @@ -1,3 +1,3 @@ # Part of stackbin package #Type Name ID GECOS Home directory Shell -u stackbin - "stackbin system user" /var/www/stackbin /sbin/nologin +u stackbin - "stackbin system user" /var/stackbin /sbin/nologin diff --git a/stackbin.bin b/stackbin.bin index 4fb3241..e98039f 100755 --- a/stackbin.bin +++ b/stackbin.bin @@ -1,8 +1,11 @@ #!/bin/sh # Reference: fuss.bin from fuss project # Startdate: 2022-02-13 19:25 -thisscript="$( readlink -f "${0}" )" +test -z "${STACKBIN_WSGI_INI}" && { + thisscript="$( readlink -f "${0}" )" + STACKBIN_WSGI_INI="$( dirname "${thisscript}" )/$( basename "${thisscript}" | sed -r -e 's/\.bin$//;' ).wsgi.ini" +} COMMAND="" grep -qiE 'ID=.*(rhel|centos|fedora)' /etc/os-release && COMMAND="${COMMAND} uwsgi" || \ COMMAND="${COMMAND} uwsgi_python39" -${COMMAND} --ini "$( dirname "${thisscript}" )/$( basename "${thisscript}" | sed -r -e 's/\.bin$//;' ).wsgi.ini" +${COMMAND} --ini "${STACKBIN_WSGI_INI}" diff --git a/stackbin.wsgi.ini.example b/stackbin.wsgi.ini.example index 7e0d203..bb30c20 100644 --- a/stackbin.wsgi.ini.example +++ b/stackbin.wsgi.ini.example @@ -15,4 +15,4 @@ req-logger = file:/var/log/stackbin/req.log logdate = "%%FT%%T" logger = file:/var/log/stackbin/stackbin.log # the init script uses a different pidfile owned by root. -pidfile = /var/run/stackbin-wsgi.pid +pidfile = /var/stackbin/stackbin-wsgi.pid |