|
|
@@ -27,14 +27,22 @@ node precise64 {
|
|
27
|
27
|
include python_dependencies
|
|
28
|
28
|
include userconfig
|
|
29
|
29
|
|
|
30
|
|
- # Apache
|
|
|
30
|
+ # Apache serving WSGI on port 80 (would prefer 8081)
|
|
31
|
31
|
class {"apache": }
|
|
32
|
32
|
class {"apache::mod::wsgi": }
|
|
33
|
33
|
file {"/etc/apache2/sites-enabled/vagrant.conf":
|
|
34
|
34
|
source => "/vagrant/sites/sandbox/deploy/apache2/vagrant.conf"
|
|
35
|
35
|
}
|
|
36
|
36
|
|
|
37
|
|
- # Nginx in front of Apache
|
|
|
37
|
+ # gunicorn serving WSGI on unix socket
|
|
|
38
|
+ class { "python::gunicorn": owner => "root", group => "root" }
|
|
|
39
|
+ python::gunicorn::instance { "oscar":
|
|
|
40
|
+ venv => "/var/www/virtualenv",
|
|
|
41
|
+ django => true,
|
|
|
42
|
+ src => "/vagrant/sites/sandbox",
|
|
|
43
|
+ }
|
|
|
44
|
+
|
|
|
45
|
+ # Nginx in front of Apache (port 9001)
|
|
38
|
46
|
class { "nginx": }
|
|
39
|
47
|
nginx::resource::vhost { 'apache_rp':
|
|
40
|
48
|
ensure => present,
|
|
|
@@ -51,6 +59,28 @@ node precise64 {
|
|
51
|
59
|
},
|
|
52
|
60
|
}
|
|
53
|
61
|
|
|
|
62
|
+ # Nginx in front of gunicorn (port 9002)
|
|
|
63
|
+ nginx::resource::vhost { 'gunicorn_rp':
|
|
|
64
|
+ ensure => present,
|
|
|
65
|
+ listen_port => 9002,
|
|
|
66
|
+ }
|
|
|
67
|
+ nginx::resource::location { 'gunicorn-root':
|
|
|
68
|
+ ensure => present,
|
|
|
69
|
+ vhost => 'gunicorn_rp',
|
|
|
70
|
+ location => '/',
|
|
|
71
|
+ proxy => 'http://app1',
|
|
|
72
|
+ proxy_set_headers => {
|
|
|
73
|
+ 'REMOTE_ADDR' => '$remote_addr',
|
|
|
74
|
+ 'HTTP_HOST' => '$http_host',
|
|
|
75
|
+ },
|
|
|
76
|
+ }
|
|
|
77
|
+ nginx::resource::upstream { 'app1':
|
|
|
78
|
+ ensure => present,
|
|
|
79
|
+ members => [
|
|
|
80
|
+ 'unix:/run/gunicorn/oscar.sock weight=10',
|
|
|
81
|
+ ],
|
|
|
82
|
+ }
|
|
|
83
|
+
|
|
54
|
84
|
# Memcached
|
|
55
|
85
|
class {"memcached": max_memory => 64 }
|
|
56
|
86
|
|