Navigation Menu

Skip to content

Commit

Permalink
[RPM] Add support for HDF5
Browse files Browse the repository at this point in the history
[RPM] Do not make qgis-server depend on httpd
[RPM] Add an Nginx configuration example
[RPM] Update server readme and replace wms with a better ogc
[RPM] More fixes for Epoch directive
[RPM] F27 reached EoL, replace it with F29
[RPM] Add support for netcdf and replace ogc with ows as server endpoint
[RPM] Add sample systemd service file
  • Loading branch information
daniviga committed Dec 17, 2018
1 parent 9e5bb36 commit a794992
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 31 deletions.
4 changes: 2 additions & 2 deletions rpm/default.cfg
Expand Up @@ -10,10 +10,10 @@ OUTDIR="result/"

# Which arches to build for. Check /etc/mock for possible options
ARCHS=(
"fedora-27-i386"
"fedora-27-x86_64"
"fedora-28-i386"
"fedora-28-x86_64"
"fedora-29-i386"
"fedora-29-x86_64"
)

# Which git branch to export. Normally take the current
Expand Down
47 changes: 26 additions & 21 deletions rpm/qgis.spec.template
Expand Up @@ -12,16 +12,18 @@
# py files located under /usr/share/qgis/python/plugins
%global __python %{__python3}

%define grass grass74

%if %{_timestamp} > 0
# Epoch is set only when building packages from master
Epoch: %{_timestamp}
%define combinedversion %{epoch}:%{version}
%define builddate %(date -d @%{_timestamp} '+%a %b %d %Y')
%else
%define combinedversion %{version}
%define builddate %(date '+%a %b %d %Y')
%endif

%define grass grass74

Name: qgis
Version: %{_version}
Release: %{_relver}%{?dist}
Expand All @@ -33,12 +35,15 @@ URL: http://www.qgis.org
Source0: http://qgis.org/downloads/%{name}-%{version}.tar.bz2

# Sample configuration files for QGIS server
Source2: %{name}-server-httpd.conf
Source4: %{name}-server-README.fedora
Source1: %{name}-server-httpd.conf
Source2: %{name}-server-nginx.conf
Source3: %{name}-server-fcgi.socket
Source4: %{name}-server-fcgi.service
Source5: %{name}-server-README.fedora

# MIME definitions
# Based on debian/qgis.xml but excluding already defined or proprietary types
Source5: %{name}-mime.xml
Source6: %{name}-mime.xml

# Fix builds on 64-bit machines
# https://issues.qgis.org/issues/15602
Expand Down Expand Up @@ -69,6 +74,8 @@ BuildRequires: gsl-devel
BuildRequires: libzip-devel
BuildRequires: postgresql-devel
BuildRequires: sqlite-devel
BuildRequires: hdf5-devel
BuildRequires: netcdf-devel
BuildRequires: fcgi-devel

# OpenCL
Expand Down Expand Up @@ -131,14 +138,14 @@ and USGS ASCII DEM.

%package devel
Summary: Development Libraries for the QGIS
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}

%description devel
Development packages for QGIS including the C header files.

%package grass
Summary: GRASS Support Libraries for QGIS
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}

# The plug-in requires more than just the grass-libs.
# This questions the sense of the libs package.
Expand All @@ -153,12 +160,12 @@ GRASS plugin for QGIS required to interface with the GRASS system.
%package -n python3-qgis
%{?python_provide:%python_provide python3-qgis}
# Remove before F30
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Provides: %{name}-python = %{combinedversion}-%{release}
Provides: %{name}-python%{?_isa} = %{combinedversion}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Obsoletes: python2-%{name} < %{version}-%{release}
Summary: Python integration and plug-ins for QGIS
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
Requires: gdal-python3
Requires: python3-future
Requires: python3-jinja2
Expand All @@ -176,16 +183,15 @@ Python integration and plug-ins for QGIS.

