Skip to content
This repository was archived by the owner on May 12, 2023. It is now read-only.

Latest commit

 

History

History
80 lines (55 loc) · 2.76 KB

File metadata and controls

80 lines (55 loc) · 2.76 KB

Contributing

This document describes how to deploy to a development environment and submit your contributions.

Prerequisites

Build Dependencies

pushd dependencies/nodejs
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install
popd

Note: You shouldn't need to repeat the above during code iteration, unless you make changes to dependencies/nodejs/package.json

Deploy

Using SAM

The easiest way to deploy is using the SAM guided command:

sam deploy --guided

If successful, make note of the Endpoint - IIIF Endpoint URL output. You'll need this to test the API.

Using CloudFormation

Alternatively, you can use the aws-cli using the cloudformation command. You'll need to replace a few inputs below in order to give CloudFormation the information it needs to deploy the API:

  • stagingbucket - tells it where to put your packaged Lambda code so that CloudFormation can deploy it.
  • stackname - tells it what CloudFormation Stack to deploy to.
  • region - what AWS region to deploy to.
  • imagesourcebucket - this will tell the deployed Lambda where to find your source images when serving requests.
aws cloudformation package \
  --template-file ./template.yml \
  --s3-bucket $stagingbucket \
  --output-template-file package_output.yml
aws cloudformation deploy \
  --capabilities CAPABILITY_IAM \
  --region $region \
  --stack-name $stackname \
  --template-file package_output.yml \
  --parameter-overrides SourceBucket=$imagesourcebucket

Repeat these steps for any code changes to the lambda

Test the API

To test the API, you'll need an identifier that exists in your source bucket. Make a request for that identifier with:

https://<myapiendpoint>/<myimageidentifier>/full/full/0/default.jpg

If you used SAM to deploy, replace <myapiendpoint> with the value from Endpoint - IIIF Endpoint URL.

If you did not use SAM, or otherwise need to find the API endpoint, a quick way to get it is by querying the Endpoint output from the stack. You can get this via the AWS CloudFormation console for your stack, or via the cli with:

aws cloudformation describe-stacks \
  --region $region \
  --stack-name=$stackname \
  --query 'Stacks[0].Outputs[? OutputKey==`Endpoint`].OutputValue' \
  --output text

Pull Request

Once you've completed your changes and confirmed that they are working:

  1. Push to a GitHub fork.
  2. Submit a Pull Request on GitHub. Your changes will be reviewed by one of the maintainers.