-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
146 lines (139 loc) · 5.76 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import com.typesafe.sbt.SbtNativePackager.autoImport._
import com.typesafe.sbt.packager.archetypes.scripts.BashStartScriptPlugin.autoImport._
import com.typesafe.sbt.packager.docker.Cmd
import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport._
import sbt.Keys._
import sbt._
import Settings._
val `api-server` = (project in file("api-server"))
.enablePlugins(AshScriptPlugin, JavaAgent, EcrPlugin)
.settings(baseSettings)
.settings(dockerBaseSettings)
.settings(apiServerEcrSettings)
.settings(
name := "api-server",
Compile / run / mainClass := Some("example.api.server.ApiServer"),
reStart / mainClass := Some("example.api.server.ApiServer"),
dockerEntrypoint := Seq("/opt/docker/bin/api-server"),
dockerUsername := Some("j5ik2o"),
dockerExposedPorts ++= Seq(8080),
run / fork := true,
javaAgents += "org.aspectj" % "aspectjweaver" % "1.8.13",
javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % "2.0.9" % "runtime;test",
Universal / javaOptions += "-Dorg.aspectj.tracing.factory=default",
run / javaOptions ++= Seq(
s"-Dcom.sun.management.jmxremote.port=${sys.env.getOrElse("JMX_PORT", "8999")}",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false",
"-Dcom.sun.management.jmxremote.local.only=false",
"-Dcom.sun.management.jmxremote"
),
Universal / javaOptions ++= Seq(
"-Dcom.sun.management.jmxremote",
"-Dcom.sun.management.jmxremote.local.only=true",
"-Dcom.sun.management.jmxremote.authenticate=false"
),
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "10.1.11",
"com.typesafe.akka" %% "akka-stream" % akka26Version,
"com.typesafe.akka" %% "akka-slf4j" % akka26Version,
"com.github.scopt" %% "scopt" % "4.0.1",
"net.logstash.logback" % "logstash-logback-encoder" % "4.11" excludeAll (
ExclusionRule(
organization = "com.fasterxml.jackson.core",
name = "jackson-core"
),
ExclusionRule(
organization = "com.fasterxml.jackson.core",
name = "jackson-databind"
)
),
"org.slf4j" % "jul-to-slf4j" % "1.7.26",
"ch.qos.logback" % "logback-classic" % "1.2.11"
)
)
lazy val `gatling-test` = (project in file("gatling-test"))
.enablePlugins(GatlingPlugin)
.settings(gatlingBaseSettings)
.settings(
name := "gatling-test",
libraryDependencies ++= Seq(
"io.gatling.highcharts" % "gatling-charts-highcharts" % gatlingVersion,
"io.gatling" % "gatling-test-framework" % gatlingVersion,
"com.amazonaws" % "aws-java-sdk-core" % awsSdkVersion,
"com.amazonaws" % "aws-java-sdk-s3" % awsSdkVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion
),
GatlingIt / packageBin / publishArtifact := true
)
.settings(
addArtifact(GatlingIt / packageBin / artifact, GatlingIt / packageBin)
)
lazy val `gatling-runner` = (project in file("gatling-runner"))
.enablePlugins(JavaAppPackaging, EcrPlugin)
.settings(gatlingBaseSettings)
.settings(gatlingRunnerEcrSettings)
.settings(
name := "gatling-runner",
libraryDependencies ++= Seq(
"io.gatling" % "gatling-app" % gatlingVersion,
"com.amazonaws" % "aws-java-sdk-core" % awsSdkVersion,
"com.amazonaws" % "aws-java-sdk-s3" % awsSdkVersion
),
Compile / bashScriptDefines / mainClass := Some(
"com.github.j5ik2o.gatling.runner.Runner"
),
dockerBaseImage := "openjdk:8",
dockerUsername := Some("j5ik2o"),
Docker / packageName := "gatling-runner",
dockerUpdateLatest := true,
dockerCommands ++= Seq(
Cmd("USER", "root"),
Cmd("RUN", "mkdir /var/log/gatling"),
Cmd("RUN", "chown daemon:daemon /var/log/gatling"),
Cmd("ENV", "GATLING_RESULT_DIR=/var/log/gatling")
)
)
.dependsOn(`gatling-test` % "compile->gatling-it")
lazy val `gatling-s3-reporter` = (project in file("gatling-s3-reporter"))
.settings(name := "gatling-s3-reporter")
lazy val `gatling-aggregate-runner` =
(project in file("gatling-aggregate-runner"))
.enablePlugins(JavaAppPackaging, EcrPlugin)
.settings(gatlingBaseSettings)
.settings(gatlingAggregateRunnerEcrSettings)
.settings(gatlingAggregateRunTaskSettings)
.settings(
name := "gatling-aggregate-runner",
Compile / bashScriptDefines / mainClass := Some(
"com.github.j5ik2o.gatling.runner.Runner"
),
dockerBaseImage := "openjdk:8",
dockerUsername := Some("j5ik2o"),
Docker / packageName := "gatling-aggregate-runner",
dockerUpdateLatest := true,
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.7.36",
"ch.qos.logback" % "logback-classic" % "1.2.11",
"org.codehaus.janino" % "janino" % "3.0.6",
"com.iheart" %% "ficus" % "1.4.6",
"com.github.j5ik2o" %% "reactive-aws-ecs-core" % "1.1.3",
"org.scalaj" %% "scalaj-http" % "2.4.2"
)
)
val `aws-gatling-tools` =
(project in file("."))
.settings(baseSettings)
.settings(name := "aws-gatling-tools")
.aggregate(
`api-server`,
`gatling-test`,
`gatling-runner`,
`gatling-s3-reporter`,
`gatling-aggregate-runner`
)
// --- Custom commands
addCommandAlias("lint", ";scalafmtCheck;test:scalafmtCheck;scalafmtSbtCheck;scalafixAll --check")
addCommandAlias("fmt", ";scalafmtAll;scalafmtSbt;scalafix RemoveUnused")