%package server
Summary: FCGI-based OGC web map server
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: mod_fcgid
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
Provides: mapserver = %{version}-%{release}
Obsoletes: mapserver < 2.8.1-1

%description server
This FastCGI OGC web map server implements OGC WMS 1.3.0 and 1.1.1.
The services are prepared as regular projects in QGIS. They're rendered using
the QGIS libraries. The server also supports SLD (Styled Layer Descriptor)
for styling. Sample configurations for Httpd and Lighttpd are included.
for styling. Sample configurations for HTTPD and Nginx are included.

Please refer to %{name}-server-README.fedora for details!

Expand All @@ -196,8 +202,12 @@ Please refer to %{name}-server-README.fedora for details!
# Remove executable permissions from source code files
find . \( -name "*.cpp" -o -name "*.h" \) -type f -perm /111 -execdir chmod -x {} \+

# Readme file for QGIS server configuration and Lighttpd example
# Readme file for QGIS server configuration HTTPD and Nginx example
install -pm0644 %{SOURCE1} .
install -pm0644 %{SOURCE2} .
install -pm0644 %{SOURCE3} .
install -pm0644 %{SOURCE4} .
install -pm0644 %{SOURCE5} .

gzip ChangeLog

Expand Down Expand Up @@ -228,14 +238,9 @@ make install DESTDIR=%{buildroot}

# Install MIME type definitions
install -d %{buildroot}%{_datadir}/mime/packages
install -pm0644 %{SOURCE5} \
install -pm0644 %{SOURCE6} \
%{buildroot}%{_datadir}/mime/packages/%{name}.xml

# Install basic QGIS Mapserver configuration for Apache
install -pd %{buildroot}%{_sysconfdir}/httpd/conf.d
install -pm0644 %{SOURCE2} \
%{buildroot}%{_sysconfdir}/httpd/conf.d/qgis-server.conf

# See qgis-server-README.fedora
rm -f %{buildroot}%{_libexecdir}/%{name}/wms_metadata.xml
rm -f %{buildroot}%{_libexecdir}/%{name}/admin.sld
Expand Down Expand Up @@ -328,7 +333,7 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :

%files server
%doc src/server/admin.sld src/server/wms_metadata.xml %{name}-server-README.fedora
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}-server.conf
%doc %{name}-server-httpd.conf %{name}-server-nginx.conf %{name}-server-fcgi.socket %{name}-server-fcgi.service
%{_libdir}/%{name}/server/
%{_libdir}/lib%{name}_server.so.*
%{_libexecdir}/%{name}/
Expand Down
18 changes: 11 additions & 7 deletions rpm/sources/qgis-server-README.fedora
Expand Up @@ -7,18 +7,21 @@ Services (WMS). Simply layout your map in QGIS. The WMS will look
exactly the same, because QGIS server uses the same libraries for
rendering, as the desktop application does.

A sample configuration file for Httpd is installed under
/etc/httpd/conf.d/qgis-server.conf.
A sample configuration file for HTTPD is installed under
/usr/share/doc/qgis-server/qgis-server-httpd.conf.
Also a sample configuration file for Nginx is available under
/usr/share/doc/qgis-server/qgis-server-nginx.conf with the corresponding
systemd socket for the FastCGI daemon.

This configuration expects QGIS project files under /var/www/wms. To
This configuration expects QGIS project files under /var/www/ows. To
use it, reload the Httpd configuration and place the files you want to
publish in this directory.

A getCapabilities request looks like this:

http://localhost/wms/my_qgis_project?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0
http://localhost/ows/my_qgis_project?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0

QGIS project is "/var/www/wms/my_qgis_project.qgs". The sample
QGIS project is "/var/www/ows/my_qgis_project.qgs". The sample
configuration automatically adds the project file extension for you.

The actual data can stay where it is. Make sure QGIS server can
Expand Down Expand Up @@ -55,7 +58,8 @@ Both configuration files are included as documentation.

==================================================

