View | Details | Raw Unified | Return to bug 227445
Collapse All | Expand All

(-)uwsgi/files/uwsgi.in (-56 / +56 lines)
Lines 8-38 Link Here
8
#
8
#
9
# Add the following lines to /etc/rc.conf to enable uwsgi:
9
# Add the following lines to /etc/rc.conf to enable uwsgi:
10
#
10
#
11
# uwsgi_enable (bool):		Set it to "YES" to enable uwsgi
11
# uwsgi%%FLAVOR_POSTFIX%%_enable (bool):		Set it to "YES" to enable uwsgi
12
#				Default is "NO".
12
#				Default is "NO".
13
# uwsgi_socket (path/str):	Set the path to the uwsgi unix socket
13
# uwsgi%%FLAVOR_POSTFIX%%_socket (path/str):	Set the path to the uwsgi unix socket
14
#				Default is /tmp/uwsgi.sock.
14
#				Default is /tmp/uwsgi.sock.
15
# uwsgi_socket_mode (int):	Set the mode of the socket.
15
# uwsgi%%FLAVOR_POSTFIX%%_socket_mode (int):	Set the mode of the socket.
16
#				Default is 660.
16
#				Default is 660.
17
# uwsgi_socket_owner (str):	Set the owner of the socket.
17
# uwsgi%%FLAVOR_POSTFIX%%_socket_owner (str):	Set the owner of the socket.
18
#				Default is uwsgi:www.
18
#				Default is uwsgi:www.
19
# uwsgi_emperor (bool):		Set it to "YES" to run uwsgi in emperor mode
19
# uwsgi%%FLAVOR_POSTFIX%%_emperor (bool):		Set it to "YES" to run uwsgi in emperor mode
20
#				Default is "NO".
20
#				Default is "NO".
21
# uwsgi_configfile (path):	Set the path to the config file
21
# uwsgi%%FLAVOR_POSTFIX%%_configfile (path):	Set the path to the config file
22
#				Default is %%PREFIX%%/etc/uwsgi/uwsgi.ini.
22
#				Default is %%PREFIX%%/etc/uwsgi/uwsgi.ini.
23
# uwsgi_vassals_dir (path):	Set the path to the vassals directory
23
# uwsgi%%FLAVOR_POSTFIX%%_vassals_dir (path):	Set the path to the vassals directory
24
#				Default is %%PREFIX%%/etc/uwsgi/vassals.
24
#				Default is %%PREFIX%%/etc/uwsgi/vassals.
25
# uwsgi_logfile (path):		Set the path to the uwsgi log file
25
# uwsgi%%FLAVOR_POSTFIX%%_logfile (path):		Set the path to the uwsgi log file
26
#				Default is /var/log/uwsgi.log.
26
#				Default is /var/log/uwsgi.log.
27
# uwsgi_pidfile (path):		Set the path to the uwsgi pid file
27
# uwsgi%%FLAVOR_POSTFIX%%_pidfile (path):		Set the path to the uwsgi pid file
28
#				Default is /var/run/uwsgi.pid.
28
#				Default is /var/run/uwsgi.pid.
29
# uwsgi_uid (int):		Set the UID of the process to run with
29
# uwsgi%%FLAVOR_POSTFIX%%_uid (int):		Set the UID of the process to run with
30
#				Default is uwsgi.
30
#				Default is uwsgi.
31
# uwsgi_gid (int):		Set the GID of the process to run with
31
# uwsgi%%FLAVOR_POSTFIX%%_gid (int):		Set the GID of the process to run with
32
#				Default is uwsgi.
32
#				Default is uwsgi.
33
# uwsgi_flags (str):		Set the uwsgi command line arguments
33
# uwsgi%%FLAVOR_POSTFIX%%_flags (str):		Set the uwsgi command line arguments
34
#				Default is "-L".
34
#				Default is "-L".
35
# uwsgi_procname (str):		Define to "uWSGI" if you start uwsgi with
35
# uwsgi%%FLAVOR_POSTFIX%%_procname (str):		Define to "uWSGI" if you start uwsgi with
36
#				--auto-procname option.
36
#				--auto-procname option.
37
#
37
#
38
# If you would like to have multiple uWSGI instances running, you can
38
# If you would like to have multiple uWSGI instances running, you can
Lines 46-76 Link Here
46
46
47
. /etc/rc.subr
47
. /etc/rc.subr
48
48
49
name="uwsgi"
49
name="uwsgi%%FLAVOR_POSTFIX%%"
50
rcvar=uwsgi_enable
50
rcvar=uwsgi%%FLAVOR_POSTFIX%%_enable
51
51
52
load_rc_config $name
52
load_rc_config $name
53
53
54
command=%%PREFIX%%/bin/uwsgi-%%PYTHON_VER%%
54
command=%%PREFIX%%/bin/uwsgi-%%PYTHON_VER%%
55
55
56
: ${uwsgi_enable="NO"}
56
: ${uwsgi%%FLAVOR_POSTFIX%%_enable="NO"}
57
: ${uwsgi_socket="/tmp/${name}.sock"}
57
: ${uwsgi%%FLAVOR_POSTFIX%%_socket="/tmp/${name}.sock"}
58
: ${uwsgi_socket_mode="660"}
58
: ${uwsgi%%FLAVOR_POSTFIX%%_socket_mode="660"}
59
: ${uwsgi_socket_owner="uwsgi:www"}
59
: ${uwsgi%%FLAVOR_POSTFIX%%_socket_owner="uwsgi:www"}
60
: ${uwsgi_configfile="%%PREFIX%%/etc/uwsgi/uwsgi.ini"}
60
: ${uwsgi%%FLAVOR_POSTFIX%%_configfile="%%PREFIX%%/etc/uwsgi/${name}.ini"}
61
: ${uwsgi_profiles=""}
61
: ${uwsgi%%FLAVOR_POSTFIX%%_profiles=""}
62
: ${uwsgi_logfile="/var/log/${name}.log"}
62
: ${uwsgi%%FLAVOR_POSTFIX%%_logfile="/var/log/${name}.log"}
63
: ${uwsgi_pidfile="/var/run/${name}.pid"}
63
: ${uwsgi%%FLAVOR_POSTFIX%%_pidfile="/var/run/${name}.pid"}
64
: ${uwsgi_uid="uwsgi"}
64
: ${uwsgi%%FLAVOR_POSTFIX%%_uid="uwsgi"}
65
: ${uwsgi_gid="uwsgi"}
65
: ${uwsgi%%FLAVOR_POSTFIX%%_gid="uwsgi"}
66
: ${uwsgi_flags="-L"}
66
: ${uwsgi%%FLAVOR_POSTFIX%%_flags="-L"}
67
: ${uwsgi_emperor="NO"}
67
: ${uwsgi%%FLAVOR_POSTFIX%%_emperor="NO"}
68
: ${uwsgi_vassals_dir="%%PREFIX%%/etc/uwsgi/vassals"}
68
: ${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir="%%PREFIX%%/etc/uwsgi/vassals%%FLAVOR_POSTFIX%%"}
69
69
70
is_uwsgi_profile() {
70
is_uwsgi_profile() {
71
	local profile
71
	local profile
72
72
73
	for profile in $uwsgi_profiles; do
73
	for profile in $uwsgi%%FLAVOR_POSTFIX%%_profiles; do
74
		if [ "$profile" = "$1" ]; then
74
		if [ "$profile" = "$1" ]; then
75
			return 0
75
			return 0
76
		fi
76
		fi
Lines 79-107 Link Here
79
	return 1
79
	return 1
80
}
80
}
81
81
82
if [ -n "${uwsgi_profiles}" ]; then
82
if [ -n "${uwsgi%%FLAVOR_POSTFIX%%_profiles}" ]; then
83
	if [ -n "$2" ]; then
