From 8cdcabac76d98ea9f3f7dbe0c565348de28251df Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Wed, 9 Dec 2015 14:45:35 -0200 Subject: [PATCH] Fixed colab collectstatic --- cookbooks/colab/recipes/default.rb | 10 ++++++++++ cookbooks/colab/templates/colab.conf.erb | 4 +++- src/pkg-rpm/colab/colab.spec | 27 +++++++++++---------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/cookbooks/colab/recipes/default.rb b/cookbooks/colab/recipes/default.rb index fe91b63..6a48283 100644 --- a/cookbooks/colab/recipes/default.rb +++ b/cookbooks/colab/recipes/default.rb @@ -11,6 +11,11 @@ if node['platform'] == 'centos' end end +# remove link left behind by old colab packages +file '/usr/share/nginx/colab' do + action :delete +end + package 'colab' do action :upgrade notifies :restart, 'service[colab]' @@ -185,6 +190,11 @@ execute 'colab-mailman-group' do command "usermod -a -G mailman colab" end +# Collect static is here instead of colab.spec because +# plugins might provide their own static files, as +# the package don't know about installed plugins +# collectstatic needs to run after package install +# and plugins instantiated. Same for migrate. execute 'colab-admin migrate' execute 'colab-admin:collectstatic' do command 'colab-admin collectstatic --noinput' diff --git a/cookbooks/colab/templates/colab.conf.erb b/cookbooks/colab/templates/colab.conf.erb index 43bfb68..f3ef2b7 100644 --- a/cookbooks/colab/templates/colab.conf.erb +++ b/cookbooks/colab/templates/colab.conf.erb @@ -11,12 +11,14 @@ server { error_log /var/log/nginx/colab.error.log; client_max_body_size 0; + # FIXME: Favico should be at right place and this + # code should be removed. location ~ ^/static/img/fav\.[^.]+\.ico$ { alias /var/lib/colab/assets/spb/fav.ico; } location / { - root /usr/share/nginx/colab; + root /var/lib/colab/assets/; try_files $uri @colab-app; } diff --git a/src/pkg-rpm/colab/colab.spec b/src/pkg-rpm/colab/colab.spec index bba0ad3..572c850 100644 --- a/src/pkg-rpm/colab/colab.spec +++ b/src/pkg-rpm/colab/colab.spec @@ -5,7 +5,7 @@ Summary: Collaboration platform for communities Name: %{name} Version: %{version} -Release: 1 +Release: 2 Source0: %{name}-%{version}.tar.gz License: GPLv2 Group: Development/Tools @@ -15,8 +15,7 @@ Vendor: Sergio Oliveira Url: https://github.com/colab/colab BuildArch: noarch BuildRequires: colab-deps >= 1.12, python-virtualenv -# FIXME colab should not depend on nginx! -Requires: colab-deps >= 1.12, solr, mailman-api >= 0.3rc3, nginx +Requires: colab-deps >= 1.12, solr, mailman-api >= 0.3rc3 %description Integrated software development platform. @@ -58,7 +57,7 @@ install -d -m 0755 %{buildroot}/var/log/colab install -d -m 0755 %{buildroot}/var/lib/colab/celery # Create assets dir (stores static files) -install -d -m 0755 %{buildroot}/var/lib/colab/assets +install -d -m 0755 %{buildroot}/var/lib/colab/assets/static # install virtualenv install -d -m 0755 %{buildroot}/usr/lib @@ -94,20 +93,19 @@ rm -rf %{buildvenv} %files %defattr(-, root, root) -/usr/lib/colab -#/var/lib/colab # XXX: remove if doesnt break -%attr(-, colab, colab) /var/lib/colab/assets +%attr(-, colab, colab) /var/lib/colab/assets/static %attr(-, colab, colab) /var/lib/colab/celery %attr(-, colab, colab) /var/log/colab %{_bindir}/* -/etc/cron.d/colab -#/etc/colab # XXX: remove if doesnt break -/etc/colab/settings.d -/etc/colab/plugins.d /etc/colab/gunicorn.py.example -/lib/systemd/system/colab.service -/lib/systemd/system/celeryd.service +/etc/colab/plugins.d +/etc/colab/settings.d +/etc/cron.d/colab /lib/systemd/system/celerybeat.service +/lib/systemd/system/celeryd.service +/lib/systemd/system/colab.service +/usr/lib/colab +/var/lib/colab/assets %pre @@ -215,9 +213,6 @@ EOF chmod 0640 /etc/colab/settings.py fi -# FIXME colab should not depend on nginx -ln -s /var/lib/colab/assets /usr/share/nginx/colab - colab-admin collectstatic --noinput if [ $1 -gt 1 ]; then -- libgit2 0.21.2