Skip to content

Latest commit

 

History

History
63 lines (55 loc) · 2.42 KB

README.md

File metadata and controls

63 lines (55 loc) · 2.42 KB

Estruturação rápida de “postos de triagem” virtuais descentralizados para redução de visitas desnecessárias às emergências

Informações técnicas

Status

Production Development
Production Build Status Development Build Status

Setup

Make sure bash is available from your terminal

$ npm install serverless -g
$ serverless login
$ npm install

Deploying a new stage

DANGER you must know exactly what you are doing here!

  • Log into your Serverless Dashboard and create a new app reflecting serverless.yml "service" field
  • Deploy the frontend, it's needed to create the CloudFront distribution
$ NODE_ENV={stage_name} npm run deploy:frontend
  • Create a distribution pointing to the frontend bucket
    • Don't forget to create a custom error response for 404 and other errors
  • Create a Route53 Hosted Zone with the api host
  • Create the APIGateway domain
$ NODE_ENV={stage_name} sls create_domain
  • Verify if the serverless.yml provider.deploymentBucket.name bucket exists. Create if needed.
  • Deploy the service
$ serverless deploy

Deploy

Frontend & backend

$ NODE_ENV=development|production npm run deploy

Frontend

$ NODE_ENV=development|production npm run deploy:frontend

Backend

$ NODE_ENV=development|production npm run deploy:backend

Troubleshooting

Got User is not authorized to access this resource when using the API

  • Open the AWS Console, open the API Gateway service and find your deployed service
  • Navigate to Authorizers tab and you shall see the authorizer
  • Click Edit, check Authorization Caching and click Save api-gateway-workaround
  • Click Edit again, uncheck Authorization Caching and click Save
  • Redeploy the application
  • Yes, it sucks!