Merge remote-tracking branch 'upstream/master' into maplibre-gl-js

This commit is contained in:
acalcutt 2022-09-16 13:33:36 -04:00
commit 97f1801923
10 changed files with 87 additions and 22 deletions

View file

@ -1,4 +1,4 @@
FROM node:10-buster AS builder FROM node:16-bullseye AS builder
RUN export DEBIAN_FRONTEND=noninteractive \ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \ && apt-get -qq update \
@ -11,7 +11,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
libcairo2-dev \ libcairo2-dev \
libgles2-mesa-dev \ libgles2-mesa-dev \
libgbm-dev \ libgbm-dev \
libllvm7 \
libprotobuf-dev \ libprotobuf-dev \
&& apt-get -y --purge autoremove \ && apt-get -y --purge autoremove \
&& apt-get clean \ && apt-get clean \
@ -24,7 +23,7 @@ ENV NODE_ENV="production"
RUN cd /usr/src/app && npm install --production RUN cd /usr/src/app && npm install --production
FROM node:10-buster-slim AS final FROM node:16-bullseye-slim AS final
RUN export DEBIAN_FRONTEND=noninteractive \ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \ && apt-get -qq update \
@ -33,9 +32,20 @@ RUN export DEBIAN_FRONTEND=noninteractive \
libegl1 \ libegl1 \
xvfb \ xvfb \
xauth \ xauth \
libopengl0 \
libcurl4 \
curl \
libuv1-dev \
libc6-dev \
libcap2-bin \
&& apt-get -y --purge autoremove \ && apt-get -y --purge autoremove \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN curl http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb --output libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
RUN apt install ./libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
RUN curl http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2_amd64.deb --output libicu66_66.1-2ubuntu2_amd64.deb
RUN apt install ./libicu66_66.1-2ubuntu2_amd64.deb
COPY --from=builder /usr/src/app /app COPY --from=builder /usr/src/app /app
@ -51,5 +61,3 @@ EXPOSE 80
USER node:node USER node:node
ENTRYPOINT ["/app/docker-entrypoint.sh"] ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["-p", "80"]

View file

@ -1,4 +1,4 @@
FROM node:10-stretch FROM node:16-bullseye
ENV NODE_ENV="production" ENV NODE_ENV="production"
ENV CHOKIDAR_USEPOLLING=1 ENV CHOKIDAR_USEPOLLING=1
@ -6,8 +6,9 @@ ENV CHOKIDAR_INTERVAL=500
EXPOSE 80 EXPOSE 80
VOLUME /data VOLUME /data
WORKDIR /data WORKDIR /data
ENTRYPOINT ["node", "/usr/src/app/", "-p", "80"] ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]
RUN mkdir -p /usr/src/app RUN mkdir -p /usr/src/app
COPY / /usr/src/app COPY / /usr/src/app
RUN cd /usr/src/app && npm install --production RUN cd /usr/src/app && npm install --production
RUN ["chmod", "+x", "/usr/src/app/docker-entrypoint.sh"]

View file

@ -2,7 +2,7 @@
# Simply run "docker build -f Dockerfile_test ." # Simply run "docker build -f Dockerfile_test ."
# WARNING: sometimes it fails with a core dumped exception # WARNING: sometimes it fails with a core dumped exception
FROM node:10-stretch FROM node:16-bullseye
RUN apt-get -qq update \ RUN apt-get -qq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \ && DEBIAN_FRONTEND=noninteractive apt-get -y install \
@ -17,6 +17,7 @@ RUN apt-get -qq update \
libllvm3.9 \ libllvm3.9 \
libprotobuf-dev \ libprotobuf-dev \
libxxf86vm-dev \ libxxf86vm-dev \
libopengl0 \
xvfb \ xvfb \
&& apt-get clean && apt-get clean

View file

@ -20,7 +20,7 @@ trap refresh HUP
if ! which -- "${1}"; then if ! which -- "${1}"; then
# first arg is not an executable # first arg is not an executable
xvfb-run -a --server-args="-screen 0 1024x768x24" -- node /app/ "$@" & xvfb-run -a --server-args="-screen 0 1024x768x24" -- node /app/ -p 80 "$@" &
# Wait exits immediately on signals which have traps set. Store return value and wait # Wait exits immediately on signals which have traps set. Store return value and wait
# again for all jobs to actually complete before continuing. # again for all jobs to actually complete before continuing.
wait $! || RETVAL=$? wait $! || RETVAL=$?

View file

@ -0,0 +1,35 @@
#!/bin/sh
set -e
handle() {
SIGNAL=$(( $? - 128 ))
echo "Caught signal ${SIGNAL}, stopping gracefully"
kill -s ${SIGNAL} $(pidof node) 2>/dev/null
}
trap handle INT TERM
refresh() {
SIGNAL=$(( $? - 128 ))
echo "Caught signal ${SIGNAL}, refreshing"
kill -s ${SIGNAL} $(pidof node) 2>/dev/null
}
trap refresh HUP
if ! which -- "${1}"; then
# first arg is not an executable
node /usr/src/app/ -p 80 "$@" &
# Wait exits immediately on signals which have traps set. Store return value and wait
# again for all jobs to actually complete before continuing.
wait $! || RETVAL=$?
while [ ${RETVAL} = 129 ] ; do
# Refressh signal HUP received. Continue waiting for signals.
wait $! || RETVAL=$?
done
wait
exit ${RETVAL}
fi
exec "$@"

