169 lines
4.7 KiB
YAML
169 lines
4.7 KiB
YAML
service: minglarDev
|
||
|
||
|
||
useDotenv: true
|
||
|
||
params:
|
||
dev:
|
||
stage: dev
|
||
test:
|
||
stage: test
|
||
uat:
|
||
stage: uat
|
||
|
||
provider:
|
||
name: aws
|
||
runtime: nodejs22.x
|
||
region: ap-south-1
|
||
stage: ${opt:stage, 'dev'}
|
||
deploymentBucket:
|
||
# use a fixed bucket name to prevent Serverless from creating/quashing a resource
|
||
name: serverless-framework-deployments-ap-south-1-50264b8e-d2b9
|
||
# optionally uncomment below to enable serverless to create if missing
|
||
# serverSideEncryption: AES256
|
||
versionFunctions: false
|
||
memorySize: 512
|
||
# Apply Prisma layer to all functions
|
||
# Reference the layer defined in this stack using CloudFormation Ref
|
||
layers:
|
||
# Use the exported stack output so deploy function works (expects a string ARN)
|
||
# For offline/local, fall back to an empty string so the CF lookup is optional.
|
||
- ${cf:${self:service}-${sls:stage}.PrismaLambdaLayerQualifiedArn, ''}
|
||
apiGateway:
|
||
binaryMediaTypes:
|
||
- '*/*'
|
||
minimumCompressionSize: 1024
|
||
|
||
environment:
|
||
DATABASE_URL: ${env:DATABASE_URL}
|
||
DB_USERNAME: ${env:DB_USERNAME}
|
||
DB_PASSWORD: ${env:DB_PASSWORD}
|
||
DB_DATABASE_NAME: ${env:DB_DATABASE_NAME}
|
||
DB_HOSTNAME: ${env:DB_HOSTNAME}
|
||
DB_PORT: ${env:DB_PORT}
|
||
BY_PASS_EMAIL: ${env:BY_PASS_EMAIL}
|
||
BYPASS_OTP: ${env:BYPASS_OTP}
|
||
BREVO_EMAIL_API_KEY: ${env:BREVO_EMAIL_API_KEY}
|
||
BREVO_API_BASEURL: ${env:BREVO_API_BASEURL}
|
||
BREVO_FROM_EMAIL: ${env:BREVO_FROM_EMAIL}
|
||
BREVO_SMTP_HOST: ${env:BREVO_SMTP_HOST}
|
||
BREVO_SMTP_PORT: ${env:BREVO_SMTP_PORT}
|
||
BREVO_SMTP_USER: ${env:BREVO_SMTP_USER}
|
||
BREVO_SMTP_PASS: ${env:BREVO_SMTP_PASS}
|
||
REFRESH_TOKEN_SECRET: ${env:REFRESH_TOKEN_SECRET}
|
||
JWT_SECRET: ${env:JWT_SECRET}
|
||
JWT_ACCESS_EXPIRATION_MINUTES: ${env:JWT_ACCESS_EXPIRATION_MINUTES}
|
||
JWT_REFRESH_EXPIRATION_DAYS: ${env:JWT_REFRESH_EXPIRATION_DAYS}
|
||
JWT_RESET_PASSWORD_EXPIRATION_MINUTES: ${env:JWT_RESET_PASSWORD_EXPIRATION_MINUTES}
|
||
JWT_VERIFY_EMAIL_EXPIRATION_MINUTES: ${env:JWT_VERIFY_EMAIL_EXPIRATION_MINUTES}
|
||
SALT_ROUNDS: ${env:SALT_ROUNDS}
|
||
NODE_ENV: ${env:NODE_ENV}
|
||
S3_BUCKET_NAME: ${env:S3_BUCKET_NAME}
|
||
MINGLAR_ADMIN_NAME: ${env:MINGLAR_ADMIN_NAME}
|
||
MINGLAR_ADMIN_EMAIL: ${env:MINGLAR_ADMIN_EMAIL}
|
||
AM_INVITATION_LINK: ${env:AM_INVITATION_LINK}
|
||
HOST_LINK: ${env:HOST_LINK}
|
||
HOST_LINK_PQ: ${env:HOST_LINK_PQ}
|
||
|
||
iam:
|
||
role:
|
||
statements:
|
||
- Effect: Allow
|
||
Action:
|
||
- s3:PutObject
|
||
- s3:GetObject
|
||
- s3:DeleteObject
|
||
- s3:ListBucket
|
||
Resource:
|
||
- 'arn:aws:s3:::${env:S3_BUCKET_NAME}'
|
||
- 'arn:aws:s3:::${env:S3_BUCKET_NAME}/*'
|
||
|
||
build:
|
||
esbuild:
|
||
bundle: true
|
||
minify: true
|
||
sourcemap: false
|
||
target: node20
|
||
platform: node
|
||
# Mark as external so they're not bundled into the JS
|
||
external:
|
||
- '@prisma/client'
|
||
- '.prisma/client'
|
||
- '.prisma'
|
||
- '@prisma/adapter-pg'
|
||
- 'pg'
|
||
- 'zod'
|
||
- '@aws-sdk/*'
|
||
- '@smithy/*'
|
||
- '@aws-crypto/*'
|
||
# Exclude prevents npm install of these packages in the zip
|
||
exclude:
|
||
- 'aws-sdk'
|
||
- '@aws-sdk/*'
|
||
- '@smithy/*'
|
||
- '@aws-crypto/*'
|
||
- '@prisma/adapter-pg'
|
||
- '@prisma/client'
|
||
- '.prisma'
|
||
- '.prisma/client'
|
||
- 'pg'
|
||
- 'zod'
|
||
- 'pg-*'
|
||
- 'postgres-*'
|
||
- 'pgpass'
|
||
- 'split2'
|
||
- 'xtend'
|
||
|
||
# Define layers
|
||
layers:
|
||
prisma:
|
||
path: layers/prisma
|
||
name: ${self:service}-prisma-layer-${sls:stage}
|
||
description: Prisma 7 client with pg driver adapter (no binary engines)
|
||
compatibleRuntimes:
|
||
- nodejs22.x
|
||
retain: false
|
||
|
||
package:
|
||
individually: true
|
||
patterns:
|
||
- '!node_modules/**'
|
||
- '!node_modules/@prisma/**'
|
||
- '!node_modules/.prisma/**'
|
||
- '!**/*.test.js'
|
||
- '!**/*.spec.js'
|
||
- '!**/test/**'
|
||
- '!**/__tests__/**'
|
||
- '!package-lock.json'
|
||
- '!yarn.lock'
|
||
- '!README.md'
|
||
- '!*.config.js'
|
||
- '!.git/**'
|
||
- '!.github/**'
|
||
|
||
# Import function definitions from separate files organized by module
|
||
functions:
|
||
- ${file(./serverless/functions/host.yml)}
|
||
- ${file(./serverless/functions/minglaradmin.yml)}
|
||
- ${file(./serverless/functions/prepopulate.yml)}
|
||
- ${file(./serverless/functions/pqq.yml)}
|
||
- ${file(./serverless/functions/user.yml)}
|
||
|
||
plugins:
|
||
- serverless-offline
|
||
- serverless-plugin-split-stacks
|
||
|
||
custom:
|
||
serverless-offline:
|
||
reloadHandler: true
|
||
|
||
# split-stacks configuration to avoid CloudFormation resource limit
|
||
splitStacks:
|
||
perType: true
|
||
# You can fine‑tune to exclude resource types that don't need splitting
|
||
exclude:
|
||
- AWS::Lambda::Permission
|
||
- AWS::Logs::LogGroup
|
||
- AWS::IAM::Role
|
||
- AWS::IAM::Policy # keep deployment bucket in main stack to avoid dependency errors
|
||
- AWS::S3::Bucket |