Skip to content

Commit

Permalink
allow socket for unix:/
Browse files Browse the repository at this point in the history
  • Loading branch information
meringu committed Nov 28, 2016
1 parent 9e5418d commit e3861bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Definitions
- `:config_type` - configuration file type, default to `:ini`
- `:host` - hostname to run uWSGI on, default to `"127.0.0.1"`
- `:port` - port number to run uWSGI on, default to `8080`
- `:socket` - socket to listen on, default to `#{host}:#{port}`
- `:worker_processes` - number of uWSGI workers, default to `2`, should probably be relative to the number of CPUs
- `:app` - app to run on uwsgi, passed to --module parameted of uWSGI, default to `"main:app"`
- `:uid` - user-id to run uwsgi under, default to `"www-data"`
Expand Down
7 changes: 3 additions & 4 deletions definitions/uwsgi_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:pid_path => "/var/run/uwsgi-app.pid",
:host => "127.0.0.1",
:port => 8080,
:socket => nil,
:worker_processes => 2,
:app => "main:app",
:uid => "www-data",
Expand All @@ -29,8 +30,7 @@
# need to assign params to local vars as we can't pass params to nested definitions
home_path = params[:home_path]
pid_path = params[:pid_path]
host = params[:host]
port = params[:port]
socket = params[:socket] || "#{params[:host]}:#{params[:port]}"
worker_processes = params[:worker_processes]
app = params[:app]
uid = params[:uid]
Expand Down Expand Up @@ -62,8 +62,7 @@
options ({
:home_path => home_path,
:pid_path => pid_path,
:host => host,
:port => port,
:socket => socket,
:worker_processes => worker_processes,
:app => app,
:uid => uid,
Expand Down
2 changes: 1 addition & 1 deletion templates/default/sv-uwsgi-run.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
UWSGI=<%= @options[:uwsgi_bin] %>
ROOT=<%= @options[:home_path] %>
PID=<%= @options[:pid_path] %>
SOCKET=<%= @options[:host] %>:<%= @options[:port] %>
SOCKET=<%= @options[:socket] %>

if [ -f $PID ]; then kill -9 `cat $PID`; rm $PID; fi

Expand Down

0 comments on commit e3861bf

Please sign in to comment.