serverless-haskell 0.6.7 → 0.7.0
raw patch · 3 files changed
+54/−58 lines, 3 files
Files
- README.md +5/−6
- serverless-haskell.cabal +2/−2
- src/AWSLambda.hs +47/−50
README.md view
@@ -12,7 +12,7 @@ * AWS account * [Stack] * [NPM]-* [Docker] unless running on a Linux host+* [Docker] ## Usage @@ -30,12 +30,9 @@ ```shell cd mypackage npm init .- npm install --save serverless serverless-haskell@x.y.z+ npm install --save serverless serverless-haskell ``` - The version of the NPM package to install must match the version of the- Haskell package.- * Create `serverless.yml` with the following contents: ```yaml@@ -75,7 +72,8 @@ pure [1, 2, 3] ``` -* Use `sls deploy` to deploy the executable to AWS Lambda.+* Use `sls deploy` to deploy the executable to AWS Lambda. **Note**: `sls deploy+ function` is [not supported yet](https://github.com/seek-oss/serverless-haskell/issues/20). The `serverless-haskell` plugin will build the package using Stack and upload it to AWS together with a JavaScript wrapper to pass the input and output@@ -97,6 +95,7 @@ ### Notes +* `sls deploy function` is [not supported yet](https://github.com/seek-oss/serverless-haskell/issues/20). * Only AWS Lambda is supported at the moment. Other cloud providers would require different JavaScript wrappers to be implemented.
serverless-haskell.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: b0b5dd5015d0ed8774e758e52ff3ff6b5b847dce4d0d668ff35b288c58507b5a+-- hash: 5f9e4573ea598b080a6db1317de36e61bb04132093c9367be4a9912b9de5dda4 name: serverless-haskell-version: 0.6.7+version: 0.7.0 synopsis: Deploying Haskell code onto AWS Lambda using Serverless description: Utilities to help process the events from AWS Lambda when deployed with the serverless-haskell plugin. category: AWS, Cloud, Network
src/AWSLambda.hs view
@@ -10,43 +10,42 @@ To deploy a Haskell function on AWS Lambda: * Initialise a Serverless project in the same directory as your Stack-enabled-package and install the @serverless-haskell@ plugin:-- > npm init .- > npm install --save serverless serverless-haskell@x.y.z+ package and install the @serverless-haskell@ plugin: - The version of the NPM package to install must match the version of the- Haskell package.+ > npm init .+ > npm install --save serverless serverless-haskell * Create @serverless.yml@ with the following contents: - > service: myservice- >- > provider:- > name: aws- > runtime: nodejs8.10- >- > functions:- > myfunc:- > handler: mypackage.mypackage-exe- > # Here, mypackage is the Haskell package name and mypackage-exe is the- > # executable name as defined in the Cabal file- >- > plugins:- > - serverless-haskell+ > service: myservice+ >+ > provider:+ > name: aws+ > runtime: nodejs8.10+ >+ > functions:+ > myfunc:+ > handler: mypackage.mypackage-exe+ > # Here, mypackage is the Haskell package name and mypackage-exe is the+ > # executable name as defined in the Cabal file+ >+ > plugins:+ > - serverless-haskell * Write your @main@ function using 'AWSLambda.lambdaMain'. -* Use @sls deploy@ to deploy the executable to AWS Lambda.+* Use @sls deploy@ to deploy the executable to AWS Lambda. __Note__: @sls deploy+ function@ is+ <https://github.com/seek-oss/serverless-haskell/issues/20 not supported yet>. - The @serverless-haskell@ plugin will build the package using Stack and upload- it to AWS together with a JavaScript wrapper to pass the input and output- from/to AWS Lambda.+ The @serverless-haskell@ plugin will build the package using Stack and upload+ it to AWS together with a JavaScript wrapper to pass the input and output+ from/to AWS Lambda. - You can test the function and see the invocation results with @sls invoke- myfunc@.+ You can test the function and see the invocation results with @sls invoke+ myfunc@. - To invoke the function locally, use @sls invoke local -f myfunc@.+ To invoke the function locally, use @sls invoke local -f myfunc@. = API Gateway @@ -63,37 +62,35 @@ section of @serverless.yml@. * To add flags to @stack build@, specify them as an array under-@stackBuildArgs@:+ @stackBuildArgs@: - > custom:- > haskell:- > stackBuildArgs:- > - --pedantic- > - --allow-different-user+ > custom:+ > haskell:+ > stackBuildArgs:+ > - --pedantic+ > - --allow-different-user * To start the executable with extra arguments, add them to @arguments@ under-the function name:+ the function name: - > custom:- > haskell:- > arguments:- > myfunc:- > - --arg1- > - --arg2- > - arg3+ > custom:+ > haskell:+ > arguments:+ > myfunc:+ > - --arg1+ > - --arg2+ > - arg3 * Dependent system libraries not present in the AWS Lambda environment will be-automatically uploaded along with the executable. Note that while statically-linking the executable via Cabal options is possible, it might still require-the corresponding glibc version on the AWS environment.+ automatically uploaded along with the executable. -* To force using Stack's Docker image, set @docker@ key to @true@. It is-recommended to set this to avoid incompatibility issues with dependent system-libraries.+* Stack's Docker image will be used to match the AWS Lambda Linux environment.+ To disable this, set @docker@ key to @false@, but beware that the resulting+ binary might not have the required libraries to run on Lambda. - > custom:- > haskell:- > docker: true+ > custom:+ > haskell:+ > docker: false -} module AWSLambda ( Handler.lambdaMain