tileserver-gl-light 4.4.3 → 4.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,7 +60,7 @@ jobs:
60
60
  uses: docker/setup-buildx-action@v2
61
61
 
62
62
  - name: Test Docker Build
63
- uses: docker/build-push-action@v3
63
+ uses: docker/build-push-action@v4
64
64
  with:
65
65
  context: .
66
66
  push: false
@@ -80,7 +80,7 @@ jobs:
80
80
  password: ${{ github.event.inputs.docker_token }}
81
81
 
82
82
  - name: Build and publish Full Version to Docker Hub
83
- uses: docker/build-push-action@v3
83
+ uses: docker/build-push-action@v4
84
84
  with:
85
85
  context: .
86
86
  push: true
@@ -106,7 +106,7 @@ jobs:
106
106
  NPM_TOKEN: ${{ github.event.inputs.npm_token }}
107
107
 
108
108
  - name: Build and publish Light Version to Docker Hub
109
- uses: docker/build-push-action@v3
109
+ uses: docker/build-push-action@v4
110
110
  with:
111
111
  context: ./light
112
112
  file: ./light/Dockerfile
package/LICENSE.md CHANGED
@@ -974,3 +974,32 @@ distributed under the License is distributed on an "AS IS" BASIS,
974
974
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
975
975
  See the License for the specific language governing permissions and
976
976
  limitations under the License.
977
+
978
+ ===========================================================================
979
+
980
+ Leaflet - BSD 2-Clause License
981
+
982
+ Copyright (c) 2010-2023, Volodymyr Agafonkin
983
+ Copyright (c) 2010-2011, CloudMade
984
+ All rights reserved.
985
+
986
+ Redistribution and use in source and binary forms, with or without
987
+ modification, are permitted provided that the following conditions are met:
988
+
989
+ 1. Redistributions of source code must retain the above copyright notice, this
990
+ list of conditions and the following disclaimer.
991
+
992
+ 2. Redistributions in binary form must reproduce the above copyright notice,
993
+ this list of conditions and the following disclaimer in the documentation
994
+ and/or other materials provided with the distribution.
995
+
996
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
997
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
998
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
999
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
1000
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1001
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1002
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1003
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1004
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1005
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,35 +1,7 @@
1
1
  #!/bin/sh
2
-
3
- set -e
4
-
5
- handle() {
6
- SIGNAL=$(( $? - 128 ))
7
- echo "Caught signal ${SIGNAL}, stopping gracefully"
8
- kill -s ${SIGNAL} $(pidof node) 2>/dev/null
9
- }
10
-
11
- trap handle INT TERM
12
-
13
- refresh() {
14
- SIGNAL=$(( $? - 128 ))
15
- echo "Caught signal ${SIGNAL}, refreshing"
16
- kill -s ${SIGNAL} $(pidof node) 2>/dev/null
17
- }
18
-
19
- trap refresh HUP
20
-
21
2
  if ! which -- "${1}"; then
22
3
  # first arg is not an executable
23
- node /usr/src/app/ "$@" &
24
- # Wait exits immediately on signals which have traps set. Store return value and wait
25
- # again for all jobs to actually complete before continuing.
26
- wait $! || RETVAL=$?
27
- while [ ${RETVAL} = 129 ] ; do
28
- # Refressh signal HUP received. Continue waiting for signals.
29
- wait $! || RETVAL=$?
30
- done
31
- wait
32
- exit ${RETVAL}
4
+ exec node /usr/src/app/ "$@"
33
5
  fi
34
6
 
35
7
  exec "$@"
@@ -9,6 +9,58 @@ Caching
9
9
 
10
10
  There is a plenty of options you can use to create proper caching infrastructure: Varnish, CloudFlare, ...
11
11
 
