Commit 7f62c5bfc4501819593e1130d8eecaae5f932297
1 parent
eb3d2e2c
Exists in
master
and in
29 other branches
debian: switch to unicorn
Showing
13 changed files
with
29 additions
and
70 deletions
Show diff stats
debian/apache2/conf.d/noosfero-cluster.conf
debian/apache2/virtualhost.conf
@@ -15,7 +15,11 @@ RewriteRule ^/$ /index.html [QSA] | @@ -15,7 +15,11 @@ RewriteRule ^/$ /index.html [QSA] | ||
15 | RewriteRule ^([^.]+)$ $1.html [QSA] | 15 | RewriteRule ^([^.]+)$ $1.html [QSA] |
16 | 16 | ||
17 | RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | 17 | RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f |
18 | -RewriteRule ^.*$ balancer://noosfero%{REQUEST_URI} [P,QSA,L] | 18 | +RewriteRule ^.*$ http://127.0.0.1:50000%{REQUEST_URI} [P,QSA,L] |
19 | +<Proxy http://127.0.0.1:50000> | ||
20 | + Order Allow,Deny | ||
21 | + Allow from All | ||
22 | +</Proxy> | ||
19 | 23 | ||
20 | ErrorDocument 503 /503.html | 24 | ErrorDocument 503 /503.html |
21 | 25 |
debian/control
@@ -65,7 +65,7 @@ Depends: adduser, | @@ -65,7 +65,7 @@ Depends: adduser, | ||
65 | ruby-whenever, | 65 | ruby-whenever, |
66 | ruby-will-paginate (>= 2.3.12-1~), | 66 | ruby-will-paginate (>= 2.3.12-1~), |
67 | tango-icon-theme, | 67 | tango-icon-theme, |
68 | - thin, | 68 | + unicorn (>= 4.8), |
69 | ${misc:Depends} | 69 | ${misc:Depends} |
70 | Recommends: postgresql, postgresql-client | 70 | Recommends: postgresql, postgresql-client |
71 | Description: free web-based platform for social networks | 71 | Description: free web-based platform for social networks |
debian/noosfero-apache.install
debian/noosfero.install
@@ -19,7 +19,7 @@ debian/noosfero-check-dbconfig usr/sbin | @@ -19,7 +19,7 @@ debian/noosfero-check-dbconfig usr/sbin | ||
19 | debian/noosfero-console usr/sbin | 19 | debian/noosfero-console usr/sbin |
20 | debian/noosfero-runner usr/sbin | 20 | debian/noosfero-runner usr/sbin |
21 | debian/noosfero.yml etc/noosfero | 21 | debian/noosfero.yml etc/noosfero |
22 | -debian/thin.yml etc/noosfero | 22 | +debian/unicorn.rb etc/noosfero |
23 | doc usr/share/noosfero | 23 | doc usr/share/noosfero |
24 | doc/noosfero usr/share/noosfero/doc | 24 | doc/noosfero usr/share/noosfero/doc |
25 | etc/init.d/noosfero etc/init.d | 25 | etc/init.d/noosfero etc/init.d |
debian/noosfero.links
1 | var/tmp/noosfero usr/share/noosfero/tmp | 1 | var/tmp/noosfero usr/share/noosfero/tmp |
2 | var/log/noosfero usr/share/noosfero/log | 2 | var/log/noosfero usr/share/noosfero/log |
3 | etc/noosfero/database.yml usr/share/noosfero/config/database.yml | 3 | etc/noosfero/database.yml usr/share/noosfero/config/database.yml |
4 | -etc/noosfero/thin.yml usr/share/noosfero/config/thin.yml | 4 | +etc/noosfero/unicorn.rb usr/share/noosfero/config/unicorn.rb |
5 | etc/noosfero/plugins usr/share/noosfero/config/plugins | 5 | etc/noosfero/plugins usr/share/noosfero/config/plugins |
6 | etc/noosfero/noosfero.yml usr/share/noosfero/config/noosfero.yml | 6 | etc/noosfero/noosfero.yml usr/share/noosfero/config/noosfero.yml |
7 | etc/noosfero/local.rb usr/share/noosfero/config/local.rb | 7 | etc/noosfero/local.rb usr/share/noosfero/config/local.rb |
debian/noosfero.postinst
@@ -10,23 +10,23 @@ makedir() { | @@ -10,23 +10,23 @@ makedir() { | ||
10 | } | 10 | } |
11 | 11 | ||
12 | 12 | ||
13 | -# migrate mongrel configuration to thin | ||
14 | -mongrel_config=/etc/noosfero/mongrel_cluster.yml | 13 | +# migrate thin configuration to unicorn |
14 | +unicorn_config=/etc/noosfero/unicorn.rb | ||
15 | thin_config=/etc/noosfero/thin.yml | 15 | thin_config=/etc/noosfero/thin.yml |
16 | -mongrel_orig_sha1=602c642c03f79349969c08330112a6f29d4c32aa | ||
17 | -if [ -r $mongrel_config ]; then | ||
18 | - mongrel_sha1=$(sha1sum $mongrel_config | awk '{print $1}') | ||
19 | - if [ "$mongrel_sha1" != "$mongrel_orig_sha1" ]; then | ||
20 | - port=$(awk '{ if ($1 == "port:") { print($2) } }' $mongrel_config) | ||
21 | - servers=$(awk '{ if ($1 == "servers:") { print($2) } }' $mongrel_config) | 16 | +thin_orig_sha1=47cee6728a7896a13f4d66544086ab88b02e89a7 |
17 | +if [ -r $thin_config ]; then | ||
18 | + thin_sha1=$(sha1sum $thin_config | awk '{print $1}') | ||
19 | + if [ "$thin_sha1" != "$thin_orig_sha1" ]; then | ||
20 | + port=$(awk '{ if ($1 == "port:") { print($2) } }' $thin_config) | ||
21 | + servers=$(awk '{ if ($1 == "servers:") { print($2) } }' $thin_config) | ||
22 | if test -n "$port" && test "$port" -ne 50000 || test -n "$servers" && test "$servers" -ne 1 ; then | 22 | if test -n "$port" && test "$port" -ne 50000 || test -n "$servers" && test "$servers" -ne 1 ; then |
23 | - # mongrel configuration was changed; update thin configuration | 23 | + # thin configuration was changed; update unicorn configuration |
24 | # accordingly | 24 | # accordingly |
25 | - sed -i -e "s/port: .*/port: $port/" $thin_config | ||
26 | - sed -i -e "s/servers: .*/servers: $servers/" $thin_config | 25 | + sed -i -e "s/listen.*/listen '127.0.0.1:$port'/" $unicorn_config |
26 | + sed -i -e "s/worker_processes.*/worker_processes $servers/" $unicorn_config | ||
27 | fi | 27 | fi |
28 | fi | 28 | fi |
29 | - mv $mongrel_config $mongrel_config.bak | 29 | + mv $thin_config $thin_config.bak |
30 | fi | 30 | fi |
31 | 31 | ||
32 | # create user noosfero in a portable way, while creating the log directory. | 32 | # create user noosfero in a portable way, while creating the log directory. |
debian/thin.yml
debian/update-noosfero-apache
@@ -2,20 +2,9 @@ | @@ -2,20 +2,9 @@ | ||
2 | 2 | ||
3 | set -e | 3 | set -e |
4 | 4 | ||
5 | -# automatically update configuration, but if package noosfero is also installed | 5 | +# automatically update configuration, but only if package noosfero is also |
6 | +# installed | ||
6 | if test -x /usr/share/noosfero/script/apacheconf; then | 7 | if test -x /usr/share/noosfero/script/apacheconf; then |
7 | - datadir="/etc/noosfero/apache" | ||
8 | - mongrel_file="$datadir/mongrel.conf" | ||
9 | - cluster_file="$datadir/cluster.conf" | ||
10 | - if test -e "$cluster_file"; then | ||
11 | - echo "Overwriting $cluster_file ..." | ||
12 | - fi | ||
13 | - /usr/share/noosfero/script/apacheconf thin > "$cluster_file" | ||
14 | - if test -e "$mongrel_file"; then | ||
15 | - echo "Moving existing $mongrel_file away ..." | ||
16 | - mv "$mongrel_file" "$mongrel_file".bak | ||
17 | - (cd $datadir && ln -sf cluster.conf mongrel.conf) | ||
18 | - fi | ||
19 | 8 | ||
20 | apache_site='/etc/apache2/sites-available/noosfero' | 9 | apache_site='/etc/apache2/sites-available/noosfero' |
21 | if ! test -e "$apache_site"; then | 10 | if ! test -e "$apache_site"; then |
script/apacheconf
1 | #!/usr/bin/env ruby | 1 | #!/usr/bin/env ruby |
2 | 2 | ||
3 | -def mongrel_thin(config_file) | ||
4 | - require 'yaml' | ||
5 | - config = YAML.load_file(config_file) | ||
6 | - ip = config['address'] || '127.0.0.1' | ||
7 | - servers = config['servers'] || 1 | ||
8 | - ports = port_range = config['port']..(config['port'] + servers - 1) | ||
9 | - ports.each do |port| | ||
10 | - puts "BalancerMember http://#{ip}:#{port}" | ||
11 | - end | ||
12 | -end | ||
13 | - | ||
14 | case ARGV.first | 3 | case ARGV.first |
15 | -when 'mongrel' | ||
16 | - mongrel_thin(File.dirname(__FILE__) + "/../config/mongrel_cluster.yml") | ||
17 | -when 'thin' | ||
18 | - mongrel_thin(File.dirname(__FILE__) + "/../config/thin.yml") | ||
19 | when 'virtualhosts' | 4 | when 'virtualhosts' |
20 | require File.dirname(__FILE__) + '/../config/environment' | 5 | require File.dirname(__FILE__) + '/../config/environment' |
21 | Environment.all.each do |environment| | 6 | Environment.all.each do |environment| |
@@ -38,6 +23,6 @@ when 'virtualhosts' | @@ -38,6 +23,6 @@ when 'virtualhosts' | ||
38 | end | 23 | end |
39 | puts "# vim: ft=apache" | 24 | puts "# vim: ft=apache" |
40 | else | 25 | else |
41 | - puts "usage: %s mongrel|thin|virtualhosts" % $PROGRAM_NAME | 26 | + puts "usage: %s virtualhosts" % $PROGRAM_NAME |
42 | exit 1 | 27 | exit 1 |
43 | end | 28 | end |
script/install-dependencies/debian-wheezy.sh
@@ -72,8 +72,8 @@ run sudo apt-get -qy dist-upgrade | @@ -72,8 +72,8 @@ run sudo apt-get -qy dist-upgrade | ||
72 | 72 | ||
73 | run sudo apt-get -y install dctrl-tools | 73 | run sudo apt-get -y install dctrl-tools |
74 | 74 | ||
75 | -# *sigh* need ruby-rspec from backports | ||
76 | -run sudo apt-get -y install -t wheezy-backports ruby-rspec | 75 | +# need these from backports |
76 | +run sudo apt-get -y install -t wheezy-backports ruby-rspec unicorn | ||
77 | 77 | ||
78 | # needed to run noosfero | 78 | # needed to run noosfero |
79 | packages=$(grep-dctrl -n -s Build-Depends,Depends,Recommends -S -X noosfero debian/control | sed -e '/^\s*#/d; s/([^)]*)//g; s/,\s*/\n/g' | grep -v 'memcached\|debconf\|dbconfig-common\|misc:Depends\|adduser\|mail-transport-agent') | 79 | packages=$(grep-dctrl -n -s Build-Depends,Depends,Recommends -S -X noosfero debian/control | sed -e '/^\s*#/d; s/([^)]*)//g; s/,\s*/\n/g' | grep -v 'memcached\|debconf\|dbconfig-common\|misc:Depends\|adduser\|mail-transport-agent') |
util/debian-install/test