serverless-haskell 0.6.3 → 0.6.4
raw patch · 3 files changed
+56/−50 lines, 3 files
Files
- README.md +4/−1
- serverless-haskell.cabal +2/−2
- src/AWSLambda.hs +50/−47
README.md view
@@ -30,8 +30,11 @@ ```shell cd mypackage npm init .- npm install --save serverless serverless-haskell+ npm install --save serverless serverless-haskell@x.y.z ```++ The version of the NPM package to install must match the version of the+ Haskell package. * Create `serverless.yml` with the following contents:
serverless-haskell.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: de3ca0521fac10e02fd1ab8bb6c9faa99c7d3f9d60cd1618717f00e7eaa114f8+-- hash: ac843bed637b21c8674b64d5c6378640178701a7e162c5ded08d7b2c85da1fef name: serverless-haskell-version: 0.6.3+version: 0.6.4 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,42 +10,45 @@ 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:+package and install the @serverless-haskell@ plugin: - > npm init .- > npm install --save serverless serverless-haskell+ > npm init .+ > npm install --save serverless serverless-haskell@x.y.z + The version of the NPM package to install must match the version of the+ Haskell package.+ * 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. __Note__: @sls deploy- function@ is- <https://github.com/seek-oss/serverless-haskell/issues/20 not supported yet>.+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 @@ -62,37 +65,37 @@ 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. Note that while statically+linking the executable via Cabal options is possible, it might still require+the corresponding glibc version on the AWS environment. * 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.+recommended to set this to avoid incompatibility issues with dependent system+libraries. - > custom:- > haskell:- > docker: true+ > custom:+ > haskell:+ > docker: true -} module AWSLambda ( Handler.lambdaMain