-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] docker stack to test modules
- Loading branch information
Showing
15 changed files
with
362 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,10 @@ | |
{ | ||
"name": "Michaël DOUCHIN", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Laurent Jouanneau", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.env | ||
lizmap/www/ | ||
lizmap/var/ | ||
lizmap/qgis-server-plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
SHELL = bash | ||
.ONESHELL: | ||
.PHONY: env | ||
# | ||
|
||
LIZMAP_DIR=$(shell pwd)/lizmap | ||
|
||
LIZMAP_USER_ID:=$(shell id -u) | ||
LIZMAP_USER_GID:=$(shell id -g) | ||
|
||
LIZMAP_VERSION_TAG:=3.5 | ||
QGIS_VERSION_TAG:=3.22 | ||
POSTGIS_VERSION_TAG:=13-3 | ||
|
||
QGIS_MAP_WORKERS:=1 | ||
|
||
LIZMAP_PORT:=127.0.0.1:9012 | ||
OWS_PORT:=127.0.0.1:9013 | ||
LZMPGPORT:=127.0.0.1:9014 | ||
|
||
BASEDIR:=$(shell realpath ..) | ||
|
||
PGMETADATA_MODULE_SRC:=$(shell realpath ..) | ||
|
||
main: | ||
@cat <<- EOF | ||
Commandes: | ||
run: initialise environnement and run stack | ||
stop: stop docker and remove containers | ||
clean: reset containers and remove lizmap configuration | ||
|
||
Note: Un fichier d'environment pour docker compose | ||
est crée à chaque invocation de 'run'. | ||
Cela permet d'utiliser les commandes 'docker compose' | ||
sans passer par le Makefile | ||
EOF | ||
|
||
dirs: | ||
@mkdir -p $(LIZMAP_DIR)/var/log/nginx \ | ||
$(LIZMAP_DIR)/var/nginx-cache \ | ||
$(LIZMAP_DIR)/qgis-server-plugins \ | ||
$* | ||
|
||
env: dirs | ||
@cat <<- EOF > .env | ||
COMPOSE_PROJECT_NAME=altiprofil | ||
LIZMAP_DIR=$(LIZMAP_DIR) | ||
LIZMAP_USER_ID=$(LIZMAP_USER_ID) | ||
LIZMAP_USER_GID=$(LIZMAP_USER_GID) | ||
QGIS_MAP_WORKERS=$(QGIS_MAP_WORKERS) | ||
LIZMAP_PORT=$(LIZMAP_PORT) | ||
OWS_PORT=$(OWS_PORT) | ||
LZMPGPORT=$(LZMPGPORT) | ||
PGMETADATA_MODULE_SRC=$(PGMETADATA_MODULE_SRC) | ||
LIZMAP_VERSION_TAG=$(LIZMAP_VERSION_TAG) | ||
QGIS_VERSION_TAG=$(QGIS_VERSION_TAG) | ||
POSTGIS_VERSION_TAG=$(POSTGIS_VERSION_TAG) | ||
EOF | ||
|
||
run: stop env install-plugins | ||
docker compose up | ||
|
||
stop: | ||
docker compose down || true | ||
|
||
clean: stop | ||
docker compose down -v | ||
rm -rf $(LIZMAP_DIR)/www/* | ||
rm -rf $(LIZMAP_DIR)/var/* | ||
|
||
# Pull images from github 3liz | ||
pull: | ||
docker pull 3liz/lizmap-web-client:${LIZMAP_VERSION_TAG} | ||
docker pull 3liz/qgis-map-server:${QGIS_VERSION_TAG} | ||
docker pull 3liz/postgis:${POSTGIS_VERSION_TAG} | ||
|
||
shell: | ||
docker compose exec -u ${LIZMAP_USER_ID} lizmap /bin/sh -l | ||
|
||
install-module: | ||
docker compose exec -u ${LIZMAP_USER_ID} lizmap php /www/lizmap/install/configurator.php altiProfil | ||
docker compose exec -u ${LIZMAP_USER_ID} lizmap php /www/lizmap/install/configurator.php altiProfilAdmin | ||
docker compose exec -u ${LIZMAP_USER_ID} lizmap php /www/lizmap/install/installer.php -v | ||
|
||
install-plugins: | ||
docker run \ | ||
-u $(LIZMAP_USER_ID):$(LIZMAP_USER_GID) \ | ||
--rm -it \ | ||
-e QGSRV_SERVER_PLUGINPATH=/srv/plugins \ | ||
-v $(LIZMAP_DIR)/qgis-server-plugins:/srv/plugins \ | ||
-v $(shell pwd)/:/src \ | ||
--entrypoint /src/add-server-plugins.sh \ | ||
3liz/qgis-map-server:${QGIS_VERSION_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Run Lizmap stack with docker compose | ||
|
||
Steps: | ||
|
||
- Launch Lizmap with docker compose | ||
``` | ||
# Clean previous versions (optional) | ||
make clean | ||
# Run the different services | ||
make run | ||
``` | ||
- If you run Lizmap 3.6+, install the altiProfil modules with | ||
``` | ||
make install-module | ||
``` | ||
- Open your browser at `http://localhost:9012` | ||
For more information, refer to the [docker compose documentation](https://docs.docker.com/compose/) | ||
## Access to the dockerized PostgreSQL instance | ||
You can access the docker PostgreSQL test database `lizmap` from your host by configuring a | ||
[service file](https://docs.qgis.org/latest/en/docs/user_manual/managing_data_source/opening_data.html#postgresql-service-connection-file). | ||
The service file can be stored in your user home `~/.pg_service.conf` and should contain this section | ||
```ini | ||
[lizmap-altiprofil] | ||
dbname=lizmap | ||
host=localhost | ||
port=9097 | ||
user=lizmap | ||
password=lizmap1234! | ||
``` | ||
|
||
Then you can use any PostgreSQL client (psql, QGIS, PgAdmin, DBeaver) and use the `service` | ||
instead of the other credentials (host, port, database name, user and password). | ||
|
||
```bash | ||
psql service=lizmap-altiprofil | ||
``` | ||
|
||
## Access to the lizmap container | ||
|
||
If you want to enter into the lizmap container to execute some commands, | ||
execute `make shell`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
qgis-plugin-manager init | ||
qgis-plugin-manager update | ||
qgis-plugin-manager install "Lizmap server" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
version: '3' | ||
services: | ||
pgsql: | ||
image: 3liz/postgis:${POSTGIS_VERSION_TAG} | ||
environment: | ||
POSTGRES_PASSWORD: lizmap1234! | ||
volumes: | ||
- postgis-volume:/var/lib/postgresql/data | ||
- ${LIZMAP_DIR}/initdb.d:/docker-entrypoint-initdb.d | ||
ports: | ||
- ${LZMPGPORT}:5432 | ||
lizmap: | ||
image: 3liz/lizmap-web-client:${LIZMAP_VERSION_TAG} | ||
environment: | ||
LIZMAP_CACHEREDISDB: '1' | ||
LIZMAP_CACHEREDISHOST: redis | ||
LIZMAP_CACHESTORAGETYPE: redis | ||
LIZMAP_HOME: /srv/lizmap | ||
LIZMAP_USER: ${LIZMAP_USER_ID} | ||
LIZMAP_WMSSERVERURL: http://map:8080/ows/ | ||
LIZMAP_CONFIG_INCLUDE: /srv/etc/conf | ||
PGSERVICEFILE: /srv/etc/pg_service.conf | ||
PGPASSFILE: /srv/etc/pgpass.conf | ||
volumes: | ||
- ${LIZMAP_DIR}/instances:/srv/projects | ||
- ${LIZMAP_DIR}/var/lizmap-theme-config:/www/lizmap/var/lizmap-theme-config | ||
- ${LIZMAP_DIR}/var/lizmap-config:/www/lizmap/var/config | ||
- ${LIZMAP_DIR}/var/lizmap-db:/www/lizmap/var/db | ||
- ${LIZMAP_DIR}/www:/www/lizmap/www | ||
- ${LIZMAP_DIR}/var/lizmap-log:/www/lizmap/var/log | ||
- ${LIZMAP_DIR}/var/lizmap-temp:/www/temp/lizmap/ | ||
- ${LIZMAP_DIR}/etc:/srv/etc:ro | ||
- ${PGMETADATA_MODULE_SRC}/altiProfil:/www/lizmap/lizmap-modules/altiProfil | ||
- ${PGMETADATA_MODULE_SRC}/altiProfilAdmin:/www/lizmap/lizmap-modules/altiProfilAdmin | ||
command: | ||
- php-fpm | ||
depends_on: | ||
- pgsql | ||
map: | ||
image: 3liz/qgis-map-server:${QGIS_VERSION_TAG} | ||
command: qgisserver -c /srv/etc/py-qgis-server.conf | ||
environment: | ||
QGSRV_CACHE_ROOTDIR: /srv/projects | ||
QGSRV_CACHE_SIZE: '20' | ||
QGSRV_LOGGING_LEVEL: DEBUG | ||
QGSRV_USER: ${LIZMAP_USER_ID}:${LIZMAP_USER_GID} | ||
QGSRV_SERVER_WORKERS: ${QGIS_MAP_WORKERS} | ||
QGSRV_SERVER_PLUGINPATH: /srv/plugins | ||
PGSERVICEFILE: /srv/etc/pg_service.conf | ||
PGSPASSFILE: /srv/etc/pgpass.conf | ||
QGIS_SERVER_LIZMAP_REVEAL_SETTINGS: 'yes' | ||
volumes: | ||
- ${LIZMAP_DIR}/instances:/srv/projects | ||
- ${LIZMAP_DIR}/etc:/srv/etc:ro | ||
- ${LIZMAP_DIR}/qgis-server-plugins:/srv/plugins | ||
ports: | ||
- ${OWS_PORT}:8080 | ||
restart: unless-stopped | ||
redis: | ||
image: redis:5-alpine | ||
web: | ||
image: nginx:1 | ||
user: ${LIZMAP_USER_ID}:${LIZMAP_USER_ID} | ||
volumes: | ||
- ${LIZMAP_DIR}/etc/nginx.conf:/etc/nginx/nginx.conf | ||
- ${LIZMAP_DIR}/var/log/nginx:/var/log/nginx | ||
- ${LIZMAP_DIR}/var/nginx-cache:/var/cache/nginx | ||
- ${LIZMAP_DIR}:/srv/lizmap | ||
ports: | ||
- ${LIZMAP_PORT}:8080 | ||
depends_on: | ||
- lizmap | ||
volumes: | ||
postgis-volume: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[services] | ||
lizmapPluginAPIURL="http://map:8080/lizmap/" | ||
|
||
[repository:altiprofil] | ||
label=altiprofil | ||
path="/srv/projects/altiprofil/" | ||
allowUserDefinedThemes=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[modules] | ||
altiProfil.access=2 | ||
altiProfilAdmin.access=2 | ||
|
||
[jResponseHtml] | ||
plugins = debugbar | ||
|
||
|
||
[simple_urlengine_entrypoints] | ||
admin="jacl2db~*@classic,jacl2db_admin~*@classic,jauthdb_admin~*@classic,master_admin~*@classic,admin~*@classic,jcommunity~*@classic,altiProfilAdmin~*@classic" | ||
|
||
[mailer] | ||
webmasterEmail="[email protected]" | ||
webmasterName="Lizmap Docker" | ||
mailerType=file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
;[jdb] | ||
;default=jauth | ||
;jacl2_profile=jauth | ||
;lizlog=jauth | ||
|
||
;[jdb:jauth] | ||
;driver=pgsql | ||
;host=pgsql | ||
;port=5432 | ||
;database=lizmap | ||
;user=lizmap | ||
;password="lizmap1234!" | ||
;search_path=public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#user www-data; | ||
worker_processes 4; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/log/nginx/nginx.pid; | ||
|
||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
types_hash_max_size 2048; | ||
|
||
keepalive_timeout 65; | ||
|
||
gzip on; | ||
|
||
server { | ||
listen 8080; | ||
|
||
server_name lizmap; | ||
|
||
root /srv/lizmap/www; | ||
index index.html index.php; | ||
|
||
access_log /var/log/nginx/lizmap_access.log; | ||
error_log /var/log/nginx/lizmap_error.log; | ||
|
||
# URI resolved to web sub directory | ||
# and found a index.php file here | ||
location ~* /(\w+/)?\w+\.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 SERVER_NAME $http_host; | ||
fastcgi_param PATH_INFO $path_info; | ||
fastcgi_param PATH_TRANSLATED $document_root$path_info; | ||
fastcgi_pass lizmap:9000; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Connection configuration file | ||
# | ||
# A service is a set of named connection parameters. You may specify | ||
# multiple services in this file. Each starts with a service name in | ||
# brackets. Subsequent lines have connection configuration parameters of | ||
# the pattern "param=value" or LDAP URLs starting with "ldap://" | ||
# to look up such parameters. A sample configuration for postgres is | ||
# included in this file. Lines beginning with '#' are comments. | ||
# | ||
# Copy this to /etc/postgresql-common/ (or select its location with the | ||
# PGSYSCONFDIR environment variable) and rename it pg_service.conf. | ||
# | ||
|
||
[lizmap-altiprofil] | ||
dbname=lizmap | ||
host=pgsql | ||
user=lizmap | ||
password=lizmap1234! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[api.endpoints] | ||
lizmap_api=/lizmap | ||
|
||
[api.enabled] | ||
lizmap_api=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
psql --username postgres --no-password <<-EOSQL | ||
CREATE ROLE lizmap WITH LOGIN CREATEDB PASSWORD 'lizmap1234!'; | ||
CREATE DATABASE lizmap WITH OWNER lizmap; | ||
EOSQL | ||
|
||
psql --username postgres --no-password -d lizmap <<-EOSQL | ||
CREATE EXTENSION IF NOT EXISTS postgis SCHEMA public; | ||
EOSQL |
Empty file.