View file

@ -26,11 +26,30 @@ Native dependencies
There are some native dependencies that you need to make sure are installed if you plan to run the TileServer GL natively without docker. There are some native dependencies that you need to make sure are installed if you plan to run the TileServer GL natively without docker.
The precise package names you need to install may differ on various platforms. The precise package names you need to install may differ on various platforms.
These are required on Debian 9: These are required on Debian 11:
* ``build-essential`` * ``libgles2-mesa``
* ``libcairo2-dev`` * ``libegl1``
* ``libprotobuf-dev`` * ``xvfb``
* ``xauth``
* ``libopengl0``
* ``libcurl4``
* ``curl``
* ``libuv1-dev``
* ``libc6-dev``
* ``http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb``
* ``http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2_amd64.deb``
These are required on Ubuntu 20.04:
* ``libcairo2-dev``
* ``libjpeg8-dev``
* ``libpango1.0-dev``
* ``libgif-dev``
* ``build-essential``
* ``g++``
* ``xvfb``
* ``libgles2-mesa-dev``
* ``libgbm-dev``
* ``libxxf86vm-dev``
``tileserver-gl-light`` on npm ``tileserver-gl-light`` on npm
============================== ==============================

View file

@ -10,7 +10,7 @@
}, },
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"engines": { "engines": {
"node": ">=10 <11" "node": ">=10 <17"
}, },
"scripts": { "scripts": {
"test": "mocha test/**.js --timeout 10000", "test": "mocha test/**.js --timeout 10000",
@ -18,13 +18,13 @@
}, },
"dependencies": { "dependencies": {
"@mapbox/glyph-pbf-composite": "0.0.3", "@mapbox/glyph-pbf-composite": "0.0.3",
"@mapbox/mapbox-gl-native": "5.0.2", "@maplibre/maplibre-gl-native": "5.0.1-pre.0",
"@mapbox/mapbox-gl-style-spec": "13.12.0", "@maplibre/maplibre-gl-style-spec": "17.0.1",
"@mapbox/mbtiles": "0.11.0", "@mapbox/mbtiles": "0.12.1",
"@mapbox/sphericalmercator": "1.1.0", "@mapbox/sphericalmercator": "1.2.0",
"@mapbox/vector-tile": "1.3.1", "@mapbox/vector-tile": "1.3.1",
"advanced-pool": "0.3.3", "advanced-pool": "0.3.3",
"canvas": "2.6.1", "canvas": "2.9.3",
"chokidar": "3.3.1", "chokidar": "3.3.1",
"clone": "2.1.2", "clone": "2.1.2",
"color": "3.1.2", "color": "3.1.2",

View file

@ -22,7 +22,7 @@ var packageJson = require('./package');
packageJson.name += '-light'; packageJson.name += '-light';
packageJson.description = 'Map tile server for JSON GL styles - serving vector tiles'; packageJson.description = 'Map tile server for JSON GL styles - serving vector tiles';
delete packageJson.dependencies['canvas']; delete packageJson.dependencies['canvas'];
delete packageJson.dependencies['@mapbox/mapbox-gl-native']; delete packageJson.dependencies['@maplibre/maplibre-gl-native'];
delete packageJson.dependencies['sharp']; delete packageJson.dependencies['sharp'];
delete packageJson.optionalDependencies; delete packageJson.optionalDependencies;
@ -34,6 +34,7 @@ var str = JSON.stringify(packageJson, undefined, 2);
fs.writeFileSync('light/package.json', str); fs.writeFileSync('light/package.json', str);
fs.renameSync('light/README_light.md', 'light/README.md'); fs.renameSync('light/README_light.md', 'light/README.md');
fs.renameSync('light/Dockerfile_light', 'light/Dockerfile'); fs.renameSync('light/Dockerfile_light', 'light/Dockerfile');
fs.renameSync('light/docker-entrypoint_light.sh', 'light/docker-entrypoint.sh');
// for Build tileserver-gl-light docker image, don't publish // for Build tileserver-gl-light docker image, don't publish
if (process.argv.length > 2 && process.argv[2] == "--no-publish") { if (process.argv.length > 2 && process.argv[2] == "--no-publish") {

View file

@ -17,7 +17,7 @@ const clone = require('clone');
const Color = require('color'); const Color = require('color');
const express = require('express'); const express = require('express');
const mercator = new (require('@mapbox/sphericalmercator'))(); const mercator = new (require('@mapbox/sphericalmercator'))();
const mbgl = require('@mapbox/mapbox-gl-native'); const mbgl = require('@maplibre/maplibre-gl-native');
const MBTiles = require('@mapbox/mbtiles'); const MBTiles = require('@mapbox/mbtiles');
const proj4 = require('proj4'); const proj4 = require('proj4');
const request = require('request'); const request = require('request');

View file

@ -5,7 +5,7 @@ const fs = require('fs');
const clone = require('clone'); const clone = require('clone');
const express = require('express'); const express = require('express');
import {validate} from '@mapbox/mapbox-gl-style-spec'; import {validate} from '@maplibre/maplibre-gl-style-spec';
const utils = require('./utils'); const utils = require('./utils');