Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pekko #27

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4bfd347
Update scala versions
Apr 4, 2018
3cafc21
Update sbt version
Apr 4, 2018
d0e041d
Added ability to use only the healthy services for load balancing (#1)
ecyshor Sep 4, 2018
43e59fa
Updating deps and adding release possibilities
Dec 3, 2018
99d7241
Adding credentials
Dec 3, 2018
d808543
Setting version to 0.4.1
Dec 3, 2018
6f34399
Setting version to 0.4.2-SNAPSHOT
Dec 3, 2018
d622eb2
Version
Dec 3, 2018
2a262b6
x
Dec 3, 2018
f27922a
Setting version to 0.5.0
Dec 3, 2018
d7e7e23
Setting version to 0.5.1-SNAPSHOT
Dec 3, 2018
896b009
Removing println
sjoerdmulder Jan 2, 2019
20b0369
Setting version to 0.5.1
Jan 2, 2019
7b0fee0
Setting version to 0.5.2-SNAPSHOT
Jan 2, 2019
eec8632
Update to scala 2.13
Mar 26, 2020
abc8f7a
Setting version to 0.5.2
Mar 26, 2020
5d489f7
Setting version to 0.5.3-SNAPSHOT
Mar 26, 2020
58c3344
Updating build
Mar 26, 2020
3f46be9
Cleaning up project, upgrading project to latest standards
Nov 2, 2023
b37668b
Cleaning up project, upgrading project to latest standards
Nov 2, 2023
a3854a2
Cleaning up project, upgrading project to latest standards
Nov 2, 2023
86ac1db
Cleaning code
Nov 2, 2023
ea70fc7
First test is passing
Nov 2, 2023
6f3f92f
All tests are passing, working on IT tests now
Nov 2, 2023
a994637
IT tests are passing
Nov 2, 2023
ba1f56f
IT tests are passing
Nov 2, 2023
bef4062
Fixed logging
Nov 2, 2023
547c0f7
Fixing IT tests
Nov 2, 2023
5a4d455
Fixing IT tests
Nov 2, 2023
d4c5d54
Fixing IT tests
Nov 2, 2023
5cfa21f
Almost there, fixing last value
Nov 2, 2023
4fa0924
Fixed all tests
Nov 2, 2023
0edd5fd
Fixed all tests
Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lib_managed/
src_managed/
project/boot/
project/plugins/project/
credentials.sbt

# Scala-IDE specific
.scala_dependencies
Expand Down
28 changes: 28 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
style = defaultWithAlign
//@formatter on
align {
tokens = [
{code = "=>", owner = "Case"}
{code = "extends", owner = "Defn.(Class|Trait|Object)"}
{code = "//", owner = ".*"}
{code = "{", owner = "Template"}
{code = "}", owner = "Template"}
{code = "%", owner = "Term.ApplyInfix"}
{code = "%%", owner = "Term.ApplyInfix"}
{code = "%%%", owner = "Term.ApplyInfix"}
{code = "=>", owner = "Case"}
{code = "<-", owner = "Enumerator.Generator"}
{code = "←", owner = "Enumerator.Generator"}
{code = "->", owner = "Term.ApplyInfix"}
{code = "→", owner = "Term.ApplyInfix"}
{code = "=", owner = "(Enumerator.Val|Defn.(Va(l|r)|Def|Type))"}
]
}
danglingParentheses = true
docstrings = JavaDoc
indentOperator = spray
maxColumn = 120
rewrite.rules = [RedundantBraces, RedundantParens, SortImports]
unindentTopLevelOperators = true
project.git = true
newlines.alwaysBeforeTopLevelStatements = true
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

61 changes: 61 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from http://www.scala-sbt.org/release/docs/Using-Sonatype.html

The credentials for your Sonatype OSSRH account need to be stored somewhere safe (e.g. NOT in the repository).
Common convention is a ~/.sbt/1.0/sonatype.sbt or (~/.sbt/.credentials) file with the following:

```
credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
"<your username>",
"<your password>")
```

If not done already, generate a key and upload it to a keyserver.

```
$ gpg --gen-key
$ gpg --list-secret-keys
$ gpg --keyserver keyserver.ubuntu.com --send-keys 2BE.......E804D85663F
```

Release the client is done using the following three steps:

```
1. Release Code
2. Publish Artifacts
3. Releese Artifacts
```

## Release Code

To release and publish a version to oss.sonatype for both scala 2.12 and scala 2.13 run:

```
sbt release
```
It's likely that *after* pushing all artifacts to the online repository you'll see an error complaining that the
tag already exists. That's ok.

## Publish Artifacts

To only publish a certain version after f.e. the tags has been build, but your PGP was not correctly unlocked you can
run

```
sbt publishSigned
```

If you want to publish only a single SCALA version, use `sbt ++2.11.12 publishSigned`

## Release Artifacts

To close and release the staging repository on Sonatype you can either go to the web interface or use

```
sbt sonatypeRelease
```

If something goes wrong and you want to cleanup/rollback, use `sbt sonatypeDropAll`

You can verify if all has been published correctly by visiting the following url:<br>
https://oss.sonatype.org/#nexus-search;quick~reactive%20crobox
216 changes: 67 additions & 149 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,160 +1,78 @@
import Dependencies._
import sbt.Keys._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
// Scala Formatting
ThisBuild / scalafmtVersion := "1.5.1"
ThisBuild / scalafmtOnCompile := false // all projects
ThisBuild / scalafmtTestOnCompile := false // all projects

import scalariform.formatter.preferences._
releaseCrossBuild := true

// Common variables
lazy val commonSettings = Seq(
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8", "2.12.2"),
organization := "nl.stormlantern",
version := "0.4.0-SNAPSHOT",
resolvers ++= Dependencies.resolutionRepos,
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
)

lazy val reactiveConsul = (project in file("."))
.settings( commonSettings: _* )
.settings( publishSettings: _* )
.aggregate(client, dnsHelper, dockerTestkit/*, example*/)


lazy val dnsHelper = (project in file("dns-helper"))
.settings( commonSettings: _* )
.settings( publishSettings: _* )
.settings(
name := "reactive-consul-dns",
publishArtifact in Compile := true,
publishArtifact in makePom := true,
publishArtifact in Test := false,
publishArtifact in IntegrationTest := false,
fork := true,
libraryDependencies ++= Seq(
spotifyDns
),
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(RewriteArrowSymbols, true)
)
sonatypeProfileName := "com.crobox"

lazy val client = (project in file("client"))
.settings( commonSettings: _* )
.settings( publishSettings: _* )
lazy val root = (project in file("."))
.settings(
name := "reactive-consul",
publishArtifact in Compile := true,
publishArtifact in makePom := true,
publishArtifact in Test := false,
publishArtifact in IntegrationTest := false,
fork := true,
libraryDependencies ++= Seq(
akkaHttp,
sprayJson,
akkaActor,
slf4j,
akkaSlf4j,
scalaTest % "it,test",
scalaMock % "test",
logback % "it,test",
akkaTestKit % "it,test",
spotifyDocker % "it,test"
publish := {},
publishArtifact := false,
inThisBuild(
List(
organization := "com.crobox",
scalaVersion := "2.13.8",
crossScalaVersions := List("2.13.8"),
javacOptions ++= Seq("-g", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "11", "-target", "11"),
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-language:_", "-encoding", "UTF-8"),
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomExtra := {
<url>https://github.com/crobox/reactive-consul</url>
<licenses>
<license>
<name>MIT</name>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:crobox/reactive-consul.git</url>
<connection>scm:[email protected]:crobox/reactive-consul.git</connection>
</scm>
<developers>
<developer>
<id>crobox</id>
<name>crobox</name>
<url>https://github.com/crobox</url>
</developer>
<developer>
<id>dlouwers</id>
<name>Dirk Louwers</name>
<url>http://github.com/dlouwers</url>
</developer>
</developers>
}
)
),
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(RewriteArrowSymbols, true)
name := "reactive-consul"
)
.configs( IntegrationTest )
.settings( Defaults.itSettings : _* )
.settings( SbtScalariform.scalariformSettingsWithIt : _* )
.dependsOn(dockerTestkit % "it-internal")
.aggregate(client)

lazy val dockerTestkit = (project in file("docker-testkit"))
.settings( commonSettings: _* )
lazy val client: Project = (project in file("client"))
.configs(Config.CustomIntegrationTest)
.settings(Config.testSettings: _*)
.settings(
name := "client",
sbtrelease.ReleasePlugin.autoImport.releasePublishArtifactsAction := PgpKeys.publishSigned.value,
libraryDependencies ++= Seq(
slf4j,
scalaTest,
spotifyDocker
"ch.qos.logback" % "logback-classic" % "1.4.7",
"io.spray" %% "spray-json" % "1.3.6",
"org.apache.pekko" %% "pekko-actor" % Dependencies.PekkoVersion,
"org.apache.pekko" %% "pekko-slf4j" % Dependencies.PekkoVersion,
"org.apache.pekko" %% "pekko-stream" % Dependencies.PekkoVersion,
"org.apache.pekko" %% "pekko-http" % Dependencies.PekkoHttpVersion,
// test dependencies
"org.apache.pekko" %% "pekko-testkit" % Dependencies.PekkoVersion % Test,
"org.scalatest" %% "scalatest" % "3.2.15" % Test,
"org.scalamock" %% "scalamock" % "5.2.0" % Test
)
)
.configs( IntegrationTest )
.settings( Defaults.itSettings : _* )
.settings( SbtScalariform.scalariformSettingsWithIt : _* )
.settings( publishSettings: _* )


//lazy val example = (project in file("example"))
// .aggregate(client)
// .dependsOn(client, dnsHelper)
// .settings( commonSettings: _* )
// .settings(
// crossScalaVersions := Seq()
// )
// .settings(
// libraryDependencies ++= Seq(
// sprayClient,
// sprayRouting,
// sprayJson,
// slf4j,
// logback
// )
// )
// .settings(
// fork := true,
// libraryDependencies ++= Seq(
// akkaActor,
// sprayClient,
// sprayJson
// )
// )
// .settings( publishSettings: _* )
// .enablePlugins(JavaAppPackaging)
// .settings(
// packageName in Docker := "reactive-consul-example",
// maintainer in Docker := "Dirk Louwers <[email protected]>",
// dockerExposedPorts in Docker := Seq(8080),
// dockerExposedVolumes in Docker := Seq("/opt/docker/logs")
// )

lazy val publishSettings = Seq(
publishArtifact := false,
publishMavenStyle := true,
pomIncludeRepository := { _ => false },
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomExtra := (
<url>http://github.com/dlouwers/reactive-consul</url>
<licenses>
<license>
<name>MIT</name>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:dlouwers/reactive-consul.git</url>
<connection>scm:[email protected]:dlouwers/reactive-consul.git</connection>
</scm>
<developers>
<developer>
<id>dlouwers</id>
<name>Dirk Louwers</name>
<url>http://github.com/dlouwers</url>
</developer>
</developers>
)
)

Revolver.settings.settings
6 changes: 3 additions & 3 deletions client/src/it/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
pekko {
loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
loglevel = "INFO"
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
logging-filter = "org.apache.pekko.event.slf4j.Slf4jLoggingFilter"
log-dead-letters-during-shutdown = off
}
14 changes: 0 additions & 14 deletions client/src/it/resources/logback-test.xml

This file was deleted.

24 changes: 24 additions & 0 deletions client/src/it/scala/stormlantern/consul/client/ClientITSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package stormlantern.consul.client

import com.typesafe.config.{Config, ConfigFactory}
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.testkit.TestKit
import org.scalatest.concurrent.{Eventually, IntegrationPatience, ScalaFutures}
import org.scalatest.flatspec.AnyFlatSpecLike
import org.scalatest.matchers.should.Matchers

import scala.concurrent.ExecutionContext

abstract class ClientITSpec(val config: Config = ConfigFactory.load())
extends TestKit(ActorSystem("TestSystem", config))
with AnyFlatSpecLike
with Matchers
with ScalaFutures
with Eventually
with IntegrationPatience {

implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global

val host = "localhost"
val port = 8500
}
Loading