Further information: http://karlinapp.ethz.ch/qgis_wms

Volker Fröhlich
volker27@gmx.at

Daniele Viganò
daniele@vigano.me
17 changes: 17 additions & 0 deletions rpm/sources/qgis-server-fcgi.service
@@ -0,0 +1,17 @@
# Adapted from http://www.itopen.it/bulk/qgis3-server/#/step-27
# Path: /etc/systemd/system/qgis-server-fcgi.service
# systemctl enable qgis-server-fcgi.service && systemctl start qgis-server-fcgi.service

[Unit]
Description = QGIS Server Tracker FastCGI backend
After = network.target qgis-server-fcgi.socket

[Service]
# An existing user must be set
User = qgis
Group = qgis
ExecStart = /usr/libexec/qgis/qgis_mapserv.fcgi
StandardInput = socket
WorkingDirectory = /tmp

Restart = always
14 changes: 14 additions & 0 deletions rpm/sources/qgis-server-fcgi.socket
@@ -0,0 +1,14 @@
# Adapted from http://www.itopen.it/bulk/qgis3-server/#/step-26
# Path: /etc/systemd/system/qgis-server-fcgi.socket
# systemctl enable qgis-server-fcgi.socket && systemctl start qgis-server-fcgi.socket

[Unit]
Description = QGIS Server FastCGI Socket
PartOf = qgis-server-fcgi.service

[Socket]
ListenStream = 127.0.0.1:9993
Accept = yes

[Install]
WantedBy = sockets.target
2 changes: 1 addition & 1 deletion rpm/sources/qgis-server-httpd.conf
Expand Up @@ -2,7 +2,7 @@
# It is not meant for productive use.

RewriteEngine on
RewriteRule ^/wms/(.*)$ /qgis/qgis_mapserv.fcgi?map=/var/www/wms/$1.qgs [QSA,PT]
RewriteRule ^/ows/(.*)$ /qgis/qgis_mapserv.fcgi?map=/var/www/ows/$1.qgs [QSA,PT]

ScriptAlias /qgis/ "/usr/libexec/qgis/"

Expand Down
78 changes: 78 additions & 0 deletions rpm/sources/qgis-server-nginx.conf
@@ -0,0 +1,78 @@
# Adapted from https://github.com/gem/oq-qgis-server/blob/master/conf/qgis-server-nginx.conf
# It requires a FCGI processes spawner like spawn-fcgi or systemd (see s-server-fcgi.socket)

user nginx;
worker_processes auto;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
worker_connections 1024;
}

http {

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Get 'port' from `$http_host`
map $http_host $port {
"~*.*:(?<p>.*)" $p;
default server_port;
}
# Get 'proto' from `$scheme` unless 'X-Forwarded-Proto'
# is set by the reverse proxy
map $http_x_forwarded_proto $qgis_proto {
"" $scheme;
default $http_x_forwarded_proto;
}
# Get 'host' from `$host` unless 'X-Forwarded-Host'
# is set by the reverse proxy
map $http_x_forwarded_host $qgis_host {
"" $host;
default $http_x_forwarded_host;
}
# Get 'port' from `$port` unless 'X-Forwarded-Port'
# is set by the reverse proxy
map $http_x_forwarded_port $qgis_port {
"" $port;
default $http_x_forwarded_port;
}

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;

location /ows/ {
rewrite ^/ows/(.*)$ /qgis/qgis_mapserv.fcgi?map=/var/www/ows/$1.qgs;
}
location /qgis/ {
internal; # Used only by the OGC rewrite
root /var/www/ows;
fastcgi_pass localhost:9993;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
# build links in GetCapabilities based on
# the hostname exposed by the reverse proxy
fastcgi_param SERVER_PROTOCOL $qgis_proto;
fastcgi_param SERVER_NAME $qgis_host;
fastcgi_param SERVER_PORT $qgis_port;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

}

0 comments on commit a794992

Please sign in to comment.