Skip to content

Commit a794992

Browse files
committedDec 17, 2018
[RPM] Add support for HDF5
[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
1 parent 9e5bb36 commit a794992

File tree

7 files changed

+149
-31
lines changed

7 files changed

+149
-31
lines changed
 

‎rpm/default.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ OUTDIR="result/"
1010

1111
# Which arches to build for. Check /etc/mock for possible options
1212
ARCHS=(
13-
"fedora-27-i386"
14-
"fedora-27-x86_64"
1513
"fedora-28-i386"
1614
"fedora-28-x86_64"
15+
"fedora-29-i386"
16+
"fedora-29-x86_64"
1717
)
1818

1919
# Which git branch to export. Normally take the current

‎rpm/qgis.spec.template

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@
1212
# py files located under /usr/share/qgis/python/plugins
1313
%global __python %{__python3}
1414

15+
%define grass grass74
16+
1517
%if %{_timestamp} > 0
1618
# Epoch is set only when building packages from master
1719
Epoch: %{_timestamp}
20+
%define combinedversion %{epoch}:%{version}
1821
%define builddate %(date -d @%{_timestamp} '+%a %b %d %Y')
1922
%else
23+
%define combinedversion %{version}
2024
%define builddate %(date '+%a %b %d %Y')
2125
%endif
2226

23-
%define grass grass74
24-
2527
Name: qgis
2628
Version: %{_version}
2729
Release: %{_relver}%{?dist}
@@ -33,12 +35,15 @@ URL: http://www.qgis.org
3335
Source0: http://qgis.org/downloads/%{name}-%{version}.tar.bz2
3436

3537
# Sample configuration files for QGIS server
36-
Source2: %{name}-server-httpd.conf
37-
Source4: %{name}-server-README.fedora
38+
Source1: %{name}-server-httpd.conf
39+
Source2: %{name}-server-nginx.conf
40+
Source3: %{name}-server-fcgi.socket
41+
Source4: %{name}-server-fcgi.service
42+
Source5: %{name}-server-README.fedora
3843

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

4348
# Fix builds on 64-bit machines
4449
# https://issues.qgis.org/issues/15602
@@ -69,6 +74,8 @@ BuildRequires: gsl-devel
6974
BuildRequires: libzip-devel
7075
BuildRequires: postgresql-devel
7176
BuildRequires: sqlite-devel
77+
BuildRequires: hdf5-devel
78+
BuildRequires: netcdf-devel
7279
BuildRequires: fcgi-devel
7380

7481
# OpenCL
@@ -131,14 +138,14 @@ and USGS ASCII DEM.
131138

132139
%package devel
133140
Summary: Development Libraries for the QGIS
134-
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
141+
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
135142

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

139146
%package grass
140147
Summary: GRASS Support Libraries for QGIS
141-
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
148+
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
142149

143150
# The plug-in requires more than just the grass-libs.
144151
# This questions the sense of the libs package.
@@ -153,12 +160,12 @@ GRASS plugin for QGIS required to interface with the GRASS system.
153160
%package -n python3-qgis
154161
%{?python_provide:%python_provide python3-qgis}
155162
# Remove before F30
156-
Provides: %{name}-python = %{version}-%{release}
157-
Provides: %{name}-python%{?_isa} = %{version}-%{release}
163+
Provides: %{name}-python = %{combinedversion}-%{release}
164+
Provides: %{name}-python%{?_isa} = %{combinedversion}-%{release}
158165
Obsoletes: %{name}-python < %{version}-%{release}
159166
Obsoletes: python2-%{name} < %{version}-%{release}
160167
Summary: Python integration and plug-ins for QGIS
161-
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
168+
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
162169
Requires: gdal-python3
163170
Requires: python3-future
164171
Requires: python3-jinja2
@@ -176,16 +183,15 @@ Python integration and plug-ins for QGIS.
176183

177184
%package server
178185
Summary: FCGI-based OGC web map server
179-
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
180-
Requires: mod_fcgid
186+
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
181187
Provides: mapserver = %{version}-%{release}
182188
Obsoletes: mapserver < 2.8.1-1
183189

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

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

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

199-
# Readme file for QGIS server configuration and Lighttpd example
205+
# Readme file for QGIS server configuration HTTPD and Nginx example
206+
install -pm0644 %{SOURCE1} .
207+
install -pm0644 %{SOURCE2} .
208+
install -pm0644 %{SOURCE3} .
200209
install -pm0644 %{SOURCE4} .
210+
install -pm0644 %{SOURCE5} .
201211

202212
gzip ChangeLog
203213

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

229239
# Install MIME type definitions
230240
install -d %{buildroot}%{_datadir}/mime/packages
231-
install -pm0644 %{SOURCE5} \
241+
install -pm0644 %{SOURCE6} \
232242
%{buildroot}%{_datadir}/mime/packages/%{name}.xml
233243

234-
# Install basic QGIS Mapserver configuration for Apache
235-
install -pd %{buildroot}%{_sysconfdir}/httpd/conf.d
236-
install -pm0644 %{SOURCE2} \
237-
%{buildroot}%{_sysconfdir}/httpd/conf.d/qgis-server.conf
238-
239244
# See qgis-server-README.fedora
240245
rm -f %{buildroot}%{_libexecdir}/%{name}/wms_metadata.xml
241246
rm -f %{buildroot}%{_libexecdir}/%{name}/admin.sld
@@ -328,7 +333,7 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
328333

329334
%files server
330335
%doc src/server/admin.sld src/server/wms_metadata.xml %{name}-server-README.fedora
331-
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}-server.conf
336+
%doc %{name}-server-httpd.conf %{name}-server-nginx.conf %{name}-server-fcgi.socket %{name}-server-fcgi.service
332337
%{_libdir}/%{name}/server/
333338
%{_libdir}/lib%{name}_server.so.*
334339
%{_libexecdir}/%{name}/

