New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@microlambda/core

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microlambda/core

µlambda framework core

  • 0.0.23-alpha
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
158
decreased by-8.67%
Maintainers
1
Weekly downloads
 
Created
Source

Deployment scripts

These scripts deploy the data portal to AWS.

The workflow is basically the following:

  1. Bootstrap dependencies
  2. Compiling shared packages
  3. Compiling microservices
  4. Packaging microservices
  5. Transforming the services YAML on the fly (e.g. use different authorizers, disable plugins...)
  6. Deploying microservices

No config

If there is no specific configuration, each service is deployed at the same time.

They are deployed in the region corresponding to the AWS_REGION environment variable.

Using a configuration file

You can add a deployment configuration to enable custom domains, control the order of deployments and deploy services in multiple regions.

Deployment steps

By default, all services are deployed at the same time.

If you have different requirements like deploying some services before others, you can specify deployment steps.

Typically if you are using a custom authorizer, you want to deploy it before the services using it.

To achieve this, specify the steps of deployment in the .deployrc configuration file.

{
  "steps": [
    ["customAuthorizer"],
    ["service1", "service2", "service3"]
  ]
}

All services within a same step are deployed concurrently. Steps are deployed sequentially, in the order where they are declared.

Here customAuthorizer will be deployed first. Then services 1, 2 and 3 will be deployed concurrently.

You can use one wildcard * meaning "every other services".

{
  "steps": [
    ["customAuthorizer"],
    ["service1", "service2", "service3"],
    "*",
    ["final-service"]
  ]
}

Here customAuthorizer is deployed first, second service 1, 2, 3. Then every service that is not elsewhere in config. And finally final-service

Geo-replication

The improve latency and performance worldwide, you can either:

  • Use Edge Optimized API Gateways (this the default behavior)
  • Replicate Regional API Gateway in different regions.

To enable the second option, with regional API use:

 {
   "defaultRegions": [
      "eu-west-1",
      "us-east-2"
   ]
 }
Geo-replication by services

If you want more fine-grained regional options, use deployment steps to specify target regions services by services.

{
  "regions": {
    "service1": ["eu-west-1"],
    "service2": ["eu-west-1", "us-east-1", "ap-southeast-1"],
    "service3": ["eu-west-1"]
    /* ... */
  }
}
Geo replication by environment

You can also customize regional options environment by environment.

Either for all services:

{
  "defaultRegions": {
    "dev": ["eu-west-1"],
    "staging": ["eu-west-1"],
    "prod": ["eu-west-1", "us-east-1", "ap-southeast-1"]
  }
}

Or services by services:

{
  "regions": {
    "service1": {
        "dev": ["eu-west-1"],
        "staging": ["eu-west-1"],
        "prod": ["eu-west-1"]
    },
    "service2": {
        "dev": ["eu-west-1"],
        "staging": ["eu-west-1"],
        "prod": ["eu-west-1", "us-east-1", "ap-southeast-1"]
    }
    /* ... */
  }
}
Priority

The fine-grained settings service-by-service take precedence on defaultRegion.

Example:

{
  "defaultRegions": {
    "dev": ["eu-west-1"],
    "staging": ["eu-west-1"],
    "prod": ["eu-west-1", "us-east-1", "ap-southeast-1"]
  },
  "regions": {
    "service1": {
      "prod": ["eu-west-1"]
    }
  }
}

Every service will be deployed to "eu-west-1", "us-east-1", "ap-southeast-1" in production, except service that have a more precise rule and will be deployed only in eu-west-1.

Custom domains

You can use custom domains for services

Do not forget to install serverless-custom-domain plugin and fill the serverless.yml accordingly

Like above, you can define custom domain service by service

{
  "domains": {
    "service-1": "service-1.my-api.io",
    "service-3": "service-3.my-api.io"
  }    
}

You can even use different custom domain by environment:

{
  "domains": {
    "service-1": {
      "dev": "dev.service-1.my-api.io",
      "staging": "staging.service-1.my-api.io",
      "prod": "service-1.my-api.io"
    },
    "service-3": "service-3.my-api.io"
  }    
}

Reformatting serverless.yml

Sometime you may want to change serverless.yaml before deploying, in order to use a slightly different config locally than in cloud.

To do so, register transformation functions in the config file.

These method take in parameters the object parsed from yaml and must return the modified object to dump in yaml.

In can be either written in typescript or javascript.

{
  "yamlTransforms": [
    "scripts/yaml/change-custom-authorizer",
    "scripts/yaml/region-conditional-resources"
  ]
}

You can see [example here](TODO gist)

Keywords

FAQs

Package last updated on 06 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc