Commit 8cdcabac76d98ea9f3f7dbe0c565348de28251df

Authored by Sergio Oliveira
Committed by Luciano Prestes
1 parent 1cfa1503

Fixed colab collectstatic

Signed-off-by: Daniel Henrique <danielhmarinho@gmail.com>
Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com>
Signed-off-by: Sergio Oliveira <seocam@seocam.com>
cookbooks/colab/recipes/default.rb
@@ -11,6 +11,11 @@ if node[&#39;platform&#39;] == &#39;centos&#39; @@ -11,6 +11,11 @@ if node[&#39;platform&#39;] == &#39;centos&#39;
11 end 11 end
12 end 12 end
13 13
  14 +# remove link left behind by old colab packages
  15 +file '/usr/share/nginx/colab' do
  16 + action :delete
  17 +end
  18 +
14 package 'colab' do 19 package 'colab' do
15 action :upgrade 20 action :upgrade
16 notifies :restart, 'service[colab]' 21 notifies :restart, 'service[colab]'
@@ -185,6 +190,11 @@ execute &#39;colab-mailman-group&#39; do @@ -185,6 +190,11 @@ execute &#39;colab-mailman-group&#39; do
185 command "usermod -a -G mailman colab" 190 command "usermod -a -G mailman colab"
186 end 191 end
187 192
  193 +# Collect static is here instead of colab.spec because
  194 +# plugins might provide their own static files, as
  195 +# the package don't know about installed plugins
  196 +# collectstatic needs to run after package install
  197 +# and plugins instantiated. Same for migrate.
188 execute 'colab-admin migrate' 198 execute 'colab-admin migrate'
189 execute 'colab-admin:collectstatic' do 199 execute 'colab-admin:collectstatic' do
190 command 'colab-admin collectstatic --noinput' 200 command 'colab-admin collectstatic --noinput'
cookbooks/colab/templates/colab.conf.erb
@@ -11,12 +11,14 @@ server { @@ -11,12 +11,14 @@ server {
11 error_log /var/log/nginx/colab.error.log; 11 error_log /var/log/nginx/colab.error.log;
12 client_max_body_size 0; 12 client_max_body_size 0;
13 13
  14 + # FIXME: Favico should be at right place and this
  15 + # code should be removed.
14 location ~ ^/static/img/fav\.[^.]+\.ico$ { 16 location ~ ^/static/img/fav\.[^.]+\.ico$ {
15 alias /var/lib/colab/assets/spb/fav.ico; 17 alias /var/lib/colab/assets/spb/fav.ico;
16 } 18 }
17 19
18 location / { 20 location / {
19 - root /usr/share/nginx/colab; 21 + root /var/lib/colab/assets/;
20 try_files $uri @colab-app; 22 try_files $uri @colab-app;
21 } 23 }
22 24
src/pkg-rpm/colab/colab.spec
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 Summary: Collaboration platform for communities 5 Summary: Collaboration platform for communities
6 Name: %{name} 6 Name: %{name}
7 Version: %{version} 7 Version: %{version}
8 -Release: 1 8 +Release: 2
9 Source0: %{name}-%{version}.tar.gz 9 Source0: %{name}-%{version}.tar.gz
10 License: GPLv2 10 License: GPLv2
11 Group: Development/Tools 11 Group: Development/Tools
@@ -15,8 +15,7 @@ Vendor: Sergio Oliveira &lt;sergio@tracy.com.br&gt; @@ -15,8 +15,7 @@ Vendor: Sergio Oliveira &lt;sergio@tracy.com.br&gt;
15 Url: https://github.com/colab/colab 15 Url: https://github.com/colab/colab
16 BuildArch: noarch 16 BuildArch: noarch
17 BuildRequires: colab-deps >= 1.12, python-virtualenv 17 BuildRequires: colab-deps >= 1.12, python-virtualenv
18 -# FIXME colab should not depend on nginx!  
19 -Requires: colab-deps >= 1.12, solr, mailman-api >= 0.3rc3, nginx 18 +Requires: colab-deps >= 1.12, solr, mailman-api >= 0.3rc3
20 19
21 %description 20 %description
22 Integrated software development platform. 21 Integrated software development platform.
@@ -58,7 +57,7 @@ install -d -m 0755 %{buildroot}/var/log/colab @@ -58,7 +57,7 @@ install -d -m 0755 %{buildroot}/var/log/colab
58 install -d -m 0755 %{buildroot}/var/lib/colab/celery 57 install -d -m 0755 %{buildroot}/var/lib/colab/celery
59 58
60 # Create assets dir (stores static files) 59 # Create assets dir (stores static files)
61 -install -d -m 0755 %{buildroot}/var/lib/colab/assets 60 +install -d -m 0755 %{buildroot}/var/lib/colab/assets/static
62 61
63 # install virtualenv 62 # install virtualenv
64 install -d -m 0755 %{buildroot}/usr/lib 63 install -d -m 0755 %{buildroot}/usr/lib
@@ -94,20 +93,19 @@ rm -rf %{buildvenv} @@ -94,20 +93,19 @@ rm -rf %{buildvenv}
94 %files 93 %files
95 %defattr(-, root, root) 94 %defattr(-, root, root)
96 95
97 -/usr/lib/colab  
98 -#/var/lib/colab # XXX: remove if doesnt break  
99 -%attr(-, colab, colab) /var/lib/colab/assets 96 +%attr(-, colab, colab) /var/lib/colab/assets/static
100 %attr(-, colab, colab) /var/lib/colab/celery 97 %attr(-, colab, colab) /var/lib/colab/celery
101 %attr(-, colab, colab) /var/log/colab 98 %attr(-, colab, colab) /var/log/colab
102 %{_bindir}/* 99 %{_bindir}/*
103 -/etc/cron.d/colab  
104 -#/etc/colab # XXX: remove if doesnt break  
105 -/etc/colab/settings.d  
106 -/etc/colab/plugins.d  
107 /etc/colab/gunicorn.py.example 100 /etc/colab/gunicorn.py.example
108 -/lib/systemd/system/colab.service  
109 -/lib/systemd/system/celeryd.service 101 +/etc/colab/plugins.d
  102 +/etc/colab/settings.d
  103 +/etc/cron.d/colab
110 /lib/systemd/system/celerybeat.service 104 /lib/systemd/system/celerybeat.service
  105 +/lib/systemd/system/celeryd.service
  106 +/lib/systemd/system/colab.service
  107 +/usr/lib/colab
  108 +/var/lib/colab/assets
111 109
112 110
113 %pre 111 %pre
@@ -215,9 +213,6 @@ EOF @@ -215,9 +213,6 @@ EOF
215 chmod 0640 /etc/colab/settings.py 213 chmod 0640 /etc/colab/settings.py
216 fi 214 fi
217 215
218 -# FIXME colab should not depend on nginx  
219 -ln -s /var/lib/colab/assets /usr/share/nginx/colab  
220 -  
221 colab-admin collectstatic --noinput 216 colab-admin collectstatic --noinput
222 217
223 if [ $1 -gt 1 ]; then 218 if [ $1 -gt 1 ]; then