Skip to content

Commit bdc511d

Browse files
committed
First deployable version
1 parent 32a542c commit bdc511d

File tree

18 files changed

+795
-0
lines changed

18 files changed

+795
-0
lines changed

.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/target
2+
packaged.yaml
3+
server
4+
native-packaged.yaml
5+
invoke-envs.json
6+
fnative-envs.list
7+
envs.json
8+
envs.example.json
9+
native-template.yml
10+
*.zip
11+
bootstrap
12+
/classes
13+
/checkouts
14+
profiles.clj
15+
pom.xml.asc
16+
envs.list
17+
trace.js
18+
*.jar
19+
*.class
20+
*.pyc
21+
node_modules
22+
/.lein-*
23+
/.nrepl-port
24+
.hgignore
25+
.hg/
26+
native-configuration/**
27+
build
28+
dist
29+
choly.egg-info
30+
.clj-kondo/.cache
31+
.holy-lambda
32+
template-modified.yml
33+
.aws-sam
34+
.cpcache
35+
.idea
36+
37+
/exceptions/.gradle/

Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM openjdk:latest
2+
MAINTAINER Karol Wójcik <karol.wojcik@tuta.io>
3+
4+
ADD .holy-lambda/build/output.jar output.jar
5+
6+
CMD java -jar output.jar "com.company.lambda-steps.core.ExampleLambda"

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# holy-lambda-steps
22
Test of integration between holy lambda and Step functions. Use to document issue https://github.com/FieryCod/holy-lambda/issues/83
3+
4+
This is an implementation in Clojure/HL of the example in https://aws.amazon.com/getting-started/hands-on/handle-serverless-application-errors-step-functions-lambda/
5+
6+
# Lifecycle
7+
8+
```shell
9+
bb compile
10+
sam build
11+
#sam local invoke -e resources/event-test-archive.json
12+
sam deploy --guided
13+
```
14+
15+
Note: there is a new babashka task named `compile` that compiles the java exceptions and then calls `hl:compile`

bb.edn

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{:deps {io.github.FieryCod/holy-lambda-babashka-tasks
2+
{:git/url "https://github.com/FieryCod/holy-lambda"
3+
:deps/root "./modules/holy-lambda-babashka-tasks"
4+
:sha "1469bb96b85c2c65a52df9e3a4914dde1b4c816f"}
5+
io.github.FieryCod/holy-lambda {:mvn/version "0.6.6"}}
6+
7+
;; Minimal babashka version which should be used in conjuction with holy-lambda
8+
:min-bb-version "0.3.7"
9+
10+
:holy-lambda/options {
11+
:docker {
12+
13+
;; Check https://docs.docker.com/network/
14+
;; Network setting for future versions of HL will propagate to AWS SAM as well
15+
;; Options: "host"|"bridge"|"overlay"|"none"|nil|"macvlan"
16+
:network nil
17+
18+
;; HL runs some bb tasks in docker context. You can put additional resources to the context by using volumes.
19+
;; ----------------------------------------------------------------------------
20+
;; Single volume definition:
21+
;;
22+
;; {:docker "/where-to-mount-in-docker"
23+
;; :host "relative-local-path"}
24+
:volumes []
25+
26+
;; GraalVM Community holy-lambda compatible docker image
27+
;; You can always build your own GraalVM image with enterprise edition
28+
:image "ghcr.io/fierycod/holy-lambda-builder:amd64-java11-22.0.0.2"}
29+
30+
:build {:compile-cmd "clojure -X:uberjar"
31+
;; Used when either :docker is nil or
32+
;; `HL_NO_DOCKER` environment variable is set to "true"
33+
;; Might be set via `GRAALVM_HOME` environment variable
34+
:graalvm-home "~/.graalvm"}
35+
36+
:backend
37+
{
38+
;; Babashka pods should be shipped using AWS Lambda Layer
39+
;; Check this template https://github.com/aws-samples/aws-lambda-layers-aws-sam-examples/blob/master/aws-sdk-layer/template.yaml
40+
;; and official docs https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-layers.html
41+
;; CodeUri should be `.holy-lambda/pods`
42+
;; For now pods should be declared in `bb.edn`. See: https://github.com/babashka/babashka/issues/768#issuecomment-825016317
43+
;;
44+
;; `IMPORTANT:` 3rd party babashka compatible libraries should be distributed as a layers (CodeUri: .holy-lambda/bb-clj-deps)
45+
:pods {}
46+
47+
;; For `:native` backend you can provide your own bootstrap file
48+
:bootstrap-file "bootstrap"
49+
50+
;; For `:native` backend you can provide some native resources which will be available during lambda execution
51+
;; Resources are packed as is.
52+
:native-deps "resources"
53+
54+
;; Specify custom arguments for native image generation
55+
;; Check https://www.graalvm.org/reference-manual/native-image/Options/
56+
:native-image-args ["--verbose"
57+
"--no-fallback"
58+
"--report-unsupported-elements-at-runtime"
59+
"-H:+AllowIncompleteClasspath"
60+
"--no-server"]}}
61+
62+
:tasks {:requires ([holy-lambda.tasks])
63+
hl:docker:run holy-lambda.tasks/hl:docker:run
64+
hl:native:conf holy-lambda.tasks/hl:native:conf
65+
hl:native:executable holy-lambda.tasks/hl:native:executable
66+
hl:babashka:sync holy-lambda.tasks/hl:babashka:sync
67+
hl:compile holy-lambda.tasks/hl:compile
68+
hl:doctor holy-lambda.tasks/hl:doctor
69+
hl:clean holy-lambda.tasks/hl:clean
70+
hl:update-bb-tasks holy-lambda.tasks/hl:update-bb-tasks
71+
hl:version holy-lambda.tasks/hl:version
72+
73+
clean (do
74+
(shell {:dir "exceptions"} "./gradlew clean")
75+
(run 'hl:clean))
76+
77+
compile (do
78+
(shell {:dir "exceptions"} "./gradlew jar")
79+
(run 'hl:compile))}}

deps.edn

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{:deps {org.clojure/clojure {:mvn/version "1.10.3"}
2+
io.github.FieryCod/holy-lambda {:mvn/version "0.6.6"}
3+
com.github.clj-easy/graal-build-time {:mvn/version "0.1.4"}
4+
com.company.lambda_steps/exceptions {:local/root "exceptions/build/libs/exceptions-1.0.jar"}}
5+
6+
:paths ["src" "resources"]
7+
8+
:aliases {:uberjar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}}
9+
:exec-fn hf.depstar/uberjar
10+
:exec-args {:aot ["com.company.lambda-steps.core"]
11+
:main-class "com.company.lambda-steps.core"
12+
:jar ".holy-lambda/build/output.jar"
13+
:jvm-opts ["-Dclojure.compiler.direct-linking=true"
14+
"-Dclojure.spec.skip-macros=true"]}}}}

exceptions/.gitignore

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
### JetBrains template
2+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion
3+
4+
*.iml
5+
6+
## Directory-based project format:
7+
.idea/
8+
# if you remove the above rule, at least ignore the following:
9+
10+
# User-specific stuff:
11+
# .idea/workspace.xml
12+
# .idea/tasks.xml
13+
# .idea/dictionaries
14+
15+
# Sensitive or high-churn files:
16+
# .idea/dataSources.ids
17+
# .idea/dataSources.xml
18+
# .idea/sqlDataSources.xml
19+
# .idea/dynamic.xml
20+
# .idea/uiDesigner.xml
21+
22+
# Gradle:
23+
# .idea/gradle.xml
24+
# .idea/libraries
25+
26+
# Mongo Explorer plugin:
27+
# .idea/mongoSettings.xml
28+
29+
## File-based project format:
30+
*.ipr
31+
*.iws
32+
33+
## Plugin-specific files:
34+
35+
# IntelliJ
36+
/out/
37+
38+
# mpeltonen/sbt-idea plugin
39+
.idea_modules/
40+
41+
# JIRA plugin
42+
atlassian-ide-plugin.xml
43+
44+
# Crashlytics plugin (for Android Studio and IntelliJ)
45+
com_crashlytics_export_strings.xml
46+
crashlytics.properties
47+
crashlytics-build.properties
48+
49+
50+
# Mobile Tools for Java (J2ME)
51+
.mtj.tmp/
52+
53+
# Package Files #
54+
*.jar
55+
*.war
56+
*.ear
57+
58+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
59+
hs_err_pid*
60+
61+
62+
### Eclipse template
63+
*.pydevproject
64+
.metadata
65+
bin/
66+
tmp/
67+
*.tmp
68+
*.bak
69+
*.swp
70+
*~.nib
71+
.settings/
72+
.loadpath
73+
74+
# Eclipse Core
75+
.project
76+
77+
# External tool builders
78+
.externalToolBuilders/
79+
80+
# Locally stored "Eclipse launch configurations"
81+
*.launch
82+
83+
# CDT-specific
84+
.cproject
85+
86+
# JDT-specific (Eclipse Java Development Tools)
87+
.classpath
88+
89+
# Java annotation processor (APT)
90+
.factorypath
91+
92+
# PDT-specific
93+
.buildpath
94+
95+
# sbteclipse plugin
96+
.target
97+
98+
# TeXlipse plugin
99+
.texlipse
100+
101+
102+
### Gradle template
103+
.gradle
104+
build/
105+
106+
# Ignore Gradle GUI config
107+
gradle-app.setting
108+
109+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
110+
!gradle-wrapper.jar
111+
112+
113+
### Linux template
114+
*~
115+
116+
# KDE directory preferences
117+
.directory
118+
119+
# Linux trash folder which might appear on any partition or disk
120+
.Trash-*
121+
122+
123+
### Android template
124+
# Built application files
125+
*.apk
126+
*.ap_
127+
128+
# Files for the Dalvik VM
129+
*.dex
130+
131+
# Generated files
132+
gen/
133+
134+
# Gradle files
135+
/*/build/
136+
137+
# Local configuration file (sdk path, etc)
138+
local.properties
139+
140+
# Proguard folder generated by Eclipse
141+
proguard/
142+
143+
# Log Files
144+
*.log
145+
146+

exceptions/build.gradle

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group 'com.company.evidences.exceptions'
6+
version '1.0'
7+
8+
repositories {
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
14+
}
15+
16+
test {
17+
18+
}
58.4 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)