mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-04 03:51:30 +02:00
testing/uwsgi: add init.d script
This commit is contained in:
parent
171ac82c08
commit
2f5fa4664c
@ -1,15 +1,18 @@
|
||||
# Contributor: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
# Maintainer:
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=uwsgi
|
||||
pkgver=1.4.8
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="uWSGI application container server"
|
||||
url=http://projects.unbit.it/uwsgi/
|
||||
arch=all
|
||||
license=GPL-2
|
||||
makedepends="linux-headers lua-dev python python-dev zeromq-dev"
|
||||
subpackages="uwsgi-lua uwsgi-python:py"
|
||||
source="http://projects.unbit.it/downloads/uwsgi-${pkgver}.tar.gz futimes.patch include-sched.patch lua-cache-update.patch"
|
||||
source="http://projects.unbit.it/downloads/uwsgi-${pkgver}.tar.gz
|
||||
futimes.patch include-sched.patch lua-cache-update.patch
|
||||
uwsgi.initd uwsgi.confd
|
||||
"
|
||||
|
||||
_builddir=$srcdir/$pkgname-$pkgver
|
||||
prepare() {
|
||||
@ -47,6 +50,11 @@ package() {
|
||||
local libdir=$pkgdir/usr/lib/uwsgi
|
||||
install -d "$libdir"
|
||||
install *_plugin.so "$libdir"
|
||||
|
||||
install -Dm755 "$srcdir"/uwsgi.initd \
|
||||
"$pkgdir"/etc/init.d/uwsgi || return 1
|
||||
install -Dm644 "$srcdir"/uwsgi.confd \
|
||||
"$pkgdir"/etc/conf.d/uwsgi || return 1
|
||||
}
|
||||
|
||||
lua() {
|
||||
@ -66,12 +74,18 @@ py() {
|
||||
md5sums="10af354eccaae9c447bd5bdc69bcce12 uwsgi-1.4.8.tar.gz
|
||||
2c9aeb5b2adf1fa45ef4ed6bda47236a futimes.patch
|
||||
02c43e001d5f44eb421079e17f9db003 include-sched.patch
|
||||
3bba1063b54043561f520d6986e35057 lua-cache-update.patch"
|
||||
3bba1063b54043561f520d6986e35057 lua-cache-update.patch
|
||||
8a8be061d7b5f3108a0f16813da68389 uwsgi.initd
|
||||
3d6afe6a8c52556d1d6c52384fc38d9a uwsgi.confd"
|
||||
sha256sums="3c35893927a065ed89775cf5a8f66f66d71b060618f4611efbcca76e520aac37 uwsgi-1.4.8.tar.gz
|
||||
9ad8375325195e577e6b91a1cf7539817b58fbb4efef248d01a4b704a0e8749f futimes.patch
|
||||
25cb58a02a9f1f62be227592a31152e960f51d44a9e9d14751375a9468152e90 include-sched.patch
|
||||
fe79c823399c750618572531e8c9ccfa2394da329ce16516af79887f493c1a2d lua-cache-update.patch"
|
||||
fe79c823399c750618572531e8c9ccfa2394da329ce16516af79887f493c1a2d lua-cache-update.patch
|
||||
58b998b025e4a9df20ca917bc93e287f9a8cf02d278d513fa461f70e1d08f799 uwsgi.initd
|
||||
4cb047e311aecd0f498da1d6a4c0947dd6dc7cc98575d54cb2ef150cacf8425c uwsgi.confd"
|
||||
sha512sums="7ead90c0740db0ebc28256b312a98e8de610b62cc82504c738cc2f3d2b0819ae673eb1875ea31abc3e511dc76db9af9fb15f4d1ae2a62f6b67b2a5966cfe2bab uwsgi-1.4.8.tar.gz
|
||||
9e867a3483197adb5ab99334d0e9f092dab44201ddbead99a4649309fd0584e6793531a147e096459984d26d0a73754688426df1fb4686c041d3889f3d29fdef futimes.patch
|
||||
d454dcc5ee0a121ff44584e0da98055e6596e8a750315fe4ce6a5fbc615697b2a19b9b32c51ac9878587a855ec3f072e87a3e4e097a8b743699f58ed0d84ec0f include-sched.patch
|
||||
baf97b56448c8a38334036b11c4fb36805ccfb3b867443afe3b1ee5b91bf10981d61f690184e51fa9e492b6318b657530e2f3f11d803dce17cef1a16c56719ab lua-cache-update.patch"
|
||||
baf97b56448c8a38334036b11c4fb36805ccfb3b867443afe3b1ee5b91bf10981d61f690184e51fa9e492b6318b657530e2f3f11d803dce17cef1a16c56719ab lua-cache-update.patch
|
||||
ab9dc6277bd05821287f6f8beb3ac2504f0e41db38e11b4d2884ac026f14ac7bfaaca138f045afa712d4f2843f94de105bf0d43fad35d18679ac33b507cd187e uwsgi.initd
|
||||
9f00afb2aa574bbc59040f945475712b8c40da0c06eeb5699de5510aa116148e35ab0429fa891084cf0cd7868876d5a80e1601b7c85d0e2e9ea2a1f54cdde619 uwsgi.confd"
|
||||
|
||||
63
testing/uwsgi/uwsgi.confd
Normal file
63
testing/uwsgi/uwsgi.confd
Normal file
@ -0,0 +1,63 @@
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/files/uwsgi.confd-r3,v 1.1 2013/03/01 09:50:06 ultrabug Exp $
|
||||
|
||||
# YOU SHOULD ONLY MODIFY THIS FILE IF YOU USE THE UWSGI EMPEROR MODE!
|
||||
# IF YOU WANT TO RUN A SINGLE APP INSTANCE, CREATE A COPY AND MODIFY THAT INSTEAD!
|
||||
|
||||
# Path (or name) of UNIX/TCP socket to bind to
|
||||
# Example : UWSGI_SOCKET=127.0.0.1:1234
|
||||
UWSGI_SOCKET=
|
||||
|
||||
# Enable threads? (1 = yes, 0 = no). The default is 0
|
||||
#
|
||||
UWSGI_THREADS=0
|
||||
|
||||
# The path to your uWSGI application.
|
||||
#
|
||||
UWSGI_PROGRAM=
|
||||
|
||||
# The path to your uWSGI xml config file.
|
||||
#
|
||||
UWSGI_XML_CONFIG=
|
||||
|
||||
# The number of child processes to spawn. The default is 1.
|
||||
#
|
||||
UWSGI_PROCESSES=1
|
||||
|
||||
# The log file path. If empty, log only errors
|
||||
#
|
||||
UWSGI_LOG_FILE=
|
||||
|
||||
# If you want to run your application inside a chroot then specify the
|
||||
# directory here. Leave this blank otherwise.
|
||||
#
|
||||
UWSGI_CHROOT=
|
||||
|
||||
# If you want to run your application from a specific directiory specify
|
||||
# it here. Leave this blank otherwise.
|
||||
#
|
||||
UWSGI_DIR=
|
||||
|
||||
# The user to run your application as. If you do not specify these,
|
||||
# the application will be run as user root.
|
||||
#
|
||||
UWSGI_USER=
|
||||
|
||||
# The group to run your application as. If you do not specify these,
|
||||
# the application will be run as group root.
|
||||
#
|
||||
UWSGI_GROUP=
|
||||
|
||||
# Run the uwsgi emperor which loads vassals dynamically from this PATH
|
||||
# see http://projects.unbit.it/uwsgi/wiki/Emperor
|
||||
# The advised Gentoo folder is /etc/uwsgi.d/
|
||||
UWSGI_EMPEROR_PATH=
|
||||
|
||||
# The group the emperor should run as. This is different from the UWSGI_GROUP
|
||||
# as you could want your apps share some sockets with other processes such as
|
||||
# www servers while preserving your emperor logs from being accessible by them.
|
||||
UWSGI_EMPEROR_GROUP=
|
||||
|
||||
# Additional options you might want to pass to uWSGI
|
||||
#
|
||||
UWSGI_EXTRA_OPTIONS=
|
||||
144
testing/uwsgi/uwsgi.initd
Normal file
144
testing/uwsgi/uwsgi.initd
Normal file
@ -0,0 +1,144 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/files/uwsgi.initd-r3,v 1.1 2013/03/01 09:50:06 ultrabug Exp $
|
||||
|
||||
PROGNAME=${SVCNAME#*.}
|
||||
|
||||
UWSGI_EXEC=/usr/bin/uwsgi
|
||||
if [ "${SVCNAME}" == "uwsgi" ]; then
|
||||
PIDPATH=/var/run/uwsgi
|
||||
else
|
||||
PIDPATH="/var/run/uwsgi_${PROGNAME}"
|
||||
fi
|
||||
PIDFILE="${PIDPATH}/${PROGNAME}.pid"
|
||||
|
||||
extra_started_commands="${opts} reload stats"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -m 0750 -o "${UWSGI_USER}":"${UWSGI_GROUP}" "${PIDPATH}"
|
||||
}
|
||||
|
||||
start_emperor() {
|
||||
local OPTIONS
|
||||
OPTIONS="--daemonize"
|
||||
|
||||
if [ -n "${UWSGI_LOG_FILE}" ]; then
|
||||
OPTIONS="${OPTIONS} ${UWSGI_LOG_FILE}"
|
||||
else
|
||||
OPTIONS="${OPTIONS} /dev/null --disable-logging"
|
||||
fi
|
||||
|
||||
[ -z "${UWSGI_DIR}" ] && UWSGI_DIR="/"
|
||||
[ -z "${UWSGI_USER}" ] && UWSGI_USER="root"
|
||||
[ -z "${UWSGI_GROUP}" ] && UWSGI_GROUP="root"
|
||||
|
||||
if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then
|
||||
OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}"
|
||||
fi
|
||||
|
||||
ebegin "Starting uWSGI emperor"
|
||||
cd "${UWSGI_DIR}" && \
|
||||
start-stop-daemon --start --user "${UWSGI_USER}" --exec "${UWSGI_EXEC}" \
|
||||
--group ${UWSGI_EMPEROR_GROUP:-${UWSGI_GROUP}} \
|
||||
-- --emperor "${UWSGI_EMPEROR_PATH}" ${OPTIONS} --pidfile "${PIDFILE}"
|
||||
return $?
|
||||
}
|
||||
|
||||
start_app() {
|
||||
local OPTIONS
|
||||
OPTIONS="--master --daemonize"
|
||||
|
||||
if [ -n "${UWSGI_LOG_FILE}" ]; then
|
||||
OPTIONS="${OPTIONS} ${UWSGI_LOG_FILE}"
|
||||
else
|
||||
OPTIONS="${OPTIONS} /dev/null --disable-logging"
|
||||
fi
|
||||
|
||||
[ -z "${UWSGI_DIR}" ] && UWSGI_DIR="/"
|
||||
[ -z "${UWSGI_USER}" ] && UWSGI_USER="root"
|
||||
[ -z "${UWSGI_GROUP}" ] && UWSGI_GROUP="root"
|
||||
|
||||
if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then
|
||||
OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}"
|
||||
fi
|
||||
|
||||
if [ "${UWSGI_THREADS}" = "1" ]; then
|
||||
OPTIONS="${OPTIONS} --enable-threads"
|
||||
fi
|
||||
|
||||
if [ -n "${UWSGI_SOCKET}" ]; then
|
||||
OPTIONS="${OPTIONS} --socket ${UWSGI_SOCKET}"
|
||||
fi
|
||||
|
||||
if [ -n "${UWSGI_PROCESSES}" ]; then
|
||||
OPTIONS="${OPTIONS} --processes ${UWSGI_PROCESSES}"
|
||||
fi
|
||||
|
||||
if [ -n "${UWSGI_CHROOT}" ]; then
|
||||
OPTIONS="${OPTIONS} --chroot ${UWSGI_CHROOT}"
|
||||
fi
|
||||
|
||||
if [ -n "${UWSGI_PROGRAM}" ]; then
|
||||
OPTIONS="${OPTIONS} --fileserve-mode ${UWSGI_PROGRAM}"
|
||||
fi
|
||||
|
||||
if [ -n "${UWSGI_XML_CONFIG}" ]; then
|
||||
OPTIONS="${OPTIONS} --xmlconfig ${UWSGI_XML_CONFIG}"
|
||||
fi
|
||||
|
||||
ebegin "Starting uWSGI application ${PROGNAME}"
|
||||
cd "${UWSGI_DIR}" && \
|
||||
start-stop-daemon --start --user "${UWSGI_USER}" --group "${UWSGI_GROUP}" \
|
||||
--exec "${UWSGI_EXEC}" -- ${OPTIONS} --pidfile "${PIDFILE}"
|
||||
return $?
|
||||
}
|
||||
|
||||
start() {
|
||||
if [ "${SVCNAME}" == "uwsgi" ]; then
|
||||
if [ -n "${UWSGI_EMPEROR_PATH}" ]; then
|
||||
start_emperor
|
||||
eend $?
|
||||
else
|
||||
eerror "You are not supposed to run this script directly unless you"
|
||||
eerror "want to run in Emperor mode. In that case please set the UWSGI_EMPEROR_PATH."
|
||||
eerror "Otherwise create a symlink for the uwsgi application you want to run as well as"
|
||||
eerror "a copy of the configuration file and modify it appropriately like so..."
|
||||
eerror
|
||||
eerror " ln -s uwsgi /etc/init.d/uwsgi.trac"
|
||||
eerror " cp /etc/conf.d/uwsgi /etc/conf.d/uwsgi.trac"
|
||||
eerror " nano /etc/conf.d/uwsgi.trac"
|
||||
eerror
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
start_app
|
||||
eend $?
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ -n "${UWSGI_EMPEROR_PATH}" ]; then
|
||||
ebegin "Stopping uWSGI emperor"
|
||||
else
|
||||
ebegin "Stopping uWSGI application ${PROGNAME}"
|
||||
fi
|
||||
start-stop-daemon --stop --signal QUIT --pidfile "${PIDFILE}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading uWSGI"
|
||||
start-stop-daemon --signal HUP --pidfile "${PIDFILE}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stats() {
|
||||
ebegin "Logging uWSGI statistics"
|
||||
start-stop-daemon --signal USR1 --pidfile "${PIDFILE}"
|
||||
eend $?
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user