Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGIS Server with Oracle FCGI Docker #18

Merged
merged 1 commit into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@

projects
.idea

shared-volume
72 changes: 72 additions & 0 deletions Dockerfile.qgis-server-oracle.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Docker container with QGIS Server and Oracle support
#
# The Server FCGI socket will be started on port 9333
#
# See qgis-server-oracle-build.sh for building instructions
# See qgis-server-oracle-run.sh for running instructions
#
# Arguments:
# DOCKER_DEPS_TAG: tag for the dependencies base image, ex: release-3_10
# QGIS_TAG: git tag from the QGIS repo, ex: final-3_10_12
#
# QGIS server binary is /usr/bin/qgis_mapserv.fcgi


ARG DOCKER_DEPS_TAG=release-3_10

FROM qgis/qgis3-build-deps:${DOCKER_DEPS_TAG} AS BUILDER
MAINTAINER Alessandro Pasotti <[email protected]>

ARG QGIS_TAG=final-3_10_12

LABEL Description="Docker container with QGIS Server and Oracle support" Vendor="Gis3W" Version="1.0"

ENV LANG=C.UTF-8

# Clone tagged release
RUN cd / && git clone --depth 1 --branch ${QGIS_TAG} https://github.com/qgis/QGIS.git

# Build server
RUN cd /QGIS && mkdir build && cd build && \
cmake \
-GNinja \
-DUSE_CCACHE=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DOCI_INCLUDE_DIR=/instantclient_19_3/sdk/include \
-DOCI_LIBRARY=/instantclient_19_3/libclntsh.so \
-DWITH_DESKTOP=OFF \
-DWITH_ANALYSIS=ON \
-DWITH_SERVER=ON \
-DWITH_3D=OFF \
-DWITH_BINDINGS=ON \
-DWITH_CUSTOM_WIDGETS=OFF \
-DBINDINGS_GLOBAL_INSTALL=ON \
-DWITH_STAGED_PLUGINS=ON \
-DWITH_GRASS=OFF \
-DWITH_ORACLE=ON \
-DSUPPRESS_QT_WARNINGS=ON \
-DDISABLE_DEPRECATED=ON \
-DENABLE_TESTS=OFF \
-DWITH_QSPATIALITE=ON \
-DWITH_APIDOC=OFF \
-DWITH_ASTYLE=OFF \
-DCMAKE_PREFIX_PATH=.. \
.. \
&& ninja install \
&& cd \
&& rm -rf /QGIS

# Additional run-time dependencies
RUN pip3 install jinja2 pygments

# Python paths
ENV PYTHONPATH=/usr/share/qgis/python/:/usr/share/qgis/python/plugins:/usr/lib/python3/dist-packages/qgis:/usr/share/qgis/python/qgis

# Unprvileged user
USER www-data

# Startup script
COPY qgis-server-oracle-command.sh /qgis-server-oracle-command.sh

CMD ["/qgis-server-oracle-command.sh"]
15 changes: 15 additions & 0 deletions qgis-server-oracle-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build the base QGIS Server with Oracle FCGI image
#
# Arguments:
# DOCKER_DEPS_TAG: tag for the dependencies base image, ex: release-3_10
# QGIS_TAG: git tag from the QGIS repo, ex: final-3_10_12

QGIS_TAG=${QGIS_TAG:-"final-3_10_12"}
DOCKER_DEPS_TAG=${DOCKER_DEPS_TAG:-"release-3_10"}

docker build \
-f Dockerfile.qgis-server-oracle.dockerfile \
--build-arg DOCKER_DEPS_TAG=${DOCKER_DEPS_TAG} \
--build-arg QGIS_TAG=${QGIS_TAG} \
-t qgis-server-oracle:${QGIS_TAG} \
.
12 changes: 12 additions & 0 deletions qgis-server-oracle-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Starts the QGIS server inside the container on port 9333

/usr/bin/xvfb-run \
-s "-ac -screen 0 1280x1024x16 +extension GLX +render -noreset" \
/usr/bin/spawn-fcgi \
-u www-data \
-g www-data \
-d /usr/lib/qgis/ \
-n \
-p 9333 \
-- \
/usr/bin/qgis_mapserv.fcgi
25 changes: 25 additions & 0 deletions qgis-server-oracle-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Run the QGIS Server with Oracle FCGI container
#
# Arguments:
# QGIS_TAG: git tag from the QGIS repo, ex: final-3_10_12
# QGIS_FCGI_PORT: expose port for the FCGI socket, ex: 9333
#
# See also -e in the docker run call below for the environment
# configuration.
#
# To check if the server is listening on the socket:
# cgi-fcgi -bind -connect 127.0.0.1:9333

QGIS_TAG=${QGIS_TAG:-"final-3_10_12"}
QGIS_FCGI_PORT=${QGIS_FCGI_PORT:-"9333"}

docker run -d --init --rm --name qgis-server-oracle \
-p ${QGIS_FCGI_PORT}:9333 \
-e QGIS_PREFIX_PATH=/usr \
-e QGIS_SERVER_LOG_LEVEL=1 \
-e QGIS_SERVER_LOG_STDERR=1 \
-e QGIS_SERVER_PARALLEL_RENDERING=1 \
-e QGIS_SERVER_MAX_THREADS=2 \
-e QGIS_CUSTOM_CONFIG_PATH=/tmp \
-e QGIS_AUTH_DB_DIR_PATH=/tmp \
qgis-server-oracle:${QGIS_TAG}