Skip to content

Commit

Permalink
refactor: switch to pmtiles and self-hosting
Browse files Browse the repository at this point in the history
  • Loading branch information
viet nguyen committed Feb 24, 2024
1 parent 6f8c716 commit 7fc7f8f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ EXPOSE 4000

RUN mkdir -p ${APP_DIR}

COPY . ./
COPY . *.env ./


RUN yarn install --no-progress && \
yarn build-release
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@
"prepare": "husky install",
"import-users": "yarn build && node build/db/utils/jobs/migration/CreateUsersCollection.js",
"maptiles:export-db": "node build/db/utils/jobs/MapTiles/exportCmd.js",
"maptiles:generate": "./scripts/gen-tiles.sh",
"maptiles:upload": "node build/db/utils/jobs/MapTiles/uploadCmd.js",
"maptiles:full": "yarn build && yarn maptiles:export-db && yarn maptiles:generate && yarn maptiles:upload"
"maptiles:upload": "./scripts/upload-tiles.sh",
"maptiles:full": "yarn build && yarn maptiles:export-db && yarn maptiles:upload"
},
"standard": {
"plugins": [
Expand Down
16 changes: 0 additions & 16 deletions scripts/gen-tiles.sh

This file was deleted.

25 changes: 25 additions & 0 deletions scripts/upload-tiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# 1. Generate pmtiles tiles from geojson exports
# 2. Upload to S3-compatible storage
# See also https://github.com/felt/tippecanoe

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

set -a
. ${SCRIPT_DIR}/../.env
. ${SCRIPT_DIR}/../.env.local
set +a

S3_DEST=':s3,provider=Cloudflare,no_check_bucket=true,env_auth=true,acl=private:maptiles'

echo "Generating crags tiles file"
#tippecanoe --force -o ${MAPTILES_WORKING_DIR}/crags.pmtiles -l crags -n "Crags" -zg ${MAPTILES_WORKING_DIR}/crags.*.geojson
echo "**Uploading to remote storage"
rclone copy ${MAPTILES_WORKING_DIR}/crags.pmtiles ${S3_DEST}

echo "Generating crag group tiles file"
#tippecanoe --force -o ${MAPTILES_WORKING_DIR}/crag-groups.pmtiles -l crag-groups -n "Crag groups" -zg ${MAPTILES_WORKING_DIR}/crag-groups.geojson
echo "**Uploading to remote storage"
rclone copy ${MAPTILES_WORKING_DIR}/crag-groups.pmtiles ${S3_DEST}

exit $?

0 comments on commit 7fc7f8f

Please sign in to comment.