Skip to content

Instantly share code, notes, and snippets.

@rugginoso
Created August 6, 2013 00:22
Show Gist options
  • Save rugginoso/6160896 to your computer and use it in GitHub Desktop.
Save rugginoso/6160896 to your computer and use it in GitHub Desktop.
uWSGI Emperor + FastRouter + SubscriptionServer + HTTP + SystemD
[uwsgi]
# Gemeric app
declare-option = app=master=true;socket=/run/uwsgi/$1.sock;chmod-socket=660;vacuum=true;auto-procname=true;procname-prefix-spaced=$1;cheap=true;idle=60ksm=true
# Django
declare-option = django=venv=$1venv;pythonpath=$1;chdir=$1;module=$2.wsgi
# Fastrouter subscription
declare-option = add-domain=subscribe-to=127.0.0.1:12345:$1
# logging
declare-option = log=disable-logging=true;log-truncate=true;logto=$1
[uwsgi]
xml = false
yaml = false
json = false
zeromq = false
ssl = true
pcre = true
routing = true
matheval = auto
debug = false
unbit = false
malloc_implementation = libc
plugins = python, ping, cache, http, corerouter, fastrouter, ugreen, signal, router_uwsgi, router_redirect, router_basicauth, router_rewrite, router_http, router_cache, router_static, sslrouter, spooler, cheaper_busyness, symcall, transformation_tofile, transformation_gzip, transformation_chunked, transformation_offload, router_memcached, router_hash, systemd_logger
bin_name = /usr/local/bin/uwsgi
append_version =
plugin_dir = /usr/local/lib/uwsgi
embedded_plugins =
as_shared_library = false
[uwsgi]
emperor = /srv/http/*/uwsgi.ini
emperor-tyrant = true
master = true
auto-procname = true
uid = http
gid = http
cap = setgid,setuid
vassals-inherit = /etc/uwsgi/apps.ini
[Unit]
Description=uWSGI Emperor Service
After=syslog.target
[Service]
ExecStartPre=/bin/mkdir -p /run/uwsgi
ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi/emperor.ini
SuccessExitStatus=30
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT
Restart=always
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
[uwsgi]
plugins = http,fastrouter
shared-socket = :80
http = =0
http-to = /run/uwsgi/fastrouter.sock
fastrouter = /run/uwsgi/fastrouter.sock
fastrouter-subscription-server = 127.0.0.1:12345
master = true
uid = http
gid = http
auto-procname = true
vacuum = true
[Unit]
Description=uWSGI Fastrouter Service
After=syslog.target
[Service]
ExecStartPre=/bin/mkdir -p /run/uwsgi
ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi/fastrouter.ini
SuccessExitStatus=30
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT
Restart=always
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
[uwsgi]
plugins = python,router_static
projectname = test
projectdomain = test.example.com
processes = 2
threads = 5
app = %(projectname)
django = %d %(projectname)
add-domain = %(projectdomain)
log = %dlogs/uwsgi.log
route = /static/(.+) static:%d%c/static/$1
route = /media/(.+) static:%d%c/media/$1
@ldesiqueira
Copy link

Beautiful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment