-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
5,353 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
40963 | ||
40771 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# CHANGELOG | ||
|
||
## 0.1.0 | ||
- Add support for async non-async handlers | ||
- Support all Ring types | ||
- Support all holy-lambda backends | ||
- Support HttpAPI as Lambda Integration | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
test/integration/src/core.clj → examples/babashka/src/core.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
(ns core | ||
(:require | ||
[handler :as handler] | ||
[babashka.process :as p] | ||
[fierycod.holy-lambda-ring-adapter.core :as hlra] | ||
[fierycod.holy-lambda.core :as h])) | ||
|
||
(defn- shell-no-exit | ||
[cmd & args] | ||
(p/process (into (p/tokenize cmd) (remove nil? args)) {:inherit true})) | ||
|
||
|
||
(def HttpApiGatewayProxy (hlra/wrap-hl-req-res-model handler/router)) | ||
|
||
(h/entrypoint [#'HttpApiGatewayProxy]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(ns handler | ||
(:require | ||
[clojure.string :as str] | ||
[hiccup2.core :refer [html]] | ||
[clojure.core.match :refer [match]] | ||
[clojure.java.io :as io])) | ||
|
||
(defn logo | ||
[_request] | ||
{:body (io/file "./logo.png") | ||
:status 200 | ||
:headers {"content-type" "image/png"}}) | ||
|
||
(defn hello | ||
[_request] | ||
{:body {"hello" "world"} | ||
:status 200 | ||
:headers {"content-type" "application/json"}}) | ||
|
||
(defn router | ||
[req] | ||
(let [paths (vec (rest (str/split (:uri req) #"/")))] | ||
(match [(:request-method req) paths] | ||
[:get ["logo"]] (handler/logo req) | ||
[:get ["hello"]] (handler/hello req) | ||
[:get ["welcome"]] {:body (str (html [:html "Welcome!" | ||
[:img {:src "./logo"}]])) | ||
:headers {"content-type" "text/html; charset=utf-8"} | ||
:status 200} | ||
:else {:body "Not Found" | ||
:status 404} | ||
))) |
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
42507 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{:deps {io.github.FieryCod/holy-lambda-babashka-tasks | ||
{:git/url "https://github.com/FieryCod/holy-lambda" | ||
:deps/root "./modules/holy-lambda-babashka-tasks" | ||
:sha "e6c47274a2bfc7576a9da0ccdbc079c1e83bee17"} | ||
io.github.FieryCod/holy-lambda-ring-adapter {:local/root "../../"} | ||
io.github.FieryCod/holy-lambda {:mvn/version "0.6.2"}} | ||
|
||
;; Minimal babashka version which should be used in conjuction with holy-lambda | ||
:min-bb-version "0.3.7" | ||
|
||
:holy-lambda/options { | ||
:docker { | ||
|
||
;; Check https://docs.docker.com/network/ | ||
;; Network setting for future versions of HL will propagate to AWS SAM as well | ||
;; Options: "host"|"bridge"|"overlay"|"none"|nil|"macvlan" | ||
:network nil | ||
|
||
;; HL runs some bb tasks in docker context. You can put additional resources to the context by using volumes. | ||
;; ---------------------------------------------------------------------------- | ||
;; Single volume definition: | ||
;; | ||
;; {:docker "/where-to-mount-in-docker" | ||
;; :host "relative-local-path"} | ||
:volumes [] | ||
|
||
;; GraalVM Community holy-lambda compatible docker image | ||
;; You can always build your own GraalVM image with enterprise edition | ||
:image "ghcr.io/fierycod/holy-lambda-builder:amd64-java11-21.3.0"} | ||
|
||
:build {:compile-cmd "clojure -X:uberjar-lambda" | ||
;; Used when either :docker is nil or | ||
;; `HL_NO_DOCKER` environment variable is set to "true" | ||
;; Might be set via `GRAALVM_HOME` environment variable | ||
:graalvm-home "~/.graalvm"} | ||
|
||
:backend | ||
{ | ||
;; Babashka pods should be shipped using AWS Lambda Layer | ||
;; Check this template https://github.com/aws-samples/aws-lambda-layers-aws-sam-examples/blob/master/aws-sdk-layer/template.yaml | ||
;; and official docs https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-layers.html | ||
;; CodeUri should be `.holy-lambda/pods` | ||
;; For now pods should be declared in `bb.edn`. See: https://github.com/babashka/babashka/issues/768#issuecomment-825016317 | ||
;; | ||
;; `IMPORTANT:` 3rd party babashka compatible libraries should be distributed as a layers (CodeUri: .holy-lambda/bb-clj-deps) | ||
:pods {} | ||
|
||
;; For `:native` backend you can provide your own bootstrap file | ||
:bootstrap-file "bootstrap" | ||
|
||
;; For `:native` backend you can provide some native resources which will be available during lambda execution | ||
;; Resources are packed as is. | ||
;; :native-deps "resources" | ||
|
||
;; Specify custom arguments for native image generation | ||
;; Check https://www.graalvm.org/reference-manual/native-image/Options/ | ||
:native-image-args ["--verbose" | ||
"--no-fallback" | ||
"--report-unsupported-elements-at-runtime" | ||
"-H:+AllowIncompleteClasspath" | ||
"-H:IncludeResources=public/.*" | ||
"--initialize-at-build-time=javax.xml.datatype,jdk.xml.internal" | ||
"--no-server"]}} | ||
|
||
:tasks {:requires ([holy-lambda.tasks]) | ||
hl:docker:run holy-lambda.tasks/hl:docker:run | ||
hl:native:conf holy-lambda.tasks/hl:native:conf | ||
hl:native:executable holy-lambda.tasks/hl:native:executable | ||
hl:babashka:sync holy-lambda.tasks/hl:babashka:sync | ||
hl:compile holy-lambda.tasks/hl:compile | ||
hl:doctor holy-lambda.tasks/hl:doctor | ||
hl:clean holy-lambda.tasks/hl:clean | ||
hl:update-bb-tasks holy-lambda.tasks/hl:update-bb-tasks | ||
hl:version holy-lambda.tasks/hl:version}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{:deps {org.clojure/clojure {:mvn/version "1.10.3"} | ||
com.github.clj-easy/graal-build-time {:mvn/version "0.1.4"} | ||
io.github.FieryCod/holy-lambda {:mvn/version "0.6.2"} | ||
io.github.FieryCod/holy-lambda-ring-adapter {:local/root "../../"} | ||
ring/ring {:mvn/version "1.9.4"} | ||
metosin/muuntaja {:mvn/version "0.6.8"} | ||
metosin/malli {:mvn/version "0.6.2"} | ||
metosin/reitit-core {:mvn/version "0.5.15"} | ||
metosin/reitit-middleware {:mvn/version "0.5.15"} | ||
metosin/reitit-malli {:mvn/version "0.5.15"} | ||
metosin/reitit-ring {:mvn/version "0.5.15"} | ||
metosin/reitit-swagger {:mvn/version "0.5.15"} | ||
com.stuartsierra/component {:mvn/version "1.0.0"} | ||
metosin/reitit-swagger-ui {:mvn/version "0.5.15" | ||
:exclusions [metosin/ring-swagger-ui]} | ||
metosin/ring-swagger-ui {:mvn/version "3.46.0-1"}} | ||
|
||
:paths ["src" "resources"] | ||
|
||
:aliases {:uberjar-lambda {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}} | ||
:exec-fn hf.depstar/uberjar | ||
:exec-args {:aot ["example.lambda"] | ||
:main-class "example.lambda" | ||
:jar ".holy-lambda/build/output.jar" | ||
:jvm-opts ["-Dclojure.compiler.direct-linking=true" | ||
"-Dclojure.spec.skip-macros=true"]}} | ||
:uberjar-server {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}} | ||
:exec-fn hf.depstar/uberjar | ||
:exec-args {:aot ["example.server"] | ||
:main-class "example.server" | ||
:jar ".holy-lambda/build/output.jar" | ||
:jvm-opts ["-Dclojure.compiler.direct-linking=true" | ||
"-Dclojure.spec.skip-macros=true"]}} | ||
}} |
20 changes: 20 additions & 0 deletions
20
examples/native/resources/native-configuration/jni-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"name":"example.lambda", | ||
"methods":[{"name":"main","parameterTypes":["java.lang.String[]"] }]} | ||
, | ||
{ | ||
"name":"java.lang.ClassLoader", | ||
"methods":[ | ||
{"name":"getPlatformClassLoader","parameterTypes":[] }, | ||
{"name":"loadClass","parameterTypes":["java.lang.String"] } | ||
]} | ||
, | ||
{ | ||
"name":"jdk.internal.loader.ClassLoaders$PlatformClassLoader"} | ||
, | ||
{ | ||
"name":"org.graalvm.nativebridge.jni.JNIExceptionWrapperEntryPoints", | ||
"methods":[{"name":"getClassName","parameterTypes":["java.lang.Class"] }]} | ||
|
||
] |
8 changes: 8 additions & 0 deletions
8
examples/native/resources/native-configuration/predefined-classes-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"type":"agent-extracted", | ||
"classes":[ | ||
] | ||
} | ||
] | ||
|
2 changes: 2 additions & 0 deletions
2
examples/native/resources/native-configuration/proxy-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[ | ||
] |
104 changes: 104 additions & 0 deletions
104
examples/native/resources/native-configuration/reflect-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
[ { | ||
"name" : "[B" | ||
}, { | ||
"name" : "[C" | ||
}, { | ||
"name" : "[D" | ||
}, { | ||
"name" : "[F" | ||
}, { | ||
"name" : "[I" | ||
}, { | ||
"name" : "[J" | ||
}, { | ||
"name" : "[Lcom.fasterxml.jackson.databind.deser.Deserializers;" | ||
}, { | ||
"name" : "[Lcom.fasterxml.jackson.databind.deser.KeyDeserializers;" | ||
}, { | ||
"name" : "[Lcom.fasterxml.jackson.databind.deser.ValueInstantiators;" | ||
}, { | ||
"name" : "[Lcom.fasterxml.jackson.databind.ser.Serializers;" | ||
}, { | ||
"name" : "[Ljava.lang.Object;" | ||
}, { | ||
"name" : "[Lreitit.Trie$Matcher;" | ||
}, { | ||
"name" : "[S" | ||
}, { | ||
"name" : "[Z" | ||
}, { | ||
"name" : "com.fasterxml.jackson.databind.ext.Java7SupportImpl", | ||
"methods" : [ { | ||
"name" : "<init>", | ||
"parameterTypes" : [ ] | ||
} ] | ||
}, | ||
{ "name": "org.msgpack.template.builder.JavassistTemplateBuilder", | ||
"allPublicMethods": true, | ||
"allPublicConstructors": true | ||
}, | ||
{ | ||
"name" : "java.io.OutputStream", | ||
"queryAllPublicMethods" : true | ||
}, { | ||
"name" : "java.io.Serializable", | ||
"queryAllDeclaredMethods" : true | ||
}, { | ||
"name" : "java.lang.Class", | ||
"queryAllPublicMethods" : true | ||
}, { | ||
"name" : "java.lang.Iterable", | ||
"queryAllDeclaredMethods" : true | ||
}, { | ||
"name" : "java.lang.Object", | ||
"queryAllPublicMethods" : true | ||
}, { | ||
"name" : "java.lang.Runnable", | ||
"queryAllDeclaredMethods" : true | ||
}, { | ||
"name" : "java.lang.String", | ||
"queryAllPublicMethods" : true, | ||
"methods" : [ { | ||
"name" : "contains", | ||
"parameterTypes" : [ "java.lang.CharSequence" ] | ||
} ] | ||
}, { | ||
"name" : "java.lang.reflect.AccessibleObject", | ||
"methods" : [ { | ||
"name" : "canAccess", | ||
"parameterTypes" : [ "java.lang.Object" ] | ||
} ] | ||
}, { | ||
"name" : "java.security.MessageDigestSpi" | ||
}, { | ||
"name" : "java.security.SecureRandomParameters" | ||
}, { | ||
"name" : "java.util.Map", | ||
"queryAllDeclaredMethods" : true | ||
}, { | ||
"name" : "java.util.Properties", | ||
"queryAllPublicMethods" : true, | ||
"methods" : [ { | ||
"name" : "getProperty", | ||
"parameterTypes" : [ "java.lang.String" ] | ||
} ] | ||
}, { | ||
"name" : "java.util.concurrent.Callable", | ||
"queryAllDeclaredMethods" : true | ||
}, { | ||
"name" : "muuntaja.protocols.StreamableResponse", | ||
"allPublicFields" : true, | ||
"queryAllPublicMethods" : true | ||
}, { | ||
"name" : "sun.security.provider.NativePRNG", | ||
"methods" : [ { | ||
"name" : "<init>", | ||
"parameterTypes" : [ ] | ||
} ] | ||
}, { | ||
"name" : "sun.security.provider.SHA", | ||
"methods" : [ { | ||
"name" : "<init>", | ||
"parameterTypes" : [ ] | ||
} ] | ||
} ] |
Oops, something went wrong.