83
	if [ -n "$2" ]; then
84
		profile="$2"
84
		profile="$2"
85
		if ! is_uwsgi_profile $profile; then
85
		if ! is_uwsgi_profile $profile; then
86
			echo "$0: no such profile defined in uwsgi_profiles."
86
			echo "$0: no such profile defined in uwsgi%%FLAVOR_POSTFIX%%_profiles."
87
		        exit 1
87
		        exit 1
88
		fi
88
		fi
89
		eval uwsgi_socket=\${uwsgi_${profile}_socket:-"/tmp/${name}-${profile}.sock"}
89
		eval uwsgi%%FLAVOR_POSTFIX%%_socket=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_socket:-"/tmp/${name}-${profile}.sock"}
90
		eval uwsgi_socket_mode=\${uwsgi_${profile}_socket_mode:-${uwsgi_socket_mode}}
90
		eval uwsgi%%FLAVOR_POSTFIX%%_socket_mode=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_socket_mode:-${uwsgi%%FLAVOR_POSTFIX%%_socket_mode}}
91
		eval uwsgi_socket_owner=\${uwsgi_${profile}_socket_owner:-${uwsgi_socket_owner}}
91
		eval uwsgi%%FLAVOR_POSTFIX%%_socket_owner=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_socket_owner:-${uwsgi%%FLAVOR_POSTFIX%%_socket_owner}}
