Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ redhat init.d or upstart depending on the service provider.
The location of the uwsgi config file.
Default: '/etc/uwsgi.ini'

* `log_dir`
The location of the uwsgi emperor log.
Default: '/var/log/uwsgi/uwsgi-emperor.log'

* `app_directory`
Vassal directory for application config files.

Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
# [*config_file*]
# The location of the uwsgi config file. Default: '/etc/uwsgi.ini'
#
# [*log_file*]
# The location of the uwsgi emperor log.
# Default: '/var/log/uwsgi/uwsgi-emperor.log'
#
# [*app_directory*]
# Vassal directory for application config files
#
Expand Down Expand Up @@ -88,6 +92,7 @@
$service_provider = $uwsgi::params::service_provider,
$manage_service_file = $uwsgi::params::manage_service_file,
$config_file = $uwsgi::params::config_file,
$log_file = $uwsgi::params::log_file,
$app_directory = $uwsgi::params::app_directory,
$install_pip = $uwsgi::params::install_pip,
$install_python_dev = $uwsgi::params::install_python_dev,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$config_file = '/etc/uwsgi.ini'
$install_pip = true
$install_python_dev = true
$log_file = '/var/log/uwsgi/uwsgi-emperor.log'
$python_pip = 'python-pip'

case $::osfamily {
Expand Down
2 changes: 1 addition & 1 deletion templates/uwsgi.ini.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ emperor-tyrant = true
master = true
autoload = true
log-date = true
logto = /var/log/uwsgi/uwsgi-emperor.log
logto = <%= @log_file %>
<%
if @emperor_options
@emperor_options.sort.each do |key, value|
Expand Down
10 changes: 9 additions & 1 deletion templates/uwsgi_service-redhat.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@
# Source function library.
. /etc/rc.d/init.d/functions

OPTIONS="--daemonize --die-on-term --ini <%= @config_file %>"
UWSGILOG="<%= @log_file %>"
UWSGIPID="<%= @pidfile %>"
UWSGISOCKET="<%= @socket %>"

OPTIONS="--daemonize "${UWSGILOG}" --die-on-term --ini <%= @config_file %>"

UWSGILOGDIR="${UWSGILOG%/*}"
UWSGIPIDDIR="${UWSGIPID%/*}"
UWSGISOCKETDIR="${UWSGISOCKET%/*}"

[ -f /etc/sysconfig/uwsgi ] && . /etc/sysconfig/uwsgi

if [ ! -d "${UWSGILOGDIR}" ]; then
mkdir -p "${UWSGILOGDIR}"
[ -n "${RUNAS}" ] && chown "${RUNAS}:" "${UWSGILOGDIR}"
fi

if [ ! -d "${UWSGIPIDDIR}" ]; then
mkdir -p "${UWSGIPIDDIR}"
[ -n "${RUNAS}" ] && chown "${RUNAS}:" "${UWSGIPIDDIR}"
Expand Down
4 changes: 3 additions & 1 deletion templates/uwsgi_upstart.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ stop on runlevel [!2345]
respawn

pre-start script
uwsgilog="<%= @log_file %>"
uwsgipid="<%= @pidfile %>"
uwsgisocket="<%= @socket %>"
uwsgilogddir="${uwsgilogd%/*}"
uwsgipiddir="${uwsgipid%/*}"
uwsgisocketdir="${uwsgisocket%/*}"
mkdir -p "$uwsgipiddir"
mkdir -p "$uwsgisocketdir"
mkdir -p /var/log/uwsgi
mkdir -p "$uwsgilogdir"
end script
exec uwsgi --die-on-term --ini <%= @config_file %>