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 11 end
12 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 19 package 'colab' do
15 20 action :upgrade
16 21 notifies :restart, 'service[colab]'
... ... @@ -185,6 +190,11 @@ execute &#39;colab-mailman-group&#39; do
185 190 command "usermod -a -G mailman colab"
186 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 198 execute 'colab-admin migrate'
189 199 execute 'colab-admin:collectstatic' do
190 200 command 'colab-admin collectstatic --noinput'
... ...
cookbooks/colab/templates/colab.conf.erb
... ... @@ -11,12 +11,14 @@ server {
11 11 error_log /var/log/nginx/colab.error.log;
12 12 client_max_body_size 0;
13 13  
  14 + # FIXME: Favico should be at right place and this
  15 + # code should be removed.
14 16 location ~ ^/static/img/fav\.[^.]+\.ico$ {
15 17 alias /var/lib/colab/assets/spb/fav.ico;
16 18 }
17 19  
18 20 location / {
19   - root /usr/share/nginx/colab;
  21 + root /var/lib/colab/assets/;
20 22 try_files $uri @colab-app;
21 23 }
22 24  
... ...
src/pkg-rpm/colab/colab.spec
... ... @@ -5,7 +5,7 @@
5 5 Summary: Collaboration platform for communities
6 6 Name: %{name}
7 7 Version: %{version}
8   -Release: 1
  8 +Release: 2
9 9 Source0: %{name}-%{version}.tar.gz
10 10 License: GPLv2
11 11 Group: Development/Tools
... ... @@ -15,8 +15,7 @@ Vendor: Sergio Oliveira &lt;sergio@tracy.com.br&gt;
15 15 Url: https://github.com/colab/colab
16 16 BuildArch: noarch
17 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 20 %description
22 21 Integrated software development platform.
... ... @@ -58,7 +57,7 @@ install -d -m 0755 %{buildroot}/var/log/colab
58 57 install -d -m 0755 %{buildroot}/var/lib/colab/celery
59 58  
60 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 62 # install virtualenv
64 63 install -d -m 0755 %{buildroot}/usr/lib
... ... @@ -94,20 +93,19 @@ rm -rf %{buildvenv}
94 93 %files
95 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 97 %attr(-, colab, colab) /var/lib/colab/celery
101 98 %attr(-, colab, colab) /var/log/colab
102 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 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 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 111 %pre
... ... @@ -215,9 +213,6 @@ EOF
215 213 chmod 0640 /etc/colab/settings.py
216 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 216 colab-admin collectstatic --noinput
222 217  
223 218 if [ $1 -gt 1 ]; then
... ...