From e995373486552d6842406982a5ddb2e791e40ae3 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:26:38 +0000 Subject: [PATCH 01/15] Update docs/source/install.rst --- docs/source/install.rst | 175 +++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 92 deletions(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index dfab0e6..96bb546 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -54,107 +54,98 @@ If you do not already have it installed, install it now. #!/bin/bash -e -PG_VER='16' -PG_PASS=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32); - -function install_postgresql(){ - RELEASE=$(lsb_release -cs) - - #3. Install PostgreSQL - echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}-pgdg main" > /etc/apt/sources.list.d/pgdg.list - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - - - apt-get update -y || true - - apt-get install -y postgresql-${PG_VER} postgresql-client-${PG_VER} postgresql-contrib-${PG_VER} \ - python3-postgresql postgresql-plperl-${PG_VER} \ - postgresql-pltcl-${PG_VER} postgresql-${PG_VER}-postgis-3 \ - odbc-postgresql libpostgresql-jdbc-java - if [ ! -f /usr/lib/postgresql/${PG_VER}/bin/postgres ]; then - echo "Error: Get PostgreSQL version"; exit 1; - fi - - ln -sf /usr/lib/postgresql/${PG_VER}/bin/pg_config /usr/bin - ln -sf /var/lib/postgresql/${PG_VER}/main/ /var/lib/postgresql - ln -sf /var/lib/postgresql/${PG_VER}/backups /var/lib/postgresql - - systemctl start postgresql - - #5. Set postgres Password - if [ $(grep -m 1 -c 'pg pass' /root/auth.txt) -eq 0 ]; then - sudo -u postgres psql 2>/dev/null -c "alter user postgres with password '${PG_PASS}'" - echo "pg pass: ${PG_PASS}" > /root/auth.txt - fi - - #4. Add Postgre variables to environment - if [ $(grep -m 1 -c 'PGDATA' /etc/environment) -eq 0 ]; then - cat >>/etc/environment </etc/postgresql/${PG_VER}/main/pg_hba.conf <> /root/auth.txt - else - sed -i.save "s/ssl pass:.*/ssl pass: ${SSL_PASS}/" /root/auth.txt - fi - openssl genrsa -des3 -passout pass:${SSL_PASS} -out server.key 2048 - openssl rsa -in server.key -passin pass:${SSL_PASS} -out server.key - - chmod 400 server.key - - openssl req -new -key server.key -days 3650 -out server.crt -passin pass:${SSL_PASS} -x509 -subj '/C=CA/ST=Frankfurt/L=Frankfurt/O=acuciva-de.com/CN=acuciva-de.com/emailAddress=info@acugis.com' - chown postgres.postgres server.key server.crt - mv server.key server.crt /var/lib/postgresql/${PG_VER}/main - fi - - systemctl restart postgresql -} + apt install postgresql postgresql-contrib -function install_webmin(){ - echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list - wget --quiet -qO - http://www.webmin.com/jcameron-key.asc | apt-key add - - apt-get -y update - apt-get -y install webmin - -} +Install Prerequisties +------------------------------------------ -touch /root/auth.txt -export DEBIAN_FRONTEND=noninteractive +For Community Edition: -add-apt-repository -y universe -apt-get -y update || true +.. code-block:: bash -apt-get -y install wget unzip + apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd,simplexml} proftpd postfix python3-certbot-apache -install_postgresql; +For Commerical Edition: + +.. code-block:: bash + + apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd,simplexml} proftpd libapache2-mod-fcgid postfix python3-certbot-apache +install_qgis_server + +Create the PostGIS Database +-------------------------------- + +.. code-block:: sql + + CREATE USER quartz with password 'SuperSecret'; + + CREATE DATABASE quartz with OWNER quartz; +Create the Database Object +-------------------------------- -#!/bin/bash -e +.. code-block:: sql + + CREATE TYPE public.userlevel AS ENUM ('Admin', 'User'); + + CREATE TABLE public.user ( id SERIAL PRIMARY KEY, + name character varying(250), + email character varying(250), + password character varying(255), + ftp_user character varying(250), + accesslevel public.userlevel, + owner_id integer NOT NULL REFERENCES public.user(id), + UNIQUE(email) + ); + + CREATE TABLE public.access_groups ( id SERIAL PRIMARY KEY, + name character varying(255) NOT NULL, + owner_id integer NOT NULL REFERENCES public.user(id) + ); + + CREATE TABLE public.user_access ( id SERIAL PRIMARY KEY, + user_id integer NOT NULL REFERENCES public.user(id), + access_group_id integer NOT NULL REFERENCES public.access_groups(id), + UNIQUE(user_id, access_group_id) + ); + + CREATE TABLE public.map ( id SERIAL PRIMARY KEY, + name character varying(50) NOT NULL, + description character varying(50) NOT NULL, + is_public BOOLEAN DEFAULT false, + owner_id integer NOT NULL REFERENCES public.user(id) + ); + + CREATE TABLE public.map_access ( id SERIAL PRIMARY KEY, + map_id integer NOT NULL REFERENCES public.map(id), + access_group_id integer NOT NULL REFERENCES public.access_groups(id), + UNIQUE(map_id, access_group_id) + ); + + CREATE TABLE public.permalink ( id SERIAL PRIMARY KEY, + description character varying(255), + query character varying(255), + map_id integer NOT NULL REFERENCES public.map(id), + created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + expires TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + interval '1 hour', + visits integer NOT NULL DEFAULT 0, + visits_limit integer NOT NULL DEFAULT 1, + hash character varying(36) NOT NULL, + owner_id integer NOT NULL REFERENCES public.user(id) + ); + + CREATE TABLE public.signup ( id SERIAL PRIMARY KEY, + name character varying(250), + email character varying(250), + password character varying(250), + verify character varying(250), + UNIQUE(email) +); + +Install This and That +---------------------------- APP_DB='q2w' APP_DB_PASS=$(< /dev/urandom tr -dc _A-Za-z0-9 | head -c32); From f2186aa8355898967bb36909bce2fc176de3b0ea Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:34:10 +0000 Subject: [PATCH 02/15] Update docs/source/install.rst --- docs/source/install.rst | 73 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index 96bb546..45e8818 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -73,6 +73,7 @@ For Commerical Edition: apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd,simplexml} proftpd libapache2-mod-fcgid postfix python3-certbot-apache install_qgis_server + Create the PostGIS Database -------------------------------- @@ -83,7 +84,7 @@ Create the PostGIS Database CREATE DATABASE quartz with OWNER quartz; -Create the Database Object +Create the Database Objects -------------------------------- .. code-block:: sql @@ -144,9 +145,77 @@ Create the Database Object UNIQUE(email) ); -Install This and That + +Configure ProFTPD ---------------------------- +.. code-block:: bash + + sed -i.save ' + s/#DefaultRoot~/DefaultRoot ~/ + s/# RequireValidShelloff/RequireValidShell off/' /etc/proftpd/proftpd.conf + systemctl enable proftpd + systemctl restart proftpd + +Configure Apache +---------------------------- + +.. code-block:: bash + + a2enmod ssl headers expires fcgid cgi + cp installer/apache2.conf /etc/apache2/sites-available/default-ssl.conf + + for f in 000-default default-ssl; do + sed -i.save "s/#ServerName example.com/#ServerName ${HNAME}/" /etc/apache2/sites-available/${f}.conf + done + + a2ensite 000-default default-ssl + systemctl reload apache2 + + certbot --apache --agree-tos --email hostmaster@${HNAME} --no-eff-email -d ${HNAME} + + +Create Data and Cache Directories +---------------------------- + +.. code-block:: bash + + mkdir -p "${APPS_DIR}" + mkdir -p "${CACHE_DIR}" + mkdir -p "${DATA_DIR}" + + chown -R www-data:www-data "${APPS_DIR}" + chown -R www-data:www-data "${CACHE_DIR}" + chown -R www-data:www-data "${DATA_DIR}" + + + cp -r . /var/www/html/ + chown -R www-data:www-data /var/www/html + rm -rf /var/www/html/installer + + systemctl restart apache2 + + # create group for all FTP users + groupadd qatusers + + create_ftp_user + + # install ftp user creation script + for f in update; do + cp installer/${f}_ftp_user.sh /usr/local/bin/ + chown www-data:www-data /usr/local/bin/${f}_ftp_user.sh + chmod 0550 /usr/local/bin/${f}_ftp_user.sh + done + + cat >/etc/sudoers.d/q2w < Date: Mon, 25 Mar 2024 11:37:05 +0000 Subject: [PATCH 03/15] Add docs/source/quartz.css --- docs/source/quartz.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/source/quartz.css diff --git a/docs/source/quartz.css b/docs/source/quartz.css new file mode 100644 index 0000000..20431fb --- /dev/null +++ b/docs/source/quartz.css @@ -0,0 +1,3 @@ +.wy-nav-content { + max-width: 90%; +} \ No newline at end of file From fdfb36a7d58a33df7ff6a0e007cc1af32f18d102 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:37:52 +0000 Subject: [PATCH 04/15] Add docs/source/source/_static/my.css --- docs/source/source/_static/my.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/source/source/_static/my.css diff --git a/docs/source/source/_static/my.css b/docs/source/source/_static/my.css new file mode 100644 index 0000000..20431fb --- /dev/null +++ b/docs/source/source/_static/my.css @@ -0,0 +1,3 @@ +.wy-nav-content { + max-width: 90%; +} \ No newline at end of file From b51eee49dc287a11d9b398cae030e0e3de765b32 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:40:08 +0000 Subject: [PATCH 05/15] Update docs/source/conf.py --- docs/source/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 6d911c5..f26f5c6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -33,3 +33,6 @@ html_theme = 'sphinx_rtd_theme' # -- Options for EPUB output epub_show_urls = 'footnote' + + +html_static_path = ['_static'] From 2fc89f52b74d213f112260979d1f0a765818e48e Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:40:43 +0000 Subject: [PATCH 06/15] Add docs/source/_static/my.css --- docs/source/_static/my.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/source/_static/my.css diff --git a/docs/source/_static/my.css b/docs/source/_static/my.css new file mode 100644 index 0000000..00a18c9 --- /dev/null +++ b/docs/source/_static/my.css @@ -0,0 +1,3 @@ +.wy-nav-content { + max-width: 1200px !important; +} \ No newline at end of file From cc11596d6352633ba1559f067f393671480af5bc Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:43:48 +0000 Subject: [PATCH 07/15] Update docs/source/conf.py --- docs/source/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index f26f5c6..9004d25 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -35,4 +35,5 @@ html_theme = 'sphinx_rtd_theme' epub_show_urls = 'footnote' -html_static_path = ['_static'] +def setup(app): + app.add_css_file("quartz.css") From 8f3b66512c6b57b9b1436c29bf8afb3500749074 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:46:21 +0000 Subject: [PATCH 08/15] Update docs/source/conf.py --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 9004d25..fc5a076 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -36,4 +36,4 @@ epub_show_urls = 'footnote' def setup(app): - app.add_css_file("quartz.css") + app.add_css_file("docs/source/quartz.css") From 4f72be3e501f110857a45355a1505e2d12dd60f8 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:47:39 +0000 Subject: [PATCH 09/15] Update docs/source/conf.py --- docs/source/conf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index fc5a076..5ad8dcf 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -35,5 +35,10 @@ html_theme = 'sphinx_rtd_theme' epub_show_urls = 'footnote' -def setup(app): - app.add_css_file("docs/source/quartz.css") +html_static_path = ['_static'] + +# These paths are either relative to html_static_path +# or fully qualified paths (eg. https://...) +html_css_files = [ + 'css/custom.css', +] From 0f7a1c18ccf7273d785e11b322dc97b8153c811a Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:48:13 +0000 Subject: [PATCH 10/15] Add docs/source/_static/css/custom.css --- docs/source/_static/css/custom.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/source/_static/css/custom.css diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css new file mode 100644 index 0000000..df32cf8 --- /dev/null +++ b/docs/source/_static/css/custom.css @@ -0,0 +1,3 @@ +.wy-nav-content { + max-width: none; +} \ No newline at end of file From 49bcd8f673a238333eb4f7ebe2431bddf4cedf0f Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:48:36 +0000 Subject: [PATCH 11/15] Update docs/source/_static/custom.css --- docs/source/_static/custom.css | 3 +++ docs/source/_static/my.css | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 docs/source/_static/custom.css delete mode 100644 docs/source/_static/my.css diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css new file mode 100644 index 0000000..df32cf8 --- /dev/null +++ b/docs/source/_static/custom.css @@ -0,0 +1,3 @@ +.wy-nav-content { + max-width: none; +} \ No newline at end of file diff --git a/docs/source/_static/my.css b/docs/source/_static/my.css deleted file mode 100644 index 00a18c9..0000000 --- a/docs/source/_static/my.css +++ /dev/null @@ -1,3 +0,0 @@ -.wy-nav-content { - max-width: 1200px !important; -} \ No newline at end of file From 3b99a6705ce69577be3274ee68243c496ce464e7 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 12:33:16 +0000 Subject: [PATCH 12/15] Update docs/source/install.rst --- docs/source/install.rst | 170 ++++------------------------------------ 1 file changed, 17 insertions(+), 153 deletions(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index 45e8818..cb7245c 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -40,7 +40,7 @@ Populate the required fields with whatever values you want to use. Manual Installation on Ubuntu 22 ------------- +-------------------------------- Install PostgreSQL with PostGIS @@ -216,167 +216,31 @@ Create Data and Cache Directories Install More Stuff --------------------------------------- -APP_DB='q2w' -APP_DB_PASS=$(< /dev/urandom tr -dc _A-Za-z0-9 | head -c32); -DATA_DIR='/var/www/data' -CACHE_DIR='/var/www/cache' -APPS_DIR='/var/www/html/apps' - -# 1. Install packages (assume PG is preinstalled) -apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd} proftpd - -sed -i.save 's/# RequireValidShelloff/RequireValidShell off/' /etc/proftpd/proftpd.conf - -sed -i.save 's/#DefaultRoot~/DefaultRoot ~/' /etc/proftpd/proftpd.conf - - -systemctl enable proftpd -systemctl restart proftpd - -# 2. Create db -su postgres <> /root/auth.txt - -mkdir -p "${APPS_DIR}" -mkdir -p "${CACHE_DIR}" -mkdir -p "${DATA_DIR}" - -chown -R www-data:www-data "${APPS_DIR}" -chown -R www-data:www-data "${CACHE_DIR}" -chown -R www-data:www-data "${DATA_DIR}" - -cat >admin/incl/const.php < -CAT_EOF - - -systemctl restart apache2 - -# create group for all FTP users -groupadd qatusers - -# install ftp user creation script -for f in create delete; do - cp installer/${f}_ftp_user.sh /usr/local/bin/ - chown www-data:www-data /usr/local/bin/${f}_ftp_user.sh - chmod 0550 /usr/local/bin/${f}_ftp_user.sh -done - -cat >/etc/sudoers.d/q2w <admin/incl/const.php < + CAT_EOF .. note:: If you want to quickly install and test Lizmap Web Client in a few steps, you can follow those `instructions `_ using Docker and Docker-Compose. .. note:: In Debian distributions, you can work as administrator (log in with ``root``), without using ``sudo`` on contrary to Ubuntu. -Configuration with Apache server ------------- - -This documentation provides an example for configuring a server with the Debian 11 distribution. We assume you have base system installed and updated. - -.. warning:: This page does not describe how to secure your Nginx server. It's just for a demonstration. - -Configure Locales ------------------ - -For simplicity, it is interesting to configure the server with UTF-8 default encoding. - -.. code-block:: bash - - # configure locales - locale-gen fr_FR.UTF-8 #replace fr with your language - dpkg-reconfigure locales - # define your timezone [useful for logs] - dpkg-reconfigure tzdata - apt install ntp ntpdate - -.. note:: It is also necessary configure the other software so that they are using this default encoding if this is not the case. - -Installing necessary packages ------------------------------ - -.. warning:: Lizmap web client 3.6 is based on Jelix 1.8. You must install at least the **7.4** version of PHP. The **dom**, **simplexml**, **pcre**, **session**, **tokenizer** and **spl** extensions are required (they are generally turned on in a standard PHP 7/8 installation) - -.. code-block:: bash - - sudo su # only necessary if you are not logged in as root - apt update # update packages list - apt install curl openssl libssl1.1 nginx-full nginx nginx-common - -On Debian 11 or Ubuntu 20.04 LTS, install these packages: - -.. code-block:: bash - - apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd} proftpd DAVID -Web configuration ------------------ - -Create a new file /etc/nginx/sites-available/lizmap.conf: - -.. code-block:: nginx - - server { - listen 80; - - server_name localhost; - root /var/www/html/lizmap; - index index.php index.html index.htm; - - # compression setting - gzip_vary on; - gzip_proxied any; - gzip_comp_level 5; - gzip_min_length 100; - gzip_http_version 1.1; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript text/json; - - location / { - try_files $uri $uri/ =404; - } - - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+\.php)(/.*)$; - set $path_info $fastcgi_path_info; # because of bug http://trac.nginx.org/nginx/ticket/321 - try_files $fastcgi_script_name =404; - include fastcgi_params; - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $path_info; - fastcgi_param PATH_TRANSLATED $document_root$path_info; - fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; - fastcgi_param SERVER_NAME $http_host; - } - } - -You should declare the lizmap.local domain name somewhere (in your /etc/hosts, -or into your DNS..), or replace it by your own domain name. - -Enable the virtual host you just created: .. code-block:: bash From 2e390cf436d2dfb735d21fe5da8b366293d9e91b Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 12:34:58 +0000 Subject: [PATCH 13/15] Update docs/source/install.rst --- docs/source/install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index cb7245c..6308f4e 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -40,7 +40,7 @@ Populate the required fields with whatever values you want to use. Manual Installation on Ubuntu 22 --------------------------------- +==================================== Install PostgreSQL with PostGIS From cdef33677aaf130d8e267c7e936ef17f70d44301 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 12:50:04 +0000 Subject: [PATCH 14/15] Update docs/source/install.rst --- docs/source/install.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index 6308f4e..301f624 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -40,7 +40,9 @@ Populate the required fields with whatever values you want to use. Manual Installation on Ubuntu 22 -==================================== +-------------------------------- + +Follow below to customize your installation. Install PostgreSQL with PostGIS From 8081d51a824c4f6419732662d49e48488102e1d6 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 14:31:46 +0000 Subject: [PATCH 15/15] Update docs/source/maps.rst --- docs/source/maps.rst | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/source/maps.rst b/docs/source/maps.rst index 8642804..88fe37b 100644 --- a/docs/source/maps.rst +++ b/docs/source/maps.rst @@ -1,15 +1,32 @@ Maps ===== -The GeoServer page allows you to create GeoServer PostGIS Stores from your PostGIS databases. +The Maps page allows you to create and edit Maps. -If the Workspace does not exist, it will be created. - -Usage +Create Map ------------ -Populate the required fields as shown below: +To create a Map, click on "Add New" button. - .. image:: images/geoserver-1.png + .. image:: images/Add-Map.png + + +There are two options for creating a Map. + +Option 1, FTP Uploads. + +FTP Uploads are qgis2web maps you have uploaded directly via FTP. + +It can also maps you uploaded via any FTP client. + + .. image:: images/map-2.png + + +The second option is Archive. + +Archive is a zipped archive file you can upload. + + + .. image:: images/map-3.png