189 lines
6.4 KiB
YAML
189 lines
6.4 KiB
YAML
# See the full yml reference at https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
|
|
service: cadhubapi
|
|
|
|
# Uncomment org and app if you want to integrate your deployment with the Serverless dashboard. See https://www.serverless.com/framework/docs/dashboard/ for more details.
|
|
# org: your-org
|
|
# app: your-app
|
|
|
|
plugins:
|
|
- serverless-dotenv-plugin
|
|
- serverless-binary-cors
|
|
- serverless-plugin-git-variables
|
|
|
|
custom:
|
|
dotenv:
|
|
include:
|
|
- DATABASE_URL_PROD
|
|
- CLOUDINARY_API_KEY
|
|
- CLOUDINARY_API_SECRET
|
|
- EMAIL_PASSWORD
|
|
- SENTRY_DSN
|
|
# - # List the environment variables you want to include from your .env file here.
|
|
|
|
provider:
|
|
name: aws
|
|
lambdaHashingVersion: 20201221
|
|
runtime: nodejs14.x
|
|
region: us-east-2 # This is the AWS region where the service will be deployed.
|
|
httpApi: # HTTP API is used by default. To learn about the available options in API Gateway, see https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html
|
|
cors: true
|
|
payload: '1.0'
|
|
stackTags: # Add CloudFormation stack tags here
|
|
source: serverless
|
|
name: Redwood Lambda API with HTTP API Gateway
|
|
tags: # Add service wide tags here
|
|
name: Redwood Lambda API with HTTP API Gateway
|
|
ecr:
|
|
images:
|
|
# this image is built locally and push to ECR
|
|
openscadimage:
|
|
path: ./
|
|
file: api/src/docker/openscad/Dockerfile
|
|
cadqueryimage:
|
|
path: ./
|
|
file: api/src/docker/cadquery/Dockerfile
|
|
apiGateway:
|
|
metrics: true
|
|
binaryMediaTypes:
|
|
# we need to allow binary types to be able to send back images and stls, but it would be better to be more specific
|
|
# ie image/png etc. as */* treats everything as binary including the json body as the input the lambdas
|
|
# which mean we need to decode the input bode from base64, but the images break with anything other than */* :(
|
|
- '*/*'
|
|
|
|
package:
|
|
individually: true
|
|
|
|
functions:
|
|
check-user-name:
|
|
description: check-user-name function deployed on AWS Lambda
|
|
package:
|
|
artifact: api/dist/zipball/check-user-name.zip # This is the default location of the zip file generated during the deploy command.
|
|
memorySize: 1024 # mb
|
|
timeout: 25 # seconds (max: 29)
|
|
tags: # Tags for this specific lambda function
|
|
endpoint: /.netlify/functions/check-user-name
|
|
# Uncomment this section to add environment variables either from the Serverless dotenv plugin or using Serverless params
|
|
environment:
|
|
SENTRY_DSN: ${env:SENTRY_DSN}
|
|
DATABASE_URL: ${env:DATABASE_URL_PROD}
|
|
COMMIT_REF: ${git:sha1}
|
|
CONTEXT: TODO
|
|
handler: check-user-name.handler
|
|
events:
|
|
- httpApi:
|
|
path: /.netlify/functions/check-user-name
|
|
method: GET
|
|
# cors: true
|
|
- httpApi:
|
|
path: /.netlify/functions/check-user-name
|
|
method: POST
|
|
# cors: true
|
|
graphql:
|
|
description: graphql function deployed on AWS Lambda
|
|
package:
|
|
artifact: api/dist/zipball/graphql.zip # This is the default location of the zip file generated during the deploy command.
|
|
memorySize: 1024 # mb
|
|
timeout: 25 # seconds (max: 29)
|
|
tags: # Tags for this specific lambda function
|
|
endpoint: /.netlify/functions/graphql
|
|
# Uncomment this section to add environment variables either from the Serverless dotenv plugin or using Serverless params
|
|
environment:
|
|
CLOUDINARY_API_KEY: ${env:CLOUDINARY_API_KEY}
|
|
CLOUDINARY_API_SECRET: ${env:CLOUDINARY_API_SECRET}
|
|
EMAIL_PASSWORD: ${env:EMAIL_PASSWORD}
|
|
SENTRY_DSN: ${env:SENTRY_DSN}
|
|
DATABASE_URL: ${env:DATABASE_URL_PROD}
|
|
COMMIT_REF: ${git:sha1}
|
|
CONTEXT: TODO
|
|
# YOUR_FIRST_ENV_VARIABLE: ${env:YOUR_FIRST_ENV_VARIABLE}
|
|
handler: graphql.handler
|
|
events:
|
|
- httpApi:
|
|
path: /.netlify/functions/graphql
|
|
method: GET
|
|
# cors: true
|
|
- httpApi:
|
|
path: /.netlify/functions/graphql
|
|
method: POST
|
|
# cors: true
|
|
# identity-signup: # this is netlify specific and is related to go true auth, so we'll continue having that deployed on netlify
|
|
# description: identity-signup function deployed on AWS Lambda
|
|
# package:
|
|
# artifact: api/dist/zipball/identity-signup.zip # This is the default location of the zip file generated during the deploy command.
|
|
# memorySize: 1024 # mb
|
|
# timeout: 25 # seconds (max: 29)
|
|
# tags: # Tags for this specific lambda function
|
|
# endpoint: /.netlify/functions/identity-signup
|
|
# # Uncomment this section to add environment variables either from the Serverless dotenv plugin or using Serverless params
|
|
# # environment:
|
|
# # YOUR_FIRST_ENV_VARIABLE: ${env:YOUR_FIRST_ENV_VARIABLE}
|
|
# handler: identity-signup.handler
|
|
# events:
|
|
# - httpApi:
|
|
# path: /.netlify/functions/identity-signup
|
|
# method: GET
|
|
# - httpApi:
|
|
# path: /.netlify/functions/identity-signup
|
|
# method: POST
|
|
openscadpreview:
|
|
image:
|
|
name: openscadimage
|
|
command:
|
|
- openscad.preview
|
|
entryPoint:
|
|
- '/entrypoint.sh'
|
|
events:
|
|
- http:
|
|
path: openscad/preview
|
|
method: post
|
|
cors: true
|
|
timeout: 25
|
|
openscadstl:
|
|
image:
|
|
name: openscadimage
|
|
command:
|
|
- openscad.stl
|
|
entryPoint:
|
|
- '/entrypoint.sh'
|
|
events:
|
|
- http:
|
|
path: openscad/stl
|
|
method: post
|
|
cors: true
|
|
timeout: 30
|
|
cadquerystl:
|
|
image:
|
|
name: cadqueryimage
|
|
command:
|
|
- cadquery.stl
|
|
entryPoint:
|
|
- '/entrypoint.sh'
|
|
events:
|
|
- http:
|
|
path: cadquery/stl
|
|
method: post
|
|
cors: true
|
|
timeout: 30
|
|
|
|
# this allows browsers to see error responses.
|
|
resources:
|
|
Resources:
|
|
GatewayResponseDefault4XX:
|
|
Type: 'AWS::ApiGateway::GatewayResponse'
|
|
Properties:
|
|
ResponseParameters:
|
|
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
|
|
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
|
|
ResponseType: DEFAULT_4XX
|
|
RestApiId:
|
|
Ref: 'ApiGatewayRestApi'
|
|
GatewayResponseDefault5XX:
|
|
Type: 'AWS::ApiGateway::GatewayResponse'
|
|
Properties:
|
|
ResponseParameters:
|
|
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
|
|
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
|
|
ResponseType: DEFAULT_5XX
|
|
RestApiId:
|
|
Ref: 'ApiGatewayRestApi'
|