mirror of
https://github.com/serverless/serverless.git
synced 2026-02-01 16:07:28 +00:00
Merge pull request #4736 from alexindeed/master
Spotinst - Updated the documentation, menu order
This commit is contained in:
commit
63517f6a30
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
title: Serverless Framework - Spotinst Functions Guide - Active Versions
|
||||
menuText: Active Versions
|
||||
menuOrder: 8
|
||||
menuOrder: 9
|
||||
description: How to set which versions to deploy
|
||||
layout: Doc
|
||||
-->
|
||||
@ -20,13 +20,10 @@ The 'Latest' version refers to the most recent version created by the last updat
|
||||
*Please note: the 'Latest' tag will point to a different version number each and every time you update your function.*
|
||||
|
||||
Default configuration for activeVersions when a new function is created:
|
||||
```
|
||||
"activeVersions": [
|
||||
{
|
||||
"version": "$LATEST",
|
||||
"percentage": 100.0
|
||||
}
|
||||
]
|
||||
```yaml
|
||||
activeVersions:
|
||||
- version: $LATEST
|
||||
percentage: 100.0
|
||||
```
|
||||
|
||||
## Active Version
|
||||
@ -35,46 +32,31 @@ The 'Active' version can point to more than one version of your function, includ
|
||||
For example, say you wanted to test a new version of your function to determine if it was production-ready. You could specify that 10% of the traffic be routed to that new version, and route the remaining 90% to the stable version. You can gradually route more traffic to the new version as you become more confident in its performance.
|
||||
|
||||
### Examples
|
||||
```
|
||||
"activeVersions": [
|
||||
{
|
||||
"version": "$LATEST",
|
||||
"percentage": 100.0
|
||||
}
|
||||
]
|
||||
```yaml
|
||||
activeVersions:
|
||||
- version: $LATEST
|
||||
percentage: 100.0
|
||||
```
|
||||
|
||||
100% of traffic will go to the most recently published update.
|
||||
|
||||
```
|
||||
"activeVersions": [
|
||||
{
|
||||
"version": "$LATEST",
|
||||
"percentage": 80.0
|
||||
},
|
||||
{
|
||||
"version": "2",
|
||||
"percentage": 20.0
|
||||
}
|
||||
]
|
||||
```yaml
|
||||
activeVersions:
|
||||
- version: $LATEST
|
||||
percentage: 80.0
|
||||
- version: 2
|
||||
percentage: 20.0
|
||||
```
|
||||
80% of traffic goes to the most recently published update, and 20% goes to version 2.
|
||||
|
||||
```
|
||||
"activeVersions": [
|
||||
{
|
||||
"version": "5",
|
||||
"percentage": 50.0
|
||||
},
|
||||
{
|
||||
"version": "3",
|
||||
"percentage": 25.0
|
||||
},
|
||||
{
|
||||
"version": "1",
|
||||
"percentage": 25.0
|
||||
}
|
||||
]
|
||||
```yaml
|
||||
activeVersions:
|
||||
- version: 5
|
||||
percentage: 50.0
|
||||
- version: 3
|
||||
percentage: 25.0
|
||||
- version: 1
|
||||
percentage: 25.0
|
||||
```
|
||||
Traffic is split between versions 1. 3, and 5. Changes made to your latest version will not affect production traffic.
|
||||
|
||||
@ -86,17 +68,12 @@ You can configure active versions in the serverless.yml file, but you can also u
|
||||
3. Select 'Configure Active Version'
|
||||
|
||||
- API: (update function)
|
||||
```
|
||||
"activeVersions": [
|
||||
{
|
||||
"version": "$LATEST",
|
||||
"percentage": 30
|
||||
},
|
||||
{
|
||||
"version": "2",
|
||||
"percentage": 70
|
||||
}
|
||||
],
|
||||
```yaml
|
||||
activeVersions:
|
||||
- version: $LATEST
|
||||
percentage: 70.0
|
||||
- version: 2
|
||||
percentage: 30.0
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<!--
|
||||
title: Serverless Framework - Spotinst Functions Guide - Credentials
|
||||
menuText: Credentials
|
||||
menuOrder: 7
|
||||
description: How to set up the Serverless Framework with your Spotinst Functions credentials
|
||||
title: Serverless Framework - Spotinst Functions Guide - CORS
|
||||
menuText: CORS
|
||||
menuOrder: 8
|
||||
description: How to enable and use CORS
|
||||
layout: Doc
|
||||
-->
|
||||
|
||||
@ -11,11 +11,10 @@ layout: Doc
|
||||
<!-- DOCS-SITE-LINK:END -->
|
||||
|
||||
# Spotinst Functions - CORS
|
||||
Cross-Origin Resource Sharing is a mechanism that allows restricted resources on a web page to be requested from a domain outside of the original. CORS defines a way in which a web service and server can interact to determine whether or not it is safe to allow a cross-origin request. Enabling CORS for your function allows you to specify domains that are safe, and enables out-of-the-box support for preflight HTTP request (via the OPTIONS method) will return the needed ‘access-control-’ headers specified below, and the actual HTTP request will return the ‘access-control-allow-origin’ method.
|
||||
|
||||
Cross-Origin Resource Sharing is a mechanism that allows restricted resources on a web page to be requested from a domain outside of the original. CORS defines a way in which a web service and server can interact to determine whether or not it is safe to allow a cross-origin request. Enabling CORS for your function allows you to specify safe domains, and enables out-of-the-box support for preflight HTTP requests (via the OPTIONS method) that will return the needed ‘access-control-*’ headers specified below. The actual HTTP request will return the ‘access-control-allow-origin’ method.
|
||||
You can enable CORS for cross-domain HTTP requests with Spotinst Functions. Add the required fields to you serverless.yml file.
|
||||
|
||||
Example CORS object:
|
||||
### Example CORS object:
|
||||
```yml
|
||||
cors:
|
||||
- enabled: true
|
||||
@ -24,7 +23,7 @@ Example CORS object:
|
||||
methods: "PUT,POST"
|
||||
```
|
||||
|
||||
Parameters:
|
||||
### Parameters:
|
||||
- enabled: Boolean
|
||||
- Specify if CORS is enabled for the function.
|
||||
- default: false
|
||||
|
||||
@ -92,11 +92,10 @@ functions:
|
||||
timeout: 30
|
||||
# access: private
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables: {
|
||||
# Key: "Value",
|
||||
# }
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables:
|
||||
# key: value
|
||||
|
||||
```
|
||||
When you deploy with the Framework by running `serverless deploy`, everything in `serverless.yml` is deployed at once.
|
||||
|
||||
@ -55,14 +55,18 @@ functions:
|
||||
timeout: 30
|
||||
access: private
|
||||
# activeVersions:
|
||||
# - "version": "$LATEST"
|
||||
# "percentage": 100.0
|
||||
# cron:
|
||||
# active: false
|
||||
# value: '*/1 * * * *'
|
||||
# environmentVariables: {
|
||||
# Key: "Value",
|
||||
# }
|
||||
# - version: $LATEST
|
||||
# percentage: 100.0
|
||||
# cors:
|
||||
# enabled: # false by default
|
||||
# origin: # '*' by default
|
||||
# headers: # 'Content-Type,Authorization' by default
|
||||
# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables:
|
||||
# key: value
|
||||
|
||||
# extend the framework using plugins listed here:
|
||||
# https://github.com/serverless/plugins
|
||||
|
||||
@ -26,9 +26,8 @@ Also you are able to enter in environment variables in the serverless.yml file.
|
||||
functions:
|
||||
test:
|
||||
handler: handler.main
|
||||
environmentVariables: {
|
||||
Key: "Value"
|
||||
}
|
||||
environmentVariables:
|
||||
key: value
|
||||
```
|
||||
|
||||
To access your variables in your code you just need to put `process.env['{Your Key}']` as needed in the handler file.
|
||||
|
||||
@ -34,12 +34,11 @@ functions:
|
||||
# origin: # '*' by default
|
||||
# headers: # 'Content-Type,Authorization' by default
|
||||
# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables: {
|
||||
# Key: "Value",
|
||||
# }
|
||||
# environmentVariables:
|
||||
# key: Value
|
||||
|
||||
# extend the framework using plugins listed here:
|
||||
# https://github.com/serverless/plugins
|
||||
|
||||
@ -34,12 +34,11 @@ functions:
|
||||
# origin: # '*' by default
|
||||
# headers: # 'Content-Type,Authorization' by default
|
||||
# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables: {
|
||||
# Key: "Value",
|
||||
# }
|
||||
# environmentVariables:
|
||||
# key: Value
|
||||
|
||||
# extend the framework using plugins listed here:
|
||||
# https://github.com/serverless/plugins
|
||||
|
||||
@ -34,12 +34,11 @@ functions:
|
||||
# origin: # '*' by default
|
||||
# headers: # 'Content-Type,Authorization' by default
|
||||
# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables: {
|
||||
# Key: "Value",
|
||||
# }
|
||||
# environmentVariables:
|
||||
# key: Value
|
||||
|
||||
# extend the framework using plugins listed here:
|
||||
# https://github.com/serverless/plugins
|
||||
|
||||
@ -35,11 +35,10 @@ functions:
|
||||
# headers: # 'Content-Type,Authorization' by default
|
||||
# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default
|
||||
# cron: # Setup scheduled trigger with cron expression
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables: {
|
||||
# Key: "Value",
|
||||
# }
|
||||
# active: true
|
||||
# value: '* * * * *'
|
||||
# environmentVariables:
|
||||
# key: Value
|
||||
|
||||
# extend the framework using plugins listed here:
|
||||
# https://github.com/serverless/plugins
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user