92
		eval uwsgi_logfile=\${uwsgi_${profile}_logfile:-"/var/log/${name}-${profile}.log"}
92
		eval uwsgi%%FLAVOR_POSTFIX%%_logfile=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_logfile:-"/var/log/${name}-${profile}.log"}
93
		eval uwsgi_pidfile=\${uwsgi_${profile}_pidfile:-"/var/run/${name}-${profile}.pid"}
93
		eval uwsgi%%FLAVOR_POSTFIX%%_pidfile=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_pidfile:-"/var/run/${name}-${profile}.pid"}
94
		eval uwsgi_uid=\${uwsgi_${profile}_uid:-"${uwsgi_uid}"}
94
		eval uwsgi%%FLAVOR_POSTFIX%%_uid=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_uid:-"${uwsgi%%FLAVOR_POSTFIX%%_uid}"}
95
		eval uwsgi_gid=\${uwsgi_${profile}_gid:-"${uwsgi_uid}"}
95
		eval uwsgi%%FLAVOR_POSTFIX%%_gid=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_gid:-"${uwsgi%%FLAVOR_POSTFIX%%_uid}"}
96
		eval uwsgi_flags=\${uwsgi_${profile}_flags:-"${uwsgi_flags}"}
96
		eval uwsgi%%FLAVOR_POSTFIX%%_flags=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_flags:-"${uwsgi%%FLAVOR_POSTFIX%%_flags}"}
97
		eval uwsgi_procname=\${uwsgi_${profile}_procname:-"${uwsgi_procname}"}
97
		eval uwsgi%%FLAVOR_POSTFIX%%_procname=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_procname:-"${uwsgi%%FLAVOR_POSTFIX%%_procname}"}
98
		eval uwsgi_emperor=\${uwsgi_${profile}_emperor:-"${uwsgi_emperor}"}
98
		eval uwsgi%%FLAVOR_POSTFIX%%_emperor=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_emperor:-"${uwsgi%%FLAVOR_POSTFIX%%_emperor}"}
99
		eval uwsgi_vassals_dir=\${uwsgi_${profile}_vassals_dir:-"${uwsgi_vassals_dir}"}
99
		eval uwsgi%%FLAVOR_POSTFIX%%_vassals_dir=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_vassals_dir:-"${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir}"}
100
		eval uwsgi_configfile=\${uwsgi_${profile}_configfile:-"${uwsgi_configfile}"}
100
		eval uwsgi%%FLAVOR_POSTFIX%%_configfile=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_configfile:-"${uwsgi%%FLAVOR_POSTFIX%%_configfile}"}
101
	elif [ -n "$1" ]; then
