Skip to content

Commit 5545359

Browse files
committed
Expose user/group config to configure gunicorn
gunicorn setup was forcing users to run their processes with the user www-data which isn't available in all distributions (for instance Fedora Linux) and it's a good practice to run each website under different users to reduce security issues
1 parent c5c324b commit 5545359

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

manifests/gunicorn.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
# dir => '/var/www/project1/current',
3838
# bind => 'unix:/tmp/gunicorn.socket',
3939
# environment => 'prod',
40+
# owner => 'www-data',
41+
# group => 'www-data',
4042
# template => 'python/gunicorn.erb',
4143
# }
4244
#
@@ -53,6 +55,8 @@
5355
$dir = false,
5456
$bind = false,
5557
$environment = false,
58+
$owner = 'www-data',
59+
$group = 'www-data',
5660
$template = 'python/gunicorn.erb',
5761
) {
5862

templates/gunicorn.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ CONFIG = {
1313
},
1414
<% end -%>
1515
'working_dir': '<%= @dir %>',
16-
'user': 'www-data',
17-
'group': 'www-data',
16+
'user': '<%= @owner %>',
17+
'group': '<%= @group %>',
1818
<% if @virtualenv -%>
1919
'python': '<%= @virtualenv %>/bin/python',
2020
<% else -%>

0 commit comments

Comments
 (0)