From c27e01f16c35a299135f5f3582902910aec7eaa2 Mon Sep 17 00:00:00 2001 From: ac360 Date: Mon, 12 Dec 2016 19:14:11 -0800 Subject: [PATCH] separate commands into separate pages --- docs/README.md | 3 + .../aws/cli-reference/deploy-function.md | 38 ++++++++++++ .../aws/cli-reference/deploy-list.md | 32 ++++++++++ docs/providers/aws/cli-reference/deploy.md | 22 +------ docs/providers/aws/cli-reference/info.md | 2 +- .../aws/cli-reference/invoke-local.md | 59 +++++++++++++++++++ docs/providers/aws/cli-reference/invoke.md | 28 +-------- docs/providers/aws/cli-reference/logs.md | 2 +- docs/providers/aws/cli-reference/metrics.md | 2 +- docs/providers/aws/cli-reference/remove.md | 2 +- docs/providers/aws/cli-reference/rollback.md | 2 +- docs/providers/aws/cli-reference/slstats.md | 2 +- 12 files changed, 140 insertions(+), 54 deletions(-) create mode 100644 docs/providers/aws/cli-reference/deploy-function.md create mode 100644 docs/providers/aws/cli-reference/deploy-list.md create mode 100644 docs/providers/aws/cli-reference/invoke-local.md diff --git a/docs/README.md b/docs/README.md index 584d43739..07d3050a6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -52,7 +52,10 @@ The Serverless Framework allows you to deploy auto-scaling, pay-per-execution, e
  • Create
  • Install
  • Deploy
  • +
  • Deploy Function
  • +
  • Deploy List
  • Invoke
  • +
  • Invoke Local
  • Logs
  • Metrics
  • Info
  • diff --git a/docs/providers/aws/cli-reference/deploy-function.md b/docs/providers/aws/cli-reference/deploy-function.md new file mode 100644 index 000000000..986c1ee72 --- /dev/null +++ b/docs/providers/aws/cli-reference/deploy-function.md @@ -0,0 +1,38 @@ + + + +### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/cli-reference/deploy-function) + + +# Deploy Function + +The `sls deploy function` command deploys an individual function without AWS CloudFormation. This command simply swaps out the zip file that your CloudFormation stack is pointing toward. This is a much faster way of deploying changes in code. + +```bash +serverless deploy function -f functionName +``` + +## Options +- `--function` or `-f` The name of the function which should be deployed +- `--stage` or `-s` The stage in your service that you want to deploy to. +- `--region` or `-r` The region in that stage that you want to deploy to. + +## Examples + +### Deployment without stage and region options + +```bash +serverless deploy function --function helloWorld +``` + +### Deployment with stage and region options + +```bash +serverless deploy function --function helloWorld --stage dev --region us-east-1 +``` diff --git a/docs/providers/aws/cli-reference/deploy-list.md b/docs/providers/aws/cli-reference/deploy-list.md new file mode 100644 index 000000000..edbbfa10a --- /dev/null +++ b/docs/providers/aws/cli-reference/deploy-list.md @@ -0,0 +1,32 @@ + + + +### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/cli-reference/deploy-list) + + +# Deploy List + +The `sls deploy list` command will list your recent deployments available in your S3 deployment bucket. It will use stage and region from the provider config and show the timestamp of each deployment so you can roll back if necessary using `sls rollback`. + +## Options + +- `--stage` or `-s` The stage in your service that you want to deploy to. +- `--region` or `-r` The region in that stage that you want to deploy to. + +## Artifacts + +After the `serverless deploy` command runs all created deployment artifacts are placed in the `.serverless` folder of the service. + +## Examples + +### List existing deploys + +```bash +serverless deploy list --stage dev --region us-east-1 +``` diff --git a/docs/providers/aws/cli-reference/deploy.md b/docs/providers/aws/cli-reference/deploy.md index 23ec7b4db..35c94e18e 100644 --- a/docs/providers/aws/cli-reference/deploy.md +++ b/docs/providers/aws/cli-reference/deploy.md @@ -12,25 +12,13 @@ layout: Doc # Deploy -The `sls deploy` command deploys your service or an individual function. - -**Deploy entire service:** +The `sls deploy` command deploys your entire service via CloudFormation. Run this command when you have made infrastructure changes (i.e., you edited `serverless.yml`). Use `serverless deploy function -f myFunction` when you have made code changes and you want to quickly upload your updated code to AWS Lambda. ```bash serverless deploy ``` -**Deploy a single function:** - -```bash -serverless deploy function -f functionName -``` - -**Note:** `sls deploy function` is faster than a full service deploy and recommended for a faster development flow - ## Options -- `--function` or `-f` The name of the function which should be deployed (**Note:** only available when running -`serverless deploy function`) - `--stage` or `-s` The stage in your service that you want to deploy to. - `--region` or `-r` The region in that stage that you want to deploy to. - `--noDeploy` or `-n` Skips the deployment steps and leaves artifacts in the `.serverless` directory @@ -60,14 +48,6 @@ serverless deploy --stage production --region eu-central-1 With this example we've defined that we want our service to be deployed to the `production` stage in the region `eu-central-1`. -## List existing deploys - -```bash -serverless deploy list -``` - -Running this command will list your recent deployments available in your S3 deployment bucket. It will use stage and region from the provider config and show the timestamp of each deployment so you can roll back if necessary. - ## Provided lifecycle events - `deploy:cleanup` - `deploy:initialize` diff --git a/docs/providers/aws/cli-reference/info.md b/docs/providers/aws/cli-reference/info.md index 1e905db6b..7e71a4eb0 100644 --- a/docs/providers/aws/cli-reference/info.md +++ b/docs/providers/aws/cli-reference/info.md @@ -1,7 +1,7 @@ diff --git a/docs/providers/aws/cli-reference/invoke-local.md b/docs/providers/aws/cli-reference/invoke-local.md new file mode 100644 index 000000000..d11080d11 --- /dev/null +++ b/docs/providers/aws/cli-reference/invoke-local.md @@ -0,0 +1,59 @@ + + + +### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/cli-reference/invoke-local) + + +# Invoke Local + +This runs your code locally by emulating the AWS Lambda environment. Please keep in mind, it's not a 100% perfect emulation, there may be some differences, but it works for the vast majority of users. We mock the `context` with simple mock data. + +```bash +serverless invoke local --function functionName +``` + +## Options + +- `--function` or `-f` The name of the function in your service that you want to invoke locally. **Required**. +- `--path` or `-p` The path to a json file holding input data to be passed to the invoked function. This path is relative to the root directory of the service. The json file should have event and context properties to hold your mocked event and context data. +- `--data` or `-d` String data to be passed as an event to your function. Keep in mind that if you pass both `--path` and `--data`, the data included in the `--path` file will overwrite the data you passed with the `--data` flag. + +## Examples + +### Local function invocation + +```bash +serverless invoke local --function functionName +``` + +This example will locally invoke your function. + +### Local function invocation with data + +```bash +serverless invoke --function functionName --data "hello world" +``` + +```bash +serverless invoke --function functionName --data '{"a":"bar"}' +``` + +### Local function invocation with data from standard input + +```bash +dataGenerator.js | serverless invoke local --function functionName +``` + +### Local function invocation with data passing + +```bash +serverless invoke local --function functionName --path lib/data.json +``` + +This example will pass the json data in the `lib/data.json` file (relative to the root of the service) while invoking the specified/deployed function. diff --git a/docs/providers/aws/cli-reference/invoke.md b/docs/providers/aws/cli-reference/invoke.md index 1d428d92b..0c8165198 100644 --- a/docs/providers/aws/cli-reference/invoke.md +++ b/docs/providers/aws/cli-reference/invoke.md @@ -1,7 +1,7 @@ @@ -84,29 +84,3 @@ serverless invoke --function functionName --stage dev --region us-east-1 --path This example will pass the json data in the `lib/data.json` file (relative to the root of the service) while invoking the specified/deployed function. - -#### Local function invocation - -```bash -serverless invoke local --function functionName -``` - -This example will locally invoke your function. - -#### Local function invocation with event data - -You can input test data in `event.json` file inside your service directory: - -```json -{ - "foo": "bar" -} -``` - -and then pass it with the command - -```bash -serverless invoke local --function functionName --path event.json -``` - -This example will locally invoke your function. diff --git a/docs/providers/aws/cli-reference/logs.md b/docs/providers/aws/cli-reference/logs.md index 3b2785743..b364e79ef 100644 --- a/docs/providers/aws/cli-reference/logs.md +++ b/docs/providers/aws/cli-reference/logs.md @@ -1,7 +1,7 @@ diff --git a/docs/providers/aws/cli-reference/metrics.md b/docs/providers/aws/cli-reference/metrics.md index 4f8e8e201..d407d06a4 100644 --- a/docs/providers/aws/cli-reference/metrics.md +++ b/docs/providers/aws/cli-reference/metrics.md @@ -1,7 +1,7 @@ diff --git a/docs/providers/aws/cli-reference/remove.md b/docs/providers/aws/cli-reference/remove.md index d7319f6f9..65aa190c6 100644 --- a/docs/providers/aws/cli-reference/remove.md +++ b/docs/providers/aws/cli-reference/remove.md @@ -1,7 +1,7 @@ diff --git a/docs/providers/aws/cli-reference/rollback.md b/docs/providers/aws/cli-reference/rollback.md index 47018fa21..013677d9d 100644 --- a/docs/providers/aws/cli-reference/rollback.md +++ b/docs/providers/aws/cli-reference/rollback.md @@ -1,7 +1,7 @@ diff --git a/docs/providers/aws/cli-reference/slstats.md b/docs/providers/aws/cli-reference/slstats.md index e2aa1a329..23a5ee1aa 100644 --- a/docs/providers/aws/cli-reference/slstats.md +++ b/docs/providers/aws/cli-reference/slstats.md @@ -1,7 +1,7 @@