summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiretza2022-05-23 07:21:45 +0200
committerXiretza2022-05-23 07:23:46 +0200
commit01db472dbd4b8a8072a137a52237304ad484211b (patch)
treeff8daa4522f987ff1e3b35fa8668747402d3ac76
parentd938e19b43ee1adf07f709578461efdc66a07490 (diff)
downloadaur-01db472dbd4b8a8072a137a52237304ad484211b.tar.gz
Add nginx and php-fpm configs
-rw-r--r--.SRCINFO10
-rw-r--r--0001-Fix-configuration-to-point-to-installed-files.patch14
-rw-r--r--0002-Set-default-project-directory-to-package-provided-di.patch37
-rw-r--r--PKGBUILD19
-rw-r--r--apache.conf4
-rw-r--r--nginx.conf30
-rw-r--r--nominatim.install6
-rw-r--r--php-fpm.conf12
8 files changed, 115 insertions, 17 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 9a3a6186ca04..fe2884a47138 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -44,14 +44,20 @@ pkgbase = nominatim
source = nominatim.sysusers
source = nominatim.tmpfiles
source = apache.conf
+ source = nginx.conf
source = php.ini
+ source = php-fpm.conf
source = 0001-Fix-configuration-to-point-to-installed-files.patch
+ source = 0002-Set-default-project-directory-to-package-provided-di.patch
sha256sums = 8f0c7ab93e6341713da40d034e689c4b9c3f257de485624abe4dc78b175267fc
sha256sums = fe66393aaf561749255cebf4c61d13a8425e326b8ce50409d88c4035165de049
sha256sums = 7f71b5217cbe0713fa5f8baa138348c9cd49f42c2b6025c059076042e0c04c6d
sha256sums = 50bf612ad951bcf3c1969aa79b0c7ab78745983720bc5f2deb37d1704c0e37d8
- sha256sums = 3c4d5fbb1299aff5d4efa855c8b278f2e19c47104982f3488c2c545a40f75ac8
+ sha256sums = fdde0a7fb8fac01fabf05a63ff7d2d4dd7bdaa2fca980de899f01ce2a4063e56
+ sha256sums = ed00242d06d6a17297a30675befef110f354a6f4bd2804d58796d956a9ae54a2
sha256sums = 37c4b17463f8317d39bb741b07bbb693afc0bbf584eec590f89b849542b98b7d
- sha256sums = 0873be585fa87e266e7e5bf02ab71b7032ea4e8d38d168f2f56cf4dd1bb32975
+ sha256sums = c2d5391160704bc636fde73c0e92346529ae1698f1cc909a8341271e0e4967d4
+ sha256sums = 2d6b5aced7a5a3fba2d3009f0806eb8a79677f9a62e9de90cd3c9cb4452746a3
+ sha256sums = 7e931eb36bc77a754bf22fa34e8d3c589b14d3668f14b73cf59121be5026bf24
pkgname = nominatim
diff --git a/0001-Fix-configuration-to-point-to-installed-files.patch b/0001-Fix-configuration-to-point-to-installed-files.patch
index 95d00c3f5892..5f23e807310d 100644
--- a/0001-Fix-configuration-to-point-to-installed-files.patch
+++ b/0001-Fix-configuration-to-point-to-installed-files.patch
@@ -1,14 +1,14 @@
-From ac0cd973586b44bcdb678f7edefa2175aca416ef Mon Sep 17 00:00:00 2001
+From e8f961114f0f2ec70f647d409afc24a5f950bf4c Mon Sep 17 00:00:00 2001
From: Xiretza <xiretza@xiretza.xyz>
Date: Thu, 24 Jun 2021 15:56:34 +0200
-Subject: [PATCH] Fix configuration to point to installed files
+Subject: [PATCH 1/2] Fix configuration to point to installed files
---
settings/env.defaults | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/settings/env.defaults b/settings/env.defaults
-index 4069270e..5f7e45cc 100644
+index 00f5569a..a9fc3e60 100644
--- a/settings/env.defaults
+++ b/settings/env.defaults
@@ -10,13 +10,13 @@ NOMINATIM_DATABASE_DSN="pgsql:dbname=nominatim"
@@ -25,9 +25,9 @@ index 4069270e..5f7e45cc 100644
-NOMINATIM_DATABASE_MODULE_PATH=
+NOMINATIM_DATABASE_MODULE_PATH="/usr/lib/nominatim/module"
- # Number of occurances of a word before it is considered frequent.
- # Similar to the concept of stop words. Frequent partial words get ignored
-@@ -65,7 +65,7 @@ NOMINATIM_HTTP_PROXY_PASSWORD=
+ # Tokenizer used for normalizing and parsing queries and names.
+ # The tokenizer is set up during import and cannot be changed afterwards
+@@ -77,7 +77,7 @@ NOMINATIM_HTTP_PROXY_PASSWORD=
# When empty, osm2pgsql is expected to reside in the osm2pgsql directory in
# the project directory.
# EXPERT ONLY. You should usually use the supplied osm2pgsql.
@@ -37,5 +37,5 @@ index 4069270e..5f7e45cc 100644
# Directory where to find US Tiger data files to import.
# OBSOLETE: use `nominatim add-data --tiger-data <dir>` to explicitly state
--
-2.32.0
+2.36.1
diff --git a/0002-Set-default-project-directory-to-package-provided-di.patch b/0002-Set-default-project-directory-to-package-provided-di.patch
new file mode 100644
index 000000000000..e80b2dad33ff
--- /dev/null
+++ b/0002-Set-default-project-directory-to-package-provided-di.patch
@@ -0,0 +1,37 @@
+From 62c2e1a8a78c25ac06c3f7b663c73e6b9cb0f4b6 Mon Sep 17 00:00:00 2001
+From: Xiretza <xiretza@xiretza.xyz>
+Date: Sun, 22 May 2022 10:50:31 +0200
+Subject: [PATCH 2/2] Set default project directory to package-provided
+ directory
+
+---
+ nominatim/cli.py | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/nominatim/cli.py b/nominatim/cli.py
+index 6c01a68a..47a5ef3b 100644
+--- a/nominatim/cli.py
++++ b/nominatim/cli.py
+@@ -16,6 +16,8 @@ from nominatim.clicmd.args import NominatimArgs
+
+ LOG = logging.getLogger()
+
++# Patched in by nominatim AUR package
++DEFAULT_PROJECT_DIR = '/var/lib/nominatim/'
+
+ class CommandlineParser:
+ """ Wraps some of the common functions for parsing the command line
+@@ -40,8 +42,8 @@ class CommandlineParser:
+ help='Print only error messages')
+ group.add_argument('-v', '--verbose', action='count', default=1,
+ help='Increase verboseness of output')
+- group.add_argument('--project-dir', metavar='DIR', default='.',
+- help='Base directory of the Nominatim installation (default:.)')
++ group.add_argument('--project-dir', metavar='DIR', default=DEFAULT_PROJECT_DIR,
++ help=f'Base directory of the Nominatim installation (default: {DEFAULT_PROJECT_DIR})')
+ group.add_argument('-j', '--threads', metavar='NUM', type=int,
+ help='Number of parallel threads to use')
+
+--
+2.36.1
+
diff --git a/PKGBUILD b/PKGBUILD
index da597d3d3307..f5dedcadc7a9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -59,16 +59,22 @@ source=(
"${pkgname}.sysusers"
"${pkgname}.tmpfiles"
"apache.conf"
+ "nginx.conf"
"php.ini"
+ "php-fpm.conf"
"0001-Fix-configuration-to-point-to-installed-files.patch"
+ "0002-Set-default-project-directory-to-package-provided-di.patch"
)
sha256sums=('8f0c7ab93e6341713da40d034e689c4b9c3f257de485624abe4dc78b175267fc'
'fe66393aaf561749255cebf4c61d13a8425e326b8ce50409d88c4035165de049'
'7f71b5217cbe0713fa5f8baa138348c9cd49f42c2b6025c059076042e0c04c6d'
'50bf612ad951bcf3c1969aa79b0c7ab78745983720bc5f2deb37d1704c0e37d8'
- '3c4d5fbb1299aff5d4efa855c8b278f2e19c47104982f3488c2c545a40f75ac8'
+ 'fdde0a7fb8fac01fabf05a63ff7d2d4dd7bdaa2fca980de899f01ce2a4063e56'
+ 'ed00242d06d6a17297a30675befef110f354a6f4bd2804d58796d956a9ae54a2'
'37c4b17463f8317d39bb741b07bbb693afc0bbf584eec590f89b849542b98b7d'
- '0873be585fa87e266e7e5bf02ab71b7032ea4e8d38d168f2f56cf4dd1bb32975')
+ 'c2d5391160704bc636fde73c0e92346529ae1698f1cc909a8341271e0e4967d4'
+ '2d6b5aced7a5a3fba2d3009f0806eb8a79677f9a62e9de90cd3c9cb4452746a3'
+ '7e931eb36bc77a754bf22fa34e8d3c589b14d3668f14b73cf59121be5026bf24')
noextract=(
"country_grid.sql.gz"
)
@@ -79,6 +85,7 @@ prepare() {
cd "Nominatim-$pkgver"
patch -p1 < "$srcdir/0001-Fix-configuration-to-point-to-installed-files.patch"
+ patch -p1 < "$srcdir/0002-Set-default-project-directory-to-package-provided-di.patch"
cp "$srcdir/country_grid.sql.gz" "data/country_grid.sql.gz"
}
@@ -101,8 +108,12 @@ package() {
cd "${srcdir}/build/"
make DESTDIR="${pkgdir}/" install
- # install apache and php config
- install -Dm644 "${srcdir}/apache.conf" -t "${pkgdir}/etc/webapps/${pkgname}"
+ # install apache and nginx example configs
+ install -Dm644 "${srcdir}/apache.conf" -t "${pkgdir}/usr/share/doc/$pkgname/examples/"
+ install -Dm644 "${srcdir}/nginx.conf" -t "${pkgdir}/usr/share/doc/$pkgname/examples/"
+
+ # Install PHP configs
+ install -Dm644 "${srcdir}/php-fpm.conf" "${pkgdir}/etc/php/php-fpm.d/nominatim.conf"
install -Dm644 "${srcdir}/php.ini" "${pkgdir}/etc/php/conf.d/nominatim.ini"
# create users and directories
diff --git a/apache.conf b/apache.conf
index 8f4c8b39cb19..a03db1bb9f17 100644
--- a/apache.conf
+++ b/apache.conf
@@ -1,5 +1,5 @@
-Alias /nominatim "/usr/lib/nominatim/lib-php/website"
-<Directory "/usr/lib/nominatim/lib-php/website">
+Alias /nominatim "/var/lib/nominatim/website"
+<Directory "/var/lib/nominatim/website">
Options FollowSymlinks MultiViews
DirectoryIndex search.php
Require all granted
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 000000000000..439e5960fa19
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,30 @@
+server {
+ server_name YOUR_HOSTNAME_HERE;
+ listen 80;
+ listen [::]:80;
+
+ root /var/lib/nominatim/website/;
+ index search.php index.html;
+ location / {
+ try_files $uri $uri/ @php;
+ }
+
+ location @php {
+ fastcgi_param SCRIPT_FILENAME "$document_root$uri.php";
+ fastcgi_param PATH_TRANSLATED "$document_root$uri.php";
+ fastcgi_param QUERY_STRING $args;
+ fastcgi_pass unix:/run/php-fpm-nominatim.sock;
+ fastcgi_index index.php;
+ include fastcgi_params;
+ }
+
+ location ~ [^/]\.php(/|$) {
+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;
+ if (!-f $document_root$fastcgi_script_name) {
+ return 404;
+ }
+ fastcgi_pass unix:/run/php-fpm-nominatim.sock;
+ fastcgi_index search.php;
+ include fastcgi.conf;
+ }
+}
diff --git a/nominatim.install b/nominatim.install
index 9cdeebb2807d..a21e681ba0fa 100644
--- a/nominatim.install
+++ b/nominatim.install
@@ -3,8 +3,10 @@
post_install() {
cat <<- 'EOF'
Create the required PostgreSQL and users for nominatim by running
- `sudo su - postgres -c "createuser --superuser nominatim; createuser http"`
+ `sudo -u postgres createuser --superuser nominatim`
+ `sudo -u postgres createuser http`
- Then `su` to user `nominatim` and follow the instructions at https://nominatim.org/release-docs/latest/admin/Import/#choosing-the-data-to-import to download and import data.
+ Then `su` to user `nominatim` and follow the instructions at https://nominatim.org/release-docs/latest/admin/Import/#choosing-the-data-to-import to
+ download and import data. The project directory is /var/lib/nominatim.
EOF
}
diff --git a/php-fpm.conf b/php-fpm.conf
new file mode 100644
index 000000000000..0b2b72d7e6ed
--- /dev/null
+++ b/php-fpm.conf
@@ -0,0 +1,12 @@
+[nominatim]
+listen = /run/php-fpm-nominatim.sock
+
+listen.owner = http
+listen.group = http
+listen.mode = 0660
+
+user = http
+group = http
+
+pm = ondemand
+pm.max_children = 5