-
Notifications
You must be signed in to change notification settings - Fork 58
Plugin Overview
Vladislav.Tankov edited this page May 30, 2020
·
14 revisions
Kotless gradle plugin is a key component in Kotless architecture. It tightens up the abstract representation of Serverless application and its actual deployment.
The plugin defines several tasks to deploy Kotless-based application:
-
generate
— generates Terraform code from Kotlin code written using Kotless DSL; -
plan
— executesplan
Terraform operation on generated Terraform code; -
deploy
— executesapply
Terraform operation on generated Terraform code; -
destroy
— executesdestroy
Terraform operation, if enabled inextensions
; -
local
— runs application locally.
Note that actual lambdas jars are prepared using shadowJar
plugin. Still, you can
use custom archive via setArchiveTask(...)
Furthermore, Kotless gradle plugin defines certain configurations of Kotless-based application deployment.
Following configurations are available via the plugin:
- Kotless config — configuration of Terraform, its cloud provider, kotless-used buckets, and global optimizations;
- Web Application configs — configuration of lambdas used in a specific web application, its alias, and deployment parameters;
- Extensions configs — configuration that defines different extensions for Kotless pipeline.
For example, it may enable
destroy
task or add user's Terraform files to deployment code.
Here is a simple snippet of the whole configuration:
kotless {
//see details in a Plugin/Kotless Configuration
config {
bucket = "kotless.s3.example.com"
dsl {
type = DSLType.Kotless
//or for Ktor
//type = DSLType.Ktor
//or for SpringBoot
//type = DSLType.SpringBoot
}
terraform {
profile = "example-profile"
region = "us-east-1"
}
optimization {
mergeLambda = MergeLambda.All
}
}
//see details in a Plugin/Web Application Configuration
webapp {
route53 = Route53("kotless", "example.com")
lambda {
timeoutSec = 300
memoryMb = 512
//needed only for Kotless DSL
kotless {
//Define packages in which scan for routes should be performed
packages = setOf("io.kotless.examples")
}
}
}
//see details in a Plugin/Extensions
extensions {
local {
//rewrite default local port
port = 9090
}
}
}