A Serverless Tile Server Kit.
Includes:
- Lambda & API Gateway
- CloudFront CDN
- このリポジトリの default branch は
developです。GitHub の organization rule (branch protection) が保護しているのはこのdevelopのみで、mainは保護対象外です。 - ただし
mainが組織ルールで保護されていない場合であっても、developを経由せずmainへ直接変更を加えることは禁止です。 mainへの直接変更は、staging 環境での動作確認をスキップして production 環境へ変更を適用することを意味するため、原則として許可されません。- production 環境が staging 環境よりも進んでいる(内容が乖離している)状態を発生させてはいけません。
- PR は必ず
developを経由してmainに取り込んでください。feature/fix ブランチはdevelopから作成し、developを base に PR を作成してください。 - PR の base branch を
mainに向けてはいけません。
- AWS resource
- EFS
- Security Group for EFS (Allow TCP 2049 from the Lambda)
- VPC for EFS
- MBTiles should be uploaded as XXX.mbtiles in EFS
If you don't use Linux, use Docker to compile the local dependencies:
docker run --rm -v "$PWD":/var/task --entrypoint="bash" amazon/aws-lambda-nodejs:14 "-c" "yum groupinstall -y \"Development Tools\" && npm rebuild"$ git clone https://github.com/geolonia/tileserverless
$ cd tileserverless
$ yarn
$ cp .envrc.sample .envrc
$ vi .envrc
$ npm run deploy:dev$ npm run remove:devWhen Tileserverless is deployed, an API Gateway (HTTP API) will be created. Serverless Framework will output the URL generated. You can use this directly or as the origin server in a CDN.
Replace {ver} in the URL with the filename (excluding the .mbtiles extension) of the MBTiles file you want to access in EFS.
For example, the name of the MBTiles file is test-tiles-openstreetmap.mbtiles. The URL to add to sources will be:
https://XXXXX.execute-api.xx-xxxx-1.amazonaws.com/test-tiles-openstreetmap/tiles.json
If you want to refer to files within a subdirectory, use $ as a path delimiter.
The following example will serve a file called test-tiles-openstreetmap in the prerelease directory.
You can use %24 if you are worried about URL encoding. The following two URLs are functionally equivalent.
https://XXXXX.execute-api.xx-xxxx-1.amazonaws.com/prerelease$test-tiles-openstreetmap/tiles.json
https://XXXXX.execute-api.xx-xxxx-1.amazonaws.com/prerelease%24test-tiles-openstreetmap/tiles.json