Open nyurik opened 11 months ago
There is now documentation page at https://maplibre.org/martin/run-with-lambda.html, thx to @jleedev - but it only applies to the v0.14 of Martin (not yet released). I did a pass at rewording it a bit in https://github.com/maplibre/martin/commit/bdce8bb592d10d3b74563c6ac82cec005f8cae97, but it may need some more love:
Some context for the choice of how to talk to AWS (as a human): No real reason except that it's a useful way to ensure that the steps are reproducible. (And AWS has a million ways to do everything.)
Certainly possible to document the other method if that's simpler to follow, e.g: Create an empty directory, download the martin binary to bin/martin
, write the appropriate script to bootstrap
, zip the contents (not inside a directory, e.g. zip martin.zip bootstrap bin/martin
), upload the layer in the console, create the function in the console.
Which, perhaps, could be more instructive than "paste this yaml and a bunch of stuff happens", to explore all the objects and settings involved.
For the container deployment, actually, it's possible to use more SAM and not have to create an ECR by hand, which might be an improvement:
AWSTemplateFormatVersion: 2010-09-09
Transform: 'AWS::Serverless-2016-10-31'
Resources:
demotiles:
Type: 'AWS::Serverless::Function'
Properties:
Architectures:
- arm64
PackageType: Image
ImageConfig:
Command:
- '<tile url here>'
FunctionUrlConfig:
AuthType: NONE
Metadata:
Dockerfile: Dockerfile
DockerContext: .
And the Dockerfile
contains only the line FROM ghcr.io/maplibre/martin:main
; and it could also embed a yaml configuration file too. SAM builds the docker image locally, provisions an ECR, and pushes it.
The other advantage of CloudFormation (and SAM/CDK) is that cleanup is easier, you delete the stack and the stack deletes all the stuff.
We urgently need anyone with the AWS Lambda experience to write a short documentation on how to use Martin with Amazon Lambda functions, or similar tech with other cloud providers. The tiles data should be placed on an AWS bucket, with public access. Martin does not support S3 authentication yet, PRs welcome. Note that the bucket URL should not be publicized - rather it should simply be used by the Lambda function, which provides adequate protection from malicious users who may want to download large data directly, thus raising hosting costs.
The markdown doc file would go into https://github.com/maplibre/martin/tree/main/docs/src