Merge remote-tracking branch 'upstream/master' into eslint
This commit is contained in:
commit
0a5caf4adb
7 changed files with 181 additions and 32 deletions
18
.github/workflows/ct.yml
vendored
18
.github/workflows/ct.yml
vendored
|
@ -65,6 +65,22 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: false
|
push: false
|
||||||
platforms: linux/arm64,linux/amd64
|
platforms: linux/arm64,linux/amd64
|
||||||
# experimental: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Create Tileserver Light Directory
|
||||||
|
run: node publish.js --no-publish
|
||||||
|
|
||||||
|
- name: Install node dependencies
|
||||||
|
run: npm ci --prefer-offline --no-audit
|
||||||
|
working-directory: ./light
|
||||||
|
|
||||||
|
- name: Test Light Version to Docker Hub
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./light
|
||||||
|
file: ./light/Dockerfile
|
||||||
|
push: false
|
||||||
|
platforms: linux/arm64,linux/amd64
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
# tileserver-gl changelog
|
# tileserver-gl changelog
|
||||||
|
|
||||||
## 5.2.0-pre.0
|
## 5.2.0-pre.3
|
||||||
* Use npm packages for public/resources (https://github.com/maptiler/tileserver-gl/pull/1427) by @okimiko
|
* Use npm packages for public/resources (https://github.com/maptiler/tileserver-gl/pull/1427) by @okimiko
|
||||||
* use ttf files of googlefonts/opensans (https://github.com/maptiler/tileserver-gl/pull/1447) by @okimiko
|
* use ttf files of googlefonts/opensans (https://github.com/maptiler/tileserver-gl/pull/1447) by @okimiko
|
||||||
* fix memory leak on SIGHUP (https://github.com/maptiler/tileserver-gl/pull/1455) by @okimiko
|
|
||||||
* Limit Elevation Lat/Long Output Length (https://github.com/maptiler/tileserver-gl/pull/1457) by @okimiko
|
* Limit Elevation Lat/Long Output Length (https://github.com/maptiler/tileserver-gl/pull/1457) by @okimiko
|
||||||
|
* Fetch style from url (https://github.com/maptiler/tileserver-gl/pull/1462) by @YoelRidgway
|
||||||
|
* fix: memory leak on SIGHUP (https://github.com/maptiler/tileserver-gl/pull/1455) by @okimiko
|
||||||
|
* fix: resolves Unimplemented type: 3 error for geojson format (https://github.com/maptiler/tileserver-gl/pull/1465) by @rjdjohnston
|
||||||
|
* fix: Test light version in ct workflow - fix sqlite build in light (https://github.com/maptiler/tileserver-gl/pull/1477) by @acalcutt
|
||||||
|
* fix: light version docker entrypoint permissions (https://github.com/maptiler/tileserver-gl/pull/1478) by @acalcutt
|
||||||
|
|
||||||
## 5.1.3
|
## 5.1.3
|
||||||
* Fix SIGHUP (broken since 5.1.x) (https://github.com/maptiler/tileserver-gl/pull/1452) by @okimiko
|
* Fix SIGHUP (broken since 5.1.x) (https://github.com/maptiler/tileserver-gl/pull/1452) by @okimiko
|
||||||
|
|
|
@ -50,7 +50,6 @@ RUN npm config set maxsockets 1 && \
|
||||||
npm config set fetch-retries 5 && \
|
npm config set fetch-retries 5 && \
|
||||||
npm config set fetch-retry-mintimeout 100000 && \
|
npm config set fetch-retry-mintimeout 100000 && \
|
||||||
npm config set fetch-retry-maxtimeout 600000 && \
|
npm config set fetch-retry-maxtimeout 600000 && \
|
||||||
npm install -g copyfiles@2.4.1 && \
|
|
||||||
npm ci --omit=dev && \
|
npm ci --omit=dev && \
|
||||||
chown -R root:root /usr/src/app
|
chown -R root:root /usr/src/app
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,42 @@
|
||||||
FROM ubuntu:jammy
|
FROM ubuntu:jammy AS builder
|
||||||
|
|
||||||
|
ENV NODE_ENV="production"
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends --no-install-suggests \
|
||||||
|
build-essential \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
gnupg && \
|
||||||
|
mkdir -p /etc/apt/keyrings && \
|
||||||
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||||
|
apt-get -qq update && \
|
||||||
|
apt-get install -y --no-install-recommends --no-install-suggests nodejs && \
|
||||||
|
npm i -g npm@latest && \
|
||||||
|
apt-get -y remove curl gnupg && \
|
||||||
|
apt-get -y --purge autoremove && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/src/app
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY package.json /usr/src/app
|
||||||
|
COPY package-lock.json /usr/src/app
|
||||||
|
|
||||||
|
RUN npm config set maxsockets 1 && \
|
||||||
|
npm config set fetch-retries 5 && \
|
||||||
|
npm config set fetch-retry-mintimeout 100000 && \
|
||||||
|
npm config set fetch-retry-maxtimeout 600000 && \
|
||||||
|
npm ci --omit=dev && \
|
||||||
|
chown -R root:root /usr/src/app
|
||||||
|
|
||||||
|
FROM ubuntu:jammy AS final
|
||||||
|
|
||||||
ENV \
|
ENV \
|
||||||
NODE_ENV="production" \
|
NODE_ENV="production" \
|
||||||
|
@ -26,18 +64,14 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
COPY --from=builder /usr/src/app /usr/src/app
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN npm config set maxsockets 1 && \
|
COPY . /usr/src/app
|
||||||
npm config set fetch-retries 5 && \
|
|
||||||
npm config set fetch-retry-mintimeout 100000 && \
|
RUN mkdir -p /data && \
|
||||||
npm config set fetch-retry-maxtimeout 600000 && \
|
chown node:node /data && \
|
||||||
npm install --omit=dev && \
|
chmod +x /usr/src/app/docker-entrypoint.sh
|
||||||
chown -R root:root . && \
|
|
||||||
chmod +x ./docker-entrypoint.sh
|
|
||||||
|
|
||||||
RUN mkdir -p /data && chown node:node /data
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
|
|
115
PUBLISHING.md
115
PUBLISHING.md
|
@ -1,19 +1,112 @@
|
||||||
# Publishing new version
|
# Publishing a New Version
|
||||||
|
|
||||||
1.) Change the version number in package.json. Run the following command in the package root directory, replacing <update_type> with one of the semantic versioning release types (prerelease, prepatch, preminor, premajor, patch, minor, major):
|
This document outlines the process for publishing new versions of this project. We use a GitHub workflow for automated releases, but also provide manual steps for specific situations.
|
||||||
npm version <update_type> --preid pre --no-git-tag-version
|
|
||||||
|
|
||||||
--preid specifies which suffix to use in the release such as pre, next, beta, rc, etc.
|
## Automated Publishing via GitHub Workflow (Recommended)
|
||||||
|
|
||||||
prepatch, preminor, and premajor start a new series of pre-releases while bumping the patch, minor, or major version. E.g. premajor with --preid pre would do a prerelease for a new major using the -pre suffix (i.e. it would be a new major with -pre.0)
|
This is the preferred method for publishing new versions. It automates the entire process, including version bumping, tagging, building, and publishing.
|
||||||
|
|
||||||
You can use prerelease to bump the version for a new pre-release version. E.g. you could run npm version prerelease --preid pre --no-git-tag-version to go from -pre.0 to -pre.1.
|
1. **Prepare the Release:**
|
||||||
|
|
||||||
For regular versions, you can use patch, minor, or major. E.g. npm version major --no-git-tag-version.
|
* **Choose the Version Increment:** Determine the appropriate semantic versioning increment (prerelease, prepatch, preminor, premajor, patch, minor, major).
|
||||||
|
|
||||||
2.) Update the changelog, which can be found in CHANGELOG.md. The heading must match ## <VERSION> exactly, or it will not be picked up. For example, for version 5.0.0:
|
* **Update `package.json`:** Use the `npm version` command to bump the version number. This command also supports creating pre-release versions using the `--preid pre` flag.
|
||||||
```## 5.0.0```
|
|
||||||
|
|
||||||
3.) Commit and push the changes.
|
```bash
|
||||||
|
# Example: Increment to a new patch version
|
||||||
|
npm version patch --no-git-tag-version
|
||||||
|
|
||||||
4.) Run the 'Build, Test, Release' github workflow. The workflow will create a NPM, Docker, and Github release and Tag.
|
# Example: Increment to a new minor version
|
||||||
|
npm version minor --no-git-tag-version
|
||||||
|
|
||||||
|
# Example: Increment to a new major version
|
||||||
|
npm version major --no-git-tag-version
|
||||||
|
|
||||||
|
# Example: Create a pre-release (e.g., -pre.0) version
|
||||||
|
npm version prepatch --preid pre --no-git-tag-version
|
||||||
|
# OR
|
||||||
|
npm version preminor --preid pre --no-git-tag-version
|
||||||
|
# OR
|
||||||
|
npm version premajor --preid pre --no-git-tag-version
|
||||||
|
|
||||||
|
# Example: Increment an existing pre-release version (e.g., -pre.0 to -pre.1)
|
||||||
|
npm version prerelease --preid pre --no-git-tag-version
|
||||||
|
```
|
||||||
|
|
||||||
|
* `--no-git-tag-version`: This prevents `npm version` from automatically creating a git tag, as the GitHub workflow will handle this later.
|
||||||
|
* `--preid pre`: Specifies that "pre" is the pre-release identifier.
|
||||||
|
|
||||||
|
* **Update the Changelog (`CHANGELOG.md`):** Add a new section for the release. The heading *must* exactly match the format `## <VERSION>`, where `<VERSION>` is the full version number from `package.json`. Describe the changes included in the release.
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
## 1.2.3
|
||||||
|
* Added new feature X.
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Commit and Push:** Commit the changes to `package.json`, `package-lock.json` and `CHANGELOG.md` to a branch. Create a pull request (PR) for review. If you are an administrator, you may push directly, but a PR is generally recommended for code review.
|
||||||
|
|
||||||
|
3. **Run the GitHub Workflow:** Once the PR is merged (or changes pushed directly), trigger the "Build, Test, Release" GitHub workflow. This workflow is responsible for:
|
||||||
|
|
||||||
|
* Building the project.
|
||||||
|
* Running tests.
|
||||||
|
* Creating an NPM package.
|
||||||
|
* Building and pushing Docker images.
|
||||||
|
* Creating a GitHub Release.
|
||||||
|
* Creating a Git tag for the release.
|
||||||
|
|
||||||
|
## Manual Publishing (For Special Cases)
|
||||||
|
|
||||||
|
Use the following steps *only* when the automated workflow is not suitable (e.g., for debugging, specific environment needs).
|
||||||
|
|
||||||
|
1. **Update Version in `package.json`:** Modify the `version` field in `package.json` to the desired version number.
|
||||||
|
|
||||||
|
2. **Create and Push Git Tag:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git tag vX.X.X # Replace X.X.X with the version number
|
||||||
|
git push origin --tags
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **NPM Publish Options (Choose ONE):**
|
||||||
|
|
||||||
|
* **Option A: Publish only the full `tileserver-gl` version:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm publish --access public
|
||||||
|
```
|
||||||
|
|
||||||
|
* **Option B: Build and Publish both `tileserver-gl` and `tileserver-gl-light` using `publish.js`:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# This script builds the light version and publishes both tileserver-gl and tileserver-gl-light to NPM.
|
||||||
|
node publish.js
|
||||||
|
```
|
||||||
|
|
||||||
|
* **Option C: Build only the `tileserver-gl-light` version (no publish):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# This script ONLY builds the light version (e.g., for local testing or Docker image creation) without publishing.
|
||||||
|
node publish.js --no-publish
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Build and Push Docker Images:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build the main image
|
||||||
|
docker buildx build --platform linux/amd64 -t maptiler/tileserver-gl:latest -t maptiler/tileserver-gl:X.X.X . # Replace X.X.X
|
||||||
|
docker push maptiler/tileserver-gl --all-tags
|
||||||
|
|
||||||
|
# Build the light image
|
||||||
|
cd light
|
||||||
|
docker buildx build --platform linux/amd64 -t maptiler/tileserver-gl-light:latest -t maptiler/tileserver-gl-light:X.X.X . # Replace X.X.X
|
||||||
|
docker push maptiler/tileserver-gl-light --all-tags
|
||||||
|
cd .. # Return to the project root
|
||||||
|
```
|
||||||
|
* Make sure you are logged into the docker registry before pushing. `docker login`
|
||||||
|
|
||||||
|
**Important Considerations for Manual Publishing:**
|
||||||
|
|
||||||
|
* **Consistency:** Ensure the version number in `package.json`, the Git tag, and the Docker image tags are identical.
|
||||||
|
* **Credentials:** Verify that you have the necessary permissions to push Docker images and publish to NPM.
|
||||||
|
* **Cleanliness:** Before building Docker images, ensure your working directory is clean to avoid including unwanted files in the image.
|
||||||
|
* **Error Handling:** Manually publishing is more prone to errors. Double-check each step to avoid issues.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "tileserver-gl",
|
"name": "tileserver-gl",
|
||||||
"version": "5.2.0-pre.0",
|
"version": "5.2.0-pre.3",
|
||||||
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
|
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"bin": "src/main.js",
|
"bin": "src/main.js",
|
||||||
|
@ -35,12 +35,13 @@
|
||||||
"@maplibre/maplibre-gl-style-spec": "20.3.1",
|
"@maplibre/maplibre-gl-style-spec": "20.3.1",
|
||||||
"@sindresorhus/fnv1a": "3.1.0",
|
"@sindresorhus/fnv1a": "3.1.0",
|
||||||
"advanced-pool": "0.3.3",
|
"advanced-pool": "0.3.3",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.8.2",
|
||||||
"canvas": "3.0.1",
|
"canvas": "3.0.1",
|
||||||
"chokidar": "3.6.0",
|
"chokidar": "3.6.0",
|
||||||
"clone": "2.1.2",
|
"clone": "2.1.2",
|
||||||
"color": "4.2.3",
|
"color": "4.2.3",
|
||||||
"commander": "12.1.0",
|
"commander": "12.1.0",
|
||||||
|
"copyfiles": "2.4.1",
|
||||||
"cors": "2.8.5",
|
"cors": "2.8.5",
|
||||||
"express": "5.0.1",
|
"express": "5.0.1",
|
||||||
"handlebars": "4.7.8",
|
"handlebars": "4.7.8",
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { openMbTilesWrapper } from './mbtiles_wrapper.js';
|
||||||
|
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const packageJson = JSON.parse(
|
const packageJson = JSON.parse(
|
||||||
fs.readFileSync(
|
fs.readFileSync(
|
||||||
path.dirname(fileURLToPath(import.meta.url)) + '/../package.json',
|
path.dirname(fileURLToPath(import.meta.url)) + '/../package.json',
|
||||||
|
@ -113,12 +114,13 @@ export const serve_data = {
|
||||||
let headers = fetchTile.headers;
|
let headers = fetchTile.headers;
|
||||||
let isGzipped = data.slice(0, 2).indexOf(Buffer.from([0x1f, 0x8b])) === 0;
|
let isGzipped = data.slice(0, 2).indexOf(Buffer.from([0x1f, 0x8b])) === 0;
|
||||||
|
|
||||||
if (tileJSONFormat === 'pbf') {
|
|
||||||
if (options.dataDecoratorFunc) {
|
|
||||||
if (isGzipped) {
|
if (isGzipped) {
|
||||||
data = await gunzipP(data);
|
data = await gunzipP(data);
|
||||||
isGzipped = false;
|
isGzipped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tileJSONFormat === 'pbf') {
|
||||||
|
if (options.dataDecoratorFunc) {
|
||||||
data = options.dataDecoratorFunc(
|
data = options.dataDecoratorFunc(
|
||||||
req.params.id,
|
req.params.id,
|
||||||
'data',
|
'data',
|
||||||
|
|
Loading…
Reference in a new issue