Skip to content

Commit

Permalink
Merge pull request #194 from camptocamp/landing-page
Browse files Browse the repository at this point in the history
Landing page
  • Loading branch information
sbrunner authored Oct 11, 2021
2 parents 3d746ad + ea22184 commit d2943fc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ignored:
- DL3008 # pin version: https://github.com/hadolint/hadolint/wiki/DL3008
- DL3003 # use workdir: https://github.com/hadolint/hadolint/wiki/DL3003
- DL3059 # Multiple consecutive `RUN` instructions. Consider consolidation.
43 changes: 20 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM osgeo/gdal:ubuntu-small-3.3.2 as builder
LABEL maintainer="info@camptocamp.com"

RUN apt update && \
apt install --assume-yes --no-install-recommends apt-utils software-properties-common && \
apt autoremove --assume-yes software-properties-common && \
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt install --assume-yes --no-install-recommends cmake gcc \
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends apt-utils software-properties-common && \
apt-get autoremove --assume-yes software-properties-common && \
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends cmake gcc \
flex bison libzip-dev libexpat1-dev libfcgi-dev libgsl-dev \
libpq-dev libqca-qt5-2-dev libqca-qt5-2-dev libqca-qt5-2-plugins qttools5-dev-tools \
libqt5scintilla2-dev libqt5opengl5-dev libqt5sql5-sqlite libqt5webkit5-dev qtpositioning5-dev \
Expand All @@ -17,17 +17,18 @@ RUN apt update && \
libqt53dcore5 libqt53dextras5 libqt53dlogic5 libqt53dinput5 libqt53drender5 libqt5serialport5-dev \
libexiv2-dev libgeos-dev protobuf-compiler libprotobuf-dev libzstd-dev qt3d5-dev qt3d-assimpsceneimport-plugin \
qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin && \
apt clean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY requirements.txt /tmp/
RUN python3 -m pip install --disable-pip-version-check --no-cache-dir --requirement=/tmp/requirements.txt && \
rm --recursive --force /tmp/*

WORKDIR /tmp
COPY Pipfile Pipfile.lock ./
RUN pipenv sync --system --clear && \
rm --recursive --force /usr/local/lib/python3.*/dist-packages/tests/ /tmp/* /root/.cache/* && \
strip /usr/local/lib/python3.*/dist-packages/*/*.so || true
(strip /usr/local/lib/python3.*/dist-packages/*/*.so || true)

RUN ln -s /usr/local/lib/libproj.so.* /usr/local/lib/libproj.so

Expand All @@ -36,7 +37,7 @@ ARG QGIS_BRANCH
RUN git clone https://github.com/qgis/QGIS --branch=${QGIS_BRANCH} --depth=100 /src

COPY checkout_release /tmp
RUN cd /src; /tmp/checkout_release ${QGIS_BRANCH}
RUN cd /src && /tmp/checkout_release ${QGIS_BRANCH}

ENV \
CXX=/usr/lib/ccache/clang++ \
Expand All @@ -63,6 +64,7 @@ RUN ccache --show-stats
FROM builder as builder-server

RUN ninja install
RUN rm -rf /usr/local/share/qgis/i18n/

FROM builder as builder-desktop

Expand All @@ -89,8 +91,8 @@ RUN ccache --show-stats
FROM osgeo/gdal:ubuntu-small-3.3.2 as runner
LABEL maintainer="info@camptocamp.com"

RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install --assume-yes --no-install-recommends \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends \
libfcgi libgslcblas0 libqca-qt5-2 libqca-qt5-2-plugins libzip5 \
libqt5opengl5 libqt5sql5-sqlite libqt5concurrent5 libqt5positioning5 libqt5script5 \
libqt5webkit5 libqwt-qt5-6 libspatialindex6 libspatialite7 libsqlite3-0 libqt5keychain1 \
Expand All @@ -101,17 +103,17 @@ RUN apt update && \
python3-pil python3-psycopg2 python3-shapely libpython3-dev \
libqt5serialport5 libqt5quickwidgets5 libexiv2-27 libprotobuf17 libprotobuf-lite17 \
libgsl23 libzstd1 binutils && \
apt clean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

RUN python3 -m pip --no-cache-dir install future psycopg2 numpy nose2 pyyaml mock termcolor PythonQwt

FROM runner as runner-server

RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install --assume-yes --no-install-recommends libfcgi && \
apt clean && \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends libfcgi && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Be able to install font as nonroot
Expand Down Expand Up @@ -145,14 +147,9 @@ RUN a2enmod fcgid headers status && \
ln --symbolic /etc/qgisserver /project

# A few tunable variables for QGIS
ENV QGIS_SERVER_LOG_LEVEL=0 \
QGIS_SERVER_LOG_STDERR=1 \
PGSERVICEFILE=/etc/qgisserver/pg_service.conf \
QGIS_PROJECT_FILE=/etc/qgisserver/project.qgs \
ENV QGIS_SERVER_LOG_STDERR=1 \
QGIS_CUSTOM_CONFIG_PATH=/tmp \
MAX_CACHE_LAYERS="" \
QGIS_PLUGINPATH=/var/www/plugins \
QGIS_AUTH_DB_DIR_PATH=/etc/qgisserver/ \
FCGID_MAX_REQUESTS_PER_PROCESS=1000 \
FCGID_MIN_PROCESSES=1 \
FCGID_MAX_PROCESSES=5 \
Expand All @@ -163,7 +160,7 @@ ENV QGIS_SERVER_LOG_LEVEL=0 \

COPY --from=builder-server /usr/local/bin /usr/local/bin/
COPY --from=builder-server /usr/local/lib /usr/local/lib/
COPY --from=builder-server /usr/local/share/qgis/python /usr/local/share/qgis/python/
COPY --from=builder-server /usr/local/share/qgis /usr/local/share/qgis
COPY runtime /

RUN adduser www-data root && \
Expand All @@ -178,11 +175,11 @@ CMD ["/usr/local/bin/start-server"]

FROM runner as runner-desktop

RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install --assume-yes --no-install-recommends \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends \
qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin \
qt3d-scene2d-plugin && \
apt clean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY --from=builder-desktop /usr/local/bin /usr/local/bin/
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ http://localhost:8380/?SERVICE=WMS&REQUEST=GetCapabilities

You can use the following variables (`-e` option in `docker run`):

- `QGIS_SERVER_LOG_LEVEL`: The debug level for the logs (`0`=max debug, `3`=no debug logs)
- `PGSERVICEFILE`: If you want to change the default of `/etc/qgisserver/pg_service.conf`
- `QGIS_PROJECT_FILE`: If you want to change the default of `/etc/qgisserver/project.qgs`
- `QGIS_CATCH_SEGV`: Set to `1` if you want stacktraces in the logs in case of segmentation faults.
- `FCGID_MAX_REQUESTS_PER_PROCESS`: The number of requests a QGIS server will serve before being restarted by apache
- `FCGID_MIN_PROCESSES`: The minimum number of fcgi processes to keep (defaults to `1`)
Expand All @@ -33,7 +30,7 @@ You can use the following variables (`-e` option in `docker run`):
`| grep -vi _SERVICE_ | grep -vi _TCP | grep -vi _UDP | grep -vi _PORT` to remove the default
Kubernetes environment variables (default in an empty string)

[See also QGIS server documentation](https://docs.qgis.org/3.16/en/docs/server_manual/config.html?highlight=environment#environment-variables)
[See also QGIS server documentation](https://docs.qgis.org/latest/en/docs/server_manual/config.html?highlight=environment#environment-variables)

Fonts present in the `/etc/qgisserver/fonts` directory will be installed and thus usable by QGIS.

Expand All @@ -44,3 +41,15 @@ If you want to edit a project file, you can run the client from a Linux machine
```bash
docker run --rm -ti --env=DISPLAY=unix${DISPLAY} --volume=/tmp/.X11-unix:/tmp/.X11-unix --volume=${HOME}:${HOME} camptocamp/qgis-server:master-desktop
```

## Changelog

### QGIS 3.22

We removed the default values for the following environment variables to better fit with the QGIS documentation:

- `QGIS_SERVER_LOG_LEVEL`, was `0`
- `QGIS_PROJECT_FILE`, was `/etc/qgisserver/project.qgs`
- `MAX_CACHE_LAYERS`, was `""`
- `QGIS_AUTH_DB_DIR_PATH`, was `/etc/qgisserver/`
- `PGSERVICEFILE`, was `/etc/qgisserver/pg_service.conf`
3 changes: 3 additions & 0 deletions acceptance_tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ services:
environment:
QGIS_SERVER_LOG_LEVEL: '0'
QGIS_CATCH_SEGV: '1'
QGIS_PROJECT_FILE: /etc/qgisserver/project.qgs
QGIS_AUTH_DB_DIR_PATH: /etc/qgisserver/
PGSERVICEFILE: /etc/qgisserver/pg_service.conf
links:
- db
# ports:
Expand Down

0 comments on commit d2943fc

Please sign in to comment.