101
	elif [ -n "$1" ]; then
102
		for profile in ${uwsgi_profiles}; do
102
		for profile in ${uwsgi_profiles}; do
103
			echo "Processing ${name} profile: ${profile}"
103
			echo "Processing ${name} profile: ${profile}"
104
			%%PREFIX%%/etc/rc.d/uwsgi $1 ${profile}
104
			%%PREFIX%%/etc/rc.d/uwsgi-%%FLAVOR%% $1 ${profile}
105
		done
105
		done
106
		exit 0
106
		exit 0
107
	fi
107
	fi
Lines 119-145 Link Here
119
start_precmd()
119
start_precmd()
120
{
120
{
121
	rc_flags=""
121
	rc_flags=""
122
	if [ -e ${uwsgi_configfile} ]; then
122
	if [ -e ${uwsgi%%FLAVOR_POSTFIX%%_configfile} ]; then
123
		rc_flags="--ini ${uwsgi_configfile} "
123
		rc_flags="--ini ${uwsgi%%FLAVOR_POSTFIX%%_configfile} "
124
	fi
124
	fi
125
125
126
	if checkyesno uwsgi_emperor; then
126
	if checkyesno uwsgi%%FLAVOR_POSTFIX%%_emperor; then
127
		echo "Running uWSGI as Emperor. Vassals loaded from "$uwsgi_vassals_dir
127
		echo "Running uWSGI as Emperor. Vassals loaded from "$uwsgi%%FLAVOR_POSTFIX%%_vassals_dir
128
		required_dirs=${uwsgi_vassals_dir}
128
		required_dirs=${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir}
129
		rc_flags=${rc_flags}"--emperor-pidfile ${uwsgi_pidfile} -d ${uwsgi_logfile} --emperor ${uwsgi_vassals_dir}"
129
		rc_flags=${rc_flags}"--emperor-pidfile ${uwsgi%%FLAVOR_POSTFIX%%_pidfile} -d ${uwsgi%%FLAVOR_POSTFIX%%_logfile} --emperor ${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir}"
130
		rc_flags=${rc_flags}" --vassals-set uid=${uwsgi_uid} --vassals-set gid=${uwsgi_gid}"
130
		rc_flags=${rc_flags}" --vassals-set uid=${uwsgi%%FLAVOR_POSTFIX%%_uid} --vassals-set gid=${uwsgi%%FLAVOR_POSTFIX%%_gid}"
131
		rc_flags=${rc_flags}" --vassals-set chmod-socket=${uwsgi_socket_mode} --vassals-set chown-socket=${uwsgi_socket_owner}"
131
		rc_flags=${rc_flags}" --vassals-set chmod-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_mode} --vassals-set chown-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_owner}"
132
	else
132
	else
133
		rc_flags=${rc_flags}"--master  --uid ${uwsgi_uid} --gid ${uwsgi_gid} --pidfile ${uwsgi_pidfile} -d ${uwsgi_logfile}"
133
		rc_flags=${rc_flags}"--master  --uid ${uwsgi%%FLAVOR_POSTFIX%%_uid} --gid ${uwsgi%%FLAVOR_POSTFIX%%_gid} --pidfile ${uwsgi%%FLAVOR_POSTFIX%%_pidfile} -d ${uwsgi%%FLAVOR_POSTFIX%%_logfile}"
134
		rc_flags=${rc_flags}" -s ${uwsgi_socket} --chmod-socket=${uwsgi_socket_mode} --chown-socket=${uwsgi_socket_owner}"
134
		rc_flags=${rc_flags}" -s ${uwsgi%%FLAVOR_POSTFIX%%_socket} --chmod-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_mode} --chown-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_owner}"
135
	fi
135
	fi
136
136
137
	rc_flags=${rc_flags}" ${uwsgi_flags}"
137
	rc_flags=${rc_flags}" ${uwsgi%%FLAVOR_POSTFIX%%_flags}"
138
}
138
}
139
139
140
stop_postcmd()
140
stop_postcmd()
141
{
141
{
142
	rm -f ${uwsgi_pidfile} ${uwsgi_socket}
142
	rm -f ${uwsgi%%FLAVOR_POSTFIX%%_pidfile} ${uwsgi%%FLAVOR_POSTFIX%%_socket}
143
}
143
}
144
144
145
reload_precmd()
145
reload_precmd()
(-)uwsgi/Makefile (-4 / +14 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	uwsgi
4
PORTNAME=	uwsgi
5
PORTVERSION=	2.0.16
5
PORTVERSION=	2.0.16
6
PORTREVISION=	1
6
CATEGORIES=	www python
7
CATEGORIES=	www python
8
PKGNAMEPREFIX=  ${PYTHON_PKGNAMEPREFIX}
7
MASTER_SITES=	http://projects.unbit.it/downloads/
9
MASTER_SITES=	http://projects.unbit.it/downloads/
8
10
9
MAINTAINER=	eugene@zhegan.in
11
MAINTAINER=	eugene@zhegan.in
Lines 12-20 Link Here
12
LICENSE=	GPLv2
14
LICENSE=	GPLv2
13
LICENSE_FILE=	${WRKSRC}/LICENSE
15
LICENSE_FILE=	${WRKSRC}/LICENSE
14
16
15
USES=		pkgconfig python ssl
17
USES=		pkgconfig python ssl gettext-runtime
16
USE_PYTHON=	distutils concurrent optsuffix
18
USE_PYTHON=	distutils concurrent allflavors
17
USE_RC_SUBR=	uwsgi
18
19
19
CFLAGS+=	-I${OPENSSLINC}
20
CFLAGS+=	-I${OPENSSLINC}
20
LDFLAGS+=	${OPENSSL_LDFLAGS}
21
LDFLAGS+=	${OPENSSL_LDFLAGS}
Lines 28-36 Link Here
28
GROUPS=		uwsgi
29
GROUPS=		uwsgi
29
30
30
PLIST_FILES=	bin/uwsgi \
31
PLIST_FILES=	bin/uwsgi \
32
		etc/rc.d/uwsgi${PYTHON_PKGNAMESUFFIX} \
31
		${PYTHON_SITELIBDIR}/uwsgidecorators.py
33
		${PYTHON_SITELIBDIR}/uwsgidecorators.py
32
34
33
SUB_LIST=	PYTHON_VER=${PYTHON_VER}
35
SUB_LIST=	PYTHON_VER=${PYTHON_VER}
36
SUB_FILES+=	uwsgi	
34
37
35
OPTIONS_DEFINE=	DEBUG JSON PCRE XML
38
OPTIONS_DEFINE=	DEBUG JSON PCRE XML
36
39
Lines 53-58 Link Here
53
56
54
LIB_DEPENDS+=	libjansson.so:devel/jansson libpcre.so:devel/pcre libxml2.so:textproc/libxml2
57
LIB_DEPENDS+=	libjansson.so:devel/jansson libpcre.so:devel/pcre libxml2.so:textproc/libxml2
55
58
59
.if "${FLAVOR}" == "${FLAVORS:[1]}"
60
     SUB_LIST += FLAVOR_POSTFIX=""
61
.else
62
     SUB_LIST += FLAVOR_POSTFIX=_${FLAVOR}
63
.endif 
64
56
.include <bsd.port.options.mk>
65
.include <bsd.port.options.mk>
57
66
58
post-patch:
67
post-patch:
Lines 67-73 Link Here
67
	@${DO_NADA}
76
	@${DO_NADA}
68
77
69
do-install:
78
do-install:
70
	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
79
	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/uwsgi
80
	${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/etc/rc.d/uwsgi${PYTHON_PKGNAMESUFFIX}
71
	@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
81
	@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
72
	${INSTALL_DATA} ${WRKSRC}/uwsgidecorators.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
82
	${INSTALL_DATA} ${WRKSRC}/uwsgidecorators.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
73
83

Return to bug 227445