‎rpm/sources/qgis-server-README.fedora

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ Services (WMS). Simply layout your map in QGIS. The WMS will look
77
exactly the same, because QGIS server uses the same libraries for
88
rendering, as the desktop application does.
99

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

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

1720
A getCapabilities request looks like this:
1821

19-
http://localhost/wms/my_qgis_project?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0
22+
http://localhost/ows/my_qgis_project?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0
2023

21-
QGIS project is "/var/www/wms/my_qgis_project.qgs". The sample
24+
QGIS project is "/var/www/ows/my_qgis_project.qgs". The sample
2225
configuration automatically adds the project file extension for you.
2326

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

5659
==================================================
5760

58-
Further information: http://karlinapp.ethz.ch/qgis_wms
59-
6061
Volker Fröhlich
6162
volker27@gmx.at
63+
64+
Daniele Viganò
65+
daniele@vigano.me

‎rpm/sources/qgis-server-fcgi.service

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Adapted from http://www.itopen.it/bulk/qgis3-server/#/step-27
2+
# Path: /etc/systemd/system/qgis-server-fcgi.service
3+
# systemctl enable qgis-server-fcgi.service && systemctl start qgis-server-fcgi.service
4+
5+
[Unit]
6+
Description = QGIS Server Tracker FastCGI backend
7+
After = network.target qgis-server-fcgi.socket
8+
9+
[Service]
10+
# An existing user must be set
11+
User = qgis
12+
Group = qgis
13+
ExecStart = /usr/libexec/qgis/qgis_mapserv.fcgi
14+
StandardInput = socket
15+
WorkingDirectory = /tmp
16+
17+
Restart = always

‎rpm/sources/qgis-server-fcgi.socket

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Adapted from http://www.itopen.it/bulk/qgis3-server/#/step-26
2+
# Path: /etc/systemd/system/qgis-server-fcgi.socket
3+
# systemctl enable qgis-server-fcgi.socket && systemctl start qgis-server-fcgi.socket
4+
5+
[Unit]
6+
Description = QGIS Server FastCGI Socket
7+
PartOf = qgis-server-fcgi.service
8+
9+
[Socket]
10+
ListenStream = 127.0.0.1:9993
11+
Accept = yes
12+
13+
[Install]
14+
WantedBy = sockets.target

‎rpm/sources/qgis-server-httpd.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# It is not meant for productive use.
33

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

77
ScriptAlias /qgis/ "/usr/libexec/qgis/"
88

‎rpm/sources/qgis-server-nginx.conf

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Adapted from https://github.com/gem/oq-qgis-server/blob/master/conf/qgis-server-nginx.conf
2+
# It requires a FCGI processes spawner like spawn-fcgi or systemd (see s-server-fcgi.socket)
3+
4+
user nginx;
5+
worker_processes auto;
6+
access_log /var/log/nginx/access.log;
7+
error_log /var/log/nginx/error.log;
8+
pid /run/nginx.pid;
9+
10+
events {
11+
worker_connections 1024;
12+
}
13+
14+
http {
15+
16+
sendfile on;
17+
tcp_nopush on;
18+
tcp_nodelay on;
19+
keepalive_timeout 65;
20+
types_hash_max_size 2048;
21+
22+
include /etc/nginx/mime.types;
23+
default_type application/octet-stream;
24+
25+
# Get 'port' from `$http_host`
26+
map $http_host $port {
27+
"~*.*:(?<p>.*)" $p;
28+
default server_port;
29+
}
30+
# Get 'proto' from `$scheme` unless 'X-Forwarded-Proto'
31+
# is set by the reverse proxy
32+
map $http_x_forwarded_proto $qgis_proto {
33+
"" $scheme;
34+
default $http_x_forwarded_proto;
35+
}
36+
# Get 'host' from `$host` unless 'X-Forwarded-Host'
37+
# is set by the reverse proxy
38+
map $http_x_forwarded_host $qgis_host {
39+
"" $host;
40+
default $http_x_forwarded_host;
41+
}
42+
# Get 'port' from `$port` unless 'X-Forwarded-Port'
43+
# is set by the reverse proxy
44+
map $http_x_forwarded_port $qgis_port {
45+
"" $port;
46+
default $http_x_forwarded_port;
47+
}
48+
49+
server {
50+
listen 80 default_server;
51+
listen [::]:80 default_server;
52+
server_name _;
53+
root /usr/share/nginx/html;
54+
55+
location /ows/ {
56+
rewrite ^/ows/(.*)$ /qgis/qgis_mapserv.fcgi?map=/var/www/ows/$1.qgs;
57+
}
58+
location /qgis/ {
59+
internal; # Used only by the OGC rewrite
60+
root /var/www/ows;
61+
fastcgi_pass localhost:9993;
62+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
63+
fastcgi_param QUERY_STRING $query_string;
64+
# build links in GetCapabilities based on
65+
# the hostname exposed by the reverse proxy
66+
fastcgi_param SERVER_PROTOCOL $qgis_proto;
67+
fastcgi_param SERVER_NAME $qgis_host;
68+
fastcgi_param SERVER_PORT $qgis_port;
69+
}
70+
error_page 404 /404.html;
71+
location = /40x.html {
72+
}
73+
error_page 500 502 503 504 /50x.html;
74+
location = /50x.html {
75+
}
76+
}
77+
78+
}

0 commit comments

Comments
 (0)
Please sign in to comment.