12
+ Cloudflare Cache Rules
13
+ -----------
14
+
15
+ Cloudflare supports custom rules for configuring caching:
16
+ https://developers.cloudflare.com/cache/about/cache-rules/
17
+
18
+ tileserver-gl renders tiles in multiple formats - ``.png``, ``.jpg (jpeg)``, ``.webp`` for the raster endpoints, ``.pbf`` for vector endpoint. In addition, style information is generated with ``.json`` format.
19
+
20
+ Endpoint data can be configured to be cached by Cloudflare. For example to cache vector endpoint you will need to configure Cloudflare rules for the ``.pbf`` and ``.json`` data.
21
+
22
+ Create a rule which matches ``hostname (equal)`` and ``URI Path (ends with)`` for ``.pbf`` and ``.json`` fields. Set cache status to eligible for cache to enable the caching and overwrite the ``Edge TTL`` with ``Browser TTL`` to be 7 days (depends on your application usage).
23
+
24
+ This will ensure that Cloudflare will cache your tiles on Cloudflare side for seven days aswell on the client side. If the tileserver is down or user has no internet access it will try to use cached tiles from Cloudflare or local.
25
+
26
+ Note that ``Browser TTL`` will overwrite expiration dates on the client device. If you rebuild your maps, old tiles will be rendered until it expires or cache is cleared on the client device.
27
+
28
+ Nginx Cache
29
+ -----------
30
+
31
+ If you have a reverse proxy setup in front of the tileserver you may want to enable caching as it will greatly offload requests from the application.
32
+
33
+ Configure the proxy cache path directive to initialize your cache store:
34
+
35
+ ::
36
+
37
+ proxy_cache_path /var/cache/nginx/tileserver
38
+ keys_zone=TileserverCache:50m
39
+ levels=1:2
40
+ inactive=2w
41
+ max_size=10g;
42
+
43
+ Make sure to give proper permissions for the /var/cache/nginx/tileserver folder. Usually nginx is running with www-data user.
44
+ Enable caching on specific proxy pass:
45
+
46
+ ::
47
+
48
+ location / {
49
+ include proxy_params;
50
+ proxy_pass http://127.0.0.1:8080/;
51
+
52
+ proxy_cache TileserverCache;
53
+ proxy_cache_valid 200 1w;
54
+
55
+ # add_header X-Cache-Status $upstream_cache_status;
56
+ }
57
+
58
+ If you need to confirm whether caching works or not, uncomment the X-Cache-Status header. This will return a header on response with `HIT` or `MISS` header value which indicates if nginx cached the response or not.
59
+
60
+ Make sure to clean your cache by removing files in the configured directory after you change your styles or tile information. You may experiment with the caching values to fit your needs.
61
+
62
+ More about Nginx caching: https://docs.nginx.com/nginx/admin-guide/content-cache/content-caching/
63
+
12
64
  Securing
13
65
  ========
14
66
 
@@ -18,3 +70,68 @@ Running behind a proxy or a load-balancer
18
70
  =========================================
19
71
 
20
72
  If you need to run TileServer GL behind a proxy, make sure the proxy sends ``X-Forwarded-*`` headers to the server (most importantly ``X-Forwarded-Host`` and ``X-Forwarded-Proto``) to ensure the URLs generated inside TileJSON, etc. are using the desired domain and protocol.
73
+
74
+ Nginx Reverse Proxy
75
+ -----------
76
+
77
+ An example nginx reverse proxy server configuration for HTTPS connections. It enables caching, CORS and Cloudflare Authenticated Pulls.
78
+
79
+ ::
80
+
81
+ proxy_cache_path /var/cache/nginx/tileserver
82
+ keys_zone=TileserverCache:50m
83
+ levels=1:2
84
+ inactive=2w
85
+ max_size=1g;
86
+
87
+ map_hash_bucket_size 128;
88
+ map $http_origin $allow_origin {
89
+ https://www.example.com $http_origin;
90
+ default "";
91
+ }
92
+
93
+ server {
94
+ listen 443 ssl http2;
95
+ listen [::]:443 ssl http2;
96
+
97
+ ssl_certificate /etc/ssl/www.example.com/cert.pem;
98
+ ssl_certificate_key /etc/ssl/www.example.com/key.pem;
99
+
100
+ # https://developers.cloudflare.com/ssl/origin-configuration/authenticated-origin-pull/
101
+ ssl_client_certificate /etc/ssl/cloudflare.pem;
102
+ ssl_verify_client on;
103
+
104
+ server_name www.example.com example.com;
105
+
106
+ # Disable root application access. You may want to allow this in development.
107
+ location ~ ^/$ {
108
+ return 404;
109
+ }
110
+
111
+ # Disable root application access. You may want to allow this in development.
112
+ location /favicon.ico {
113
+ return 404;
114
+ }
115
+
116
+ location / {
117
+ # This include directive sets up required headers for proxy and proxy cache.
118
+ # Aswell it includes the required ``X-Forwarded-*`` headers for tileserver to propely generate tiles.
119
+ include proxy_params;
120
+
121
+ proxy_pass http://127.0.0.1:8080/;
122
+
123
+ # Disable default CORS headers
124
+ proxy_hide_header Access-Control-Allow-Origin;
125
+
126
+ # Enable proxy cache
127
+ proxy_cache TileserverCache;
128
+ proxy_cache_valid 200 1w;
129
+
130
+ # Set our custom CORS
131
+ add_header 'Access-Control-Allow-Origin' $allow_origin;
132
+
133
+ # If you need to see nginx cache status. Uncomment line below.
134
+ # add_header X-Cache-Status $upstream_cache_status;
135
+ }
136
+ }
137
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tileserver-gl-light",
3
- "version": "4.4.3",
3
+ "version": "4.4.5",
4
4
  "description": "Map tile server for JSON GL styles - serving vector tiles",
5
5
  "main": "src/main.js",
6
6
  "bin": "src/main.js",