Skip to content

Commit

Permalink
Adjust the spec to use environment configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
khardix committed Oct 19, 2018
1 parent 88eefdc commit cb66eb9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
9 changes: 9 additions & 0 deletions conf/httpd/environment.override.conf
@@ -0,0 +1,9 @@
# Run HTTPD with modified environment
[Service]
# softwarecollections require utf-8 support
Environment=LC_ALL=C.utf-8
Environment=LANG=C.utf-8
# Load configuration from env file
EnvironmentFile=/etc/sysconfig/softwarecollections.env

# vim:set filetype=systemd:
File renamed without changes.
3 changes: 3 additions & 0 deletions htdocs/wsgi.py
@@ -0,0 +1,3 @@
"""Link to the softwarecollections web app installed in system."""

from softwarecollections.wsgi import application # noqa: F401
22 changes: 11 additions & 11 deletions softwarecollections.spec
Expand Up @@ -26,6 +26,7 @@ BuildArch: noarch
BuildRequires: publican
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-setuptools_scm
BuildRequires: python3-pytest-runner
BuildRequires: systemd

Expand All @@ -42,6 +43,7 @@ Requires: postgresql-server
Requires(pre): postgresql-server
Requires: python3-defusedxml
Requires: python3-django >= 1.8
Requires: python3-django-database-url
Requires: python3-django-fas
Requires: python3-django-markdown2
Requires: python3-django-sekizai
Expand All @@ -55,6 +57,7 @@ Requires: python3-pillow
Requires: python3-psycopg2
Requires: python3-pylibravatar
Requires: python3-requests
Requires: python3-whitenoise
Requires: rpm-build
Requires: rsync-daemon
Requires: yum-utils
Expand All @@ -77,10 +80,6 @@ Software Collections Management Website and Utils


%build
rm %{name}/localsettings-development.py
mv %{name}/localsettings-production.py localsettings
mv %{name}/wsgi.py htdocs/

# Additional sources are not yet supported by tito
# TODO: remove next line
tar -xzf %{guide_name}-%{guide_version}.tar.gz
Expand All @@ -94,12 +93,6 @@ tar -xzf %{guide_name}-%{guide_version}.tar.gz
# install python package
%{__python3} setup.py install --skip-build --root %{buildroot}

# install conf file as target of localsettings.py symlink
install -p -D -m 0644 localsettings \
%{buildroot}%{scls_confdir}/localsettings
ln -s %{scls_confdir}/localsettings \
%{buildroot}%{python3_sitelib}/%{name}/localsettings.py

# install commandline interface
install -p -D -m 0755 manage.py %{buildroot}%{_bindir}/%{name}
install -p -D -m 0755 %{name}-db-setup %{buildroot}%{_bindir}/%{name}-db-setup
Expand All @@ -116,6 +109,12 @@ install -p -D -m 0644 conf/httpd/%{name}.conf \
install -p -D -m 0644 htdocs/wsgi.py \
%{buildroot}%{scls_statedir}/htdocs/wsgi.py

# install httpd service override and environment file
install -p -D -m 0644 conf/httpd/environment.override.conf \
%{buildroot}%{_unitdir}/httpd.service.d/%{name}-environment.override.conf
install -p -D -m 0644 conf/httpd/%{name}.env \
%{buildroot}%{_sysconfdir}/sysconfig/%{name}.env

# install directories for static content and site media
install -p -d -m 0775 htdocs/static \
%{buildroot}%{scls_statedir}/htdocs/static
Expand Down Expand Up @@ -219,8 +218,9 @@ service httpd condrestart
%{python3_sitelib}/softwarecollections*
%config(noreplace) %{cron_confdir}/%{name}
%config(noreplace) %{httpd_confdir}/%{name}.conf
%config(noreplace) %{scls_confdir}/localsettings
%config(noreplace) %{scls_confdir}/rsyncd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}.env
%{_unitdir}/httpd.service.d/%{name}-environment.override.conf
%{_unitdir}/softwarecollections-rsyncd.service
%{scls_statedir}/htdocs/wsgi.py*
%attr(755,root,root) %dir %{scls_statedir}/htdocs/static
Expand Down
4 changes: 2 additions & 2 deletions softwarecollections/wsgi.py
Expand Up @@ -8,7 +8,7 @@
"""

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "softwarecollections.settings")

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "softwarecollections.settings")
application = get_wsgi_application()

0 comments on commit cb66eb9

Please sign in to comment.