Can you compress at RPM install time?
Y.
From: rdo-list-bounces(a)redhat.com [mailto:rdo-list-bounces@redhat.com] On Behalf Of Adam
Young
Sent: Tuesday, April 14, 2015 1:19 AM
To: rdo-list(a)redhat.com
Subject: [Rdo-list] Systemd extension for HTTPD hosted applications
Discussing offline versus online compression in #rdo.
What do we do now? Its ugly. The compression is performed at RPM build time. THis is
ugly, because the Javascript files it is compressing come from other RPMS. So, if you
update the RPM that has newer javascript, the RPM will not see the change, and show the
old code.
What we want is to specify that the compression script runs before Horizon starts. While
we know we need to optimize the script to keep restart times down, that is an issue that
needs to be solved upstream as well. Lets assume for the moment that we will always run
it.
The compression needs to be done in the system, but should not be done by the HTTPD daemon
itself; Static files should be owned by a user other than the one that runs HTTPD.
The right answer seems to be systemd, since we use systemd to restart httpd. We should be
able to indicate that it needs to run the compression script. We don't want to create
a separate service for openstack-dashboard, though; the service is HTTPD.
Steve Gallagher was kind enough to walk me through the basics. He pointed me to what
reviewboard (another mod_wsgi App) does. It installs a file under
/usr/lib/systemd/system/httpd.service.d
named reviewboard-sites.conf. It looks like this:
[Service]
ExecStartPre=/usr/bin/rb-site upgrade --all-sites
[Unit]
After=postgresql.service mariadb.service mysql.service memcached.service
(visible at
http://pkgs.fedoraproject.org/cgit/ReviewBoard.git/tree/reviewboard-sites...)
so for horizon:
ExecStartPre=python ${horizon_path}/manage.py compress --force-if-not-fresh
I think this should be the pattern for all of the HTTPD hosted services. We should do
this with Keystone next.