Skip to content

Commit 864dc0d

Browse files
authored
Merge pull request #30 from theam/layer-separation
v2 - Removal of layer
2 parents f46dd8b + a01c8b4 commit 864dc0d

File tree

19 files changed

+120
-276
lines changed

19 files changed

+120
-276
lines changed

.circleci/config.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ jobs:
2020
- stack-{{checksum "stack.yaml"}}-{{checksum "package.yaml"}}
2121
- run: stack setup
2222
- run: stack build
23-
- run: cd $(stack path --local-install-root)/bin/ && zip -j /tmp/runtime.zip bootstrap
24-
- save-cache:
25-
key: zip-file
26-
paths:
27-
- "/tmp/runtime.zip"
2823
- save-cache:
2924
key: stack-{{ checksum "stack.yaml" }}
3025
paths:
@@ -63,42 +58,12 @@ jobs:
6358
- store_test_results:
6459
path: ~/.stack-work/logs/*
6560

66-
deploy:
67-
docker:
68-
- image: circleci/python:2.7-jessie
69-
working_directory: ~/aws-lambda-haskell-runtime
70-
steps:
71-
- checkout
72-
- restore-cache:
73-
key: zip-file
74-
paths:
75-
- "/tmp/"
76-
- run:
77-
name: Install awscli
78-
command: sudo pip install awscli
79-
- run:
80-
name: Deploy to AWS Layers
81-
command: |
82-
LAYER_NAME="aws-haskell-runtime"
83-
REGIONS_LIST="us-east-1 us-east-2 us-west-1 us-west-2 ap-south-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 ap-northeast-1 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 eu-north-1 sa-east-1"
84-
for region in $REGIONS_LIST
85-
do
86-
aws lambda publish-layer-version --layer-name $LAYER_NAME --zip-file fileb:///tmp/runtime.zip --region $region
87-
aws lambda add-layer-version-permission --layer-name $LAYER_NAME --version-number $(aws lambda list-layer-versions --layer-name $LAYER_NAME --region $region | grep Version | tail -n+3 | head -n 1 | cut -d: -f2- | rev | cut -d, -f2 | rev) --principal '*' --action lambda:GetLayerVersion --statement-id allow-getLayerVersion-all --region $region
88-
done
89-
9061
workflows:
9162
version: 2
9263
build-and-deploy:
9364
jobs:
9465
- build
9566
- test
96-
- deploy:
97-
requires:
98-
- build
99-
filters:
100-
branches:
101-
only: master
10267

10368
general:
10469
branches:

ChangeLog.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2018 The Agile Monkeys
1+
Copyright 2019 The Agile Monkeys
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

Makefile

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This package provides a way of running Haskell projects on AWS Lambda.
99
## Sample lambda function
1010

1111
```
12-
stack new my-haskell-lambda https://github.com/theam/aws-lambda-haskell-runtime/raw/master/stack-template.hsfiles --resolver=lts-13.0 --omit-packages
12+
stack new my-haskell-lambda https://github.com/theam/aws-lambda-haskell-runtime/raw/master/stack-template.hsfiles --resolver=lts-13.25 --omit-packages
1313
cd my-haskell-lambda
1414
stack docker pull
1515
```
@@ -21,7 +21,7 @@ packages:
2121
- .
2222
2323
extra-deps:
24-
- aws-lambda-haskell-runtime-1.0.10
24+
- aws-lambda-haskell-runtime-2.0.0
2525
```
2626

2727
to your `stack.yaml`
@@ -34,15 +34,6 @@ make
3434

3535
Now you should have a `build/function.zip` file that you can upload to your lambda.
3636

37-
## Lambda function configuration
38-
39-
When creating your lambda function you need to provide a layer with the Haskell runtime. We have deployed the layer to our AWS account, you can use it or deploy it to your own AWS account.
40-
41-
The ARN of the runtime layer is:
42-
```
43-
arn:aws:lambda:<YOUR REGION>:785355572843:layer:aws-haskell-runtime:5
44-
````
45-
4637
## Full user guide
4738

4839
Take a look at the [Getting Started with the Haskell AWS Lambda Runtime](https://medium.com/the-theam-journey/getting-started-with-the-haskell-aws-lambda-runtime-951b2322c7a3) guide.

app/Main.hs

Lines changed: 0 additions & 21 deletions
This file was deleted.

package.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: aws-lambda-haskell-runtime
2-
version: 1.1.1
2+
version: 2.0.0
33
github: "theam/aws-lambda-haskell-runtime"
44
license: Apache-2.0
55
author: Nikita Tchayka
@@ -23,11 +23,8 @@ library:
2323
- bytestring
2424
- http-client
2525
- http-types
26-
- optparse-generic
27-
- process
2826
- template-haskell
2927
- text
30-
- uuid
3128
- safe-exceptions-checked
3229
- path
3330
- path-io
@@ -36,14 +33,6 @@ library:
3633
- Aws.Lambda
3734
- Aws.Lambda.Runtime
3835

39-
executables:
40-
bootstrap:
41-
source-dirs: app
42-
main: Main.hs
43-
dependencies:
44-
- aws-lambda-haskell-runtime
45-
- http-client
46-
4736
tests:
4837
aws-lambda-haskell-runtime-test:
4938
main: Spec.hs

src/Aws/Lambda.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ module Aws.Lambda
33
) where
44

55
import Aws.Lambda.Configuration as Reexported
6+
import Aws.Lambda.Runtime as Reexported
67
import Aws.Lambda.Runtime.Context as Reexported

src/Aws/Lambda/Configuration.hs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
{-# OPTIONS_GHC -fno-warn-unused-pattern-binds #-}
22
module Aws.Lambda.Configuration
33
( Main.LambdaOptions(..)
4-
, Main.generate
5-
, Main.getRecord
6-
, configureLambda
7-
, IPC.returnAndFail
8-
, IPC.returnAndSucceed
4+
, generateLambdaDispatcher
95
, Dispatch.decodeObj
6+
, Dispatch.encodeObj
107
)
118
where
129

@@ -15,13 +12,11 @@ import qualified Language.Haskell.TH as Meta
1512
import qualified Aws.Lambda.Meta.Dispatch as Dispatch
1613
import qualified Aws.Lambda.Meta.Main as Main
1714
import qualified Aws.Lambda.Meta.Run as Run
18-
import qualified Aws.Lambda.Runtime.IPC as IPC
1915

20-
{-| Generates a @main@ function to be used with the
21-
AWS Lambda layer.
16+
{-| Generates a @main@ function that acts as a dispatcher
2217
-}
23-
configureLambda :: Meta.DecsQ
24-
configureLambda = do
18+
generateLambdaDispatcher :: Meta.DecsQ
19+
generateLambdaDispatcher = do
2520
main <- Main.generate
2621
run <- Run.generate
2722
return (main <> [run])

src/Aws/Lambda/Meta/Common.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Aws.Lambda.Meta.Common
33
( declarationName
44
, expressionName
55
, getFieldsFrom
6+
, constructorName
67
) where
78

89
import Data.Text (Text)
@@ -19,6 +20,10 @@ declarationName = pure . VarP . mkName . Text.unpack
1920
expressionName :: Text -> Q Exp
2021
expressionName = pure . VarE . mkName . Text.unpack
2122

23+
-- | Helper for defining names for constructors
24+
-- think of @Foo@ in @quux = Foo 3@
25+
constructorName :: Text -> Q Exp
26+
constructorName = pure . ConE . mkName . Text.unpack
2227

2328
-- | Helper for extracting fields of a specified record
2429
-- it expects the constructor name as the first parameter,

0 commit comments

Comments
 (0)