2018-07-27 10:18:29 -04:00
|
|
|
import sbt._
|
|
|
|
object Dependencies {
|
|
|
|
|
2020-04-28 10:08:03 -04:00
|
|
|
lazy val akkaHttpV = "10.1.10"
|
2019-08-07 09:13:05 -04:00
|
|
|
lazy val akkaV = "2.5.23"
|
2018-07-27 10:18:29 -04:00
|
|
|
lazy val jettyV = "8.1.12.v20130726"
|
2020-10-22 13:15:46 -04:00
|
|
|
lazy val pureConfigV = "0.14.0"
|
2018-07-27 10:18:29 -04:00
|
|
|
lazy val metricsScalaV = "3.5.9"
|
|
|
|
lazy val prometheusV = "0.4.0"
|
2020-10-22 13:15:46 -04:00
|
|
|
lazy val catsEffectV = "2.2.0"
|
2020-04-28 10:08:03 -04:00
|
|
|
lazy val configV = "1.4.0"
|
2020-05-18 11:00:07 -05:00
|
|
|
lazy val scalikejdbcV = "3.4.1"
|
2020-04-28 10:08:03 -04:00
|
|
|
lazy val scalaTestV = "3.1.1"
|
|
|
|
lazy val scodecV = "1.1.14"
|
|
|
|
lazy val playV = "2.7.4"
|
2018-10-10 00:30:16 +09:00
|
|
|
lazy val awsV = "1.11.423"
|
|
|
|
lazy val jaxbV = "2.3.0"
|
2018-12-21 11:48:22 -05:00
|
|
|
lazy val ip4sV = "1.1.1"
|
2021-11-02 17:06:24 -04:00
|
|
|
lazy val fs2V = "2.4.5"
|
2019-11-11 16:09:57 -05:00
|
|
|
lazy val ficusV = "1.4.3"
|
2018-07-27 10:18:29 -04:00
|
|
|
|
2018-10-19 10:58:39 -04:00
|
|
|
lazy val apiDependencies = Seq(
|
2018-07-27 10:18:29 -04:00
|
|
|
"com.typesafe.akka" %% "akka-http" % akkaHttpV,
|
|
|
|
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpV,
|
|
|
|
"de.heikoseeberger" %% "akka-http-json4s" % "1.21.0",
|
|
|
|
"com.typesafe.akka" %% "akka-slf4j" % akkaV,
|
2018-09-05 09:48:31 -04:00
|
|
|
"com.typesafe.akka" %% "akka-actor" % akkaV,
|
2018-07-27 10:18:29 -04:00
|
|
|
"com.aaronbedra" % "orchard" % "0.1.1",
|
|
|
|
"com.amazonaws" % "aws-java-sdk-core" % awsV withSources(),
|
|
|
|
"com.github.ben-manes.caffeine" % "caffeine" % "2.2.7",
|
|
|
|
"com.github.cb372" %% "scalacache-caffeine" % "0.9.4",
|
|
|
|
"com.google.protobuf" % "protobuf-java" % "2.6.1",
|
2021-10-08 15:52:09 -04:00
|
|
|
"dnsjava" % "dnsjava" % "3.4.2",
|
2018-07-27 10:18:29 -04:00
|
|
|
"org.apache.commons" % "commons-lang3" % "3.4",
|
2018-09-18 11:51:31 -04:00
|
|
|
"org.apache.commons" % "commons-text" % "1.4",
|
2021-12-17 12:54:44 -05:00
|
|
|
"org.flywaydb" % "flyway-core" % "5.2.4",
|
2018-07-27 10:18:29 -04:00
|
|
|
"org.json4s" %% "json4s-ext" % "3.5.3",
|
|
|
|
"org.json4s" %% "json4s-jackson" % "3.5.3",
|
2018-09-24 15:37:58 -04:00
|
|
|
"org.scalikejdbc" %% "scalikejdbc" % scalikejdbcV,
|
|
|
|
"org.scalikejdbc" %% "scalikejdbc-config" % scalikejdbcV,
|
2018-07-27 10:18:29 -04:00
|
|
|
"org.scodec" %% "scodec-bits" % scodecV,
|
2018-10-29 11:27:43 -04:00
|
|
|
"org.slf4j" % "slf4j-api" % "1.7.25",
|
2019-07-01 19:30:45 -04:00
|
|
|
"co.fs2" %% "fs2-core" % fs2V,
|
2018-07-27 10:18:29 -04:00
|
|
|
"com.github.pureconfig" %% "pureconfig" % pureConfigV,
|
2018-08-30 16:20:30 -04:00
|
|
|
"com.github.pureconfig" %% "pureconfig-cats-effect" % pureConfigV,
|
2018-07-27 10:18:29 -04:00
|
|
|
"io.prometheus" % "simpleclient_hotspot" % prometheusV,
|
|
|
|
"io.prometheus" % "simpleclient_dropwizard" % prometheusV,
|
|
|
|
"io.prometheus" % "simpleclient_common" % prometheusV,
|
|
|
|
"com.typesafe" % "config" % configV,
|
2018-08-07 15:43:23 -04:00
|
|
|
"org.typelevel" %% "cats-effect" % catsEffectV,
|
2018-12-21 11:48:22 -05:00
|
|
|
"com.47deg" %% "github4s" % "0.18.6",
|
|
|
|
"com.comcast" %% "ip4s-core" % ip4sV,
|
2019-02-19 12:00:34 -05:00
|
|
|
"com.comcast" %% "ip4s-cats" % ip4sV,
|
2019-11-11 16:09:57 -05:00
|
|
|
"com.iheart" %% "ficus" % ficusV,
|
2019-06-18 10:53:50 -04:00
|
|
|
"com.sun.mail" % "javax.mail" % "1.6.2",
|
2019-07-26 11:42:12 -04:00
|
|
|
"javax.mail" % "javax.mail-api" % "1.6.2",
|
2022-04-05 01:36:05 +05:30
|
|
|
"com.amazonaws" % "aws-java-sdk-sns" % awsV withSources(),
|
|
|
|
"co.elastic.logging" % "logback-ecs-encoder" % "1.3.2"
|
2018-07-27 10:18:29 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
lazy val coreDependencies = Seq(
|
2018-09-05 09:48:31 -04:00
|
|
|
"org.typelevel" %% "cats-effect" % catsEffectV,
|
|
|
|
"com.typesafe" % "config" % configV,
|
|
|
|
"joda-time" % "joda-time" % "2.8.1",
|
2018-09-05 14:29:51 -04:00
|
|
|
"org.scodec" %% "scodec-bits" % scodecV,
|
2018-09-18 11:51:31 -04:00
|
|
|
"nl.grons" %% "metrics-scala" % metricsScalaV,
|
2018-09-19 10:47:51 -04:00
|
|
|
"org.apache.commons" % "commons-text" % "1.4",
|
|
|
|
"com.github.pureconfig" %% "pureconfig" % pureConfigV,
|
2018-10-10 00:30:16 +09:00
|
|
|
"com.github.pureconfig" %% "pureconfig-cats-effect" % pureConfigV,
|
|
|
|
"javax.xml.bind" % "jaxb-api" % jaxbV % "provided",
|
|
|
|
"com.sun.xml.bind" % "jaxb-core" % jaxbV,
|
2018-10-19 10:58:39 -04:00
|
|
|
"com.sun.xml.bind" % "jaxb-impl" % jaxbV,
|
2019-06-17 17:15:29 -04:00
|
|
|
"ch.qos.logback" % "logback-classic" % "1.0.7",
|
2019-07-01 13:53:00 -04:00
|
|
|
"io.dropwizard.metrics" % "metrics-jvm" % "3.2.2",
|
2021-11-02 17:06:24 -04:00
|
|
|
"co.fs2" %% "fs2-core" % fs2V,
|
2020-04-28 10:08:03 -04:00
|
|
|
"javax.xml.bind" % "jaxb-api" % "2.3.0",
|
2022-01-19 14:08:55 +05:30
|
|
|
"javax.activation" % "activation" % "1.1.1",
|
|
|
|
"org.scalikejdbc" %% "scalikejdbc" % scalikejdbcV,
|
2022-04-05 01:36:05 +05:30
|
|
|
"org.scalikejdbc" %% "scalikejdbc-config" % scalikejdbcV,
|
|
|
|
"co.elastic.logging" % "logback-ecs-encoder" % "1.3.2"
|
2018-07-27 10:18:29 -04:00
|
|
|
)
|
|
|
|
|
2018-09-24 15:37:58 -04:00
|
|
|
lazy val mysqlDependencies = Seq(
|
2021-12-17 12:54:44 -05:00
|
|
|
"org.flywaydb" % "flyway-core" % "5.2.4",
|
2018-10-30 15:29:41 -04:00
|
|
|
"org.mariadb.jdbc" % "mariadb-java-client" % "2.3.0",
|
2018-09-24 15:37:58 -04:00
|
|
|
"org.scalikejdbc" %% "scalikejdbc" % scalikejdbcV,
|
|
|
|
"org.scalikejdbc" %% "scalikejdbc-config" % scalikejdbcV,
|
2021-10-08 15:52:09 -04:00
|
|
|
"com.zaxxer" % "HikariCP" % "3.2.0",
|
|
|
|
"com.h2database" % "h2" % "1.4.200",
|
2021-12-23 23:50:25 +05:30
|
|
|
"commons-codec" % "commons-codec" % "1.15"
|
2018-09-24 15:37:58 -04:00
|
|
|
)
|
|
|
|
|
2018-10-12 10:21:44 -04:00
|
|
|
lazy val sqsDependencies = Seq(
|
|
|
|
"com.amazonaws" % "aws-java-sdk-core" % awsV withSources(),
|
|
|
|
"com.amazonaws" % "aws-java-sdk-sqs" % awsV withSources()
|
|
|
|
)
|
|
|
|
|
Add backend provider (#980)
Introduces the concept of a `Backend` into VinylDNS. This will allow support for any DNS backend in the future, including AwS Route53 for example. This is consistent with other "provider" things for dynamic loading of classes (Notifier, Repository, Queue, etc.)
The initial implementation builds on what we have already, that is when creating a zone one can choose a `backendId` that is configured in the `application.conf`. If no `backendId` is specified, we attempt to map like we do today, so the exact same functionality.
We expand that by allowing one to map a `backendId` to a different provider (like aws).
After this PR:
1. If someone specifies a zone connection on a zone, it will work exactly like it does today, namely go through the `DnsBackend` to connect.
2. If someone specifies a `backendId` when setting up a zone, the naive mapping will take place to map that zone to the `Backend` implementation that is configured with that `backendId`. For example, if you have configured a backend id `aws` that connects to Route53, and you specify `aws` when connecting the zone, it will connect to it in Route 53 **Note: we still do not support zone create, but that is much closer to reality with this PR, much much**
3. If someone specifies NEITHER, the `defaultBackendId` will be used, which could be on any one of the backend providers configured.
To start, there is a new `vinyldns.core.domain.backend` package that contains the main classes for the system. In there you will find the following:
- `BackendProvider` - this is to be implemented by each provider. Adds a means of pre-loading zones, and providing connections to zones.
- `Backend` - provides connectivity to a particular backend instance. For example, a particular DNS Authoritative server. This is where the real work happens of interacting with whatever backend. For example, `DnsConnection` implements this to send DDNS messages to the DNS system. Consider this the "main" thing to implement, where the rubber meets the road, the meat and potatoes
- `BackendProviderLoader` - to be implemented by each provider, knows how to load it's single instance `BackendProvider`, as well as possibly pre-loading configured `Backends` or anything else it needs to do to get ready. It provides a dynamic hook via the `def load` method that is called by the `BackendLoader` to load a specific `Backend`
- `BackendResolver` - the main, default, BackendResolver. It holds all `BackendProvider` instances loaded via the `BackendLoader` and provides right now a naive lookup mechanism to find `Backend`s. Really, this is more of a `Router` or `Resolver`, as in the future it could use more advanced techniques to finding connections than right now
- `BackendConfigs` - used by the `BackendRegistry` as the entrypoint into configuration for all backends
- `BackendProviderConfig` - a single backend provider configuration, specifies a `className` that should be the `BackendProviderLoader` implementation to be loaded, and a `settings` that is passed into the `BackendProvider` to load itself. This is consistent with other providers.
- `BackendResponse` - uniform responses across all providers to the rest of the VinylDNS System
**Workflow**
During initialization of the system:
1. The `BackendResolver` loads the `BackendConfigs` from the application configuration. This contains configuration for ALL backends
2. The `BackendResolver` utilizes the `BackendLoader` to dynamically load each backend individually. If any backend cannot be loaded, it will fail.
3. The `BackendLoader` creates a new instance of each `className` for each `BackendConfig`, this points to the `BackendProviderLoader` implementation which takes care of loading the specific `BackendProvider` provided the configuration
4. The `BackendProviderLoader` does any initialization necessary to ensure it is ready. In the case of `Route53`, it will pre-load and cache all hosted zones that are available for the AWS account that is configured. For Route53, a single `Route53Backend` is setup right now. For `DnsBackend`, a connection (server, port, tsig key) is setup for each DNS Authoritative system to integrate with.
During runtime of the system:
1. When anything is needed, the `BackendResolver` is consulted that will determine how to lookup the `Backend` that is needed. This is done right now by naively scanning all `BackendProvider` instances it has to say "can anyone connect to this zone". More intelligent discovery rules can be added in the future
2. Once a `Backend` is obtained, any operation can be performed:
1. `ZoneConnectionValidator` uses `zoneExists` and `loadZone` to validate a zone is usable by VinylDNS
2. `RecordSetChangeHandler` uses `resolve` and `applyChange` to apply changes to the DNS backend
3. `ZoneSyncHandler` and `DnsZoneViewLoader` use `loadZone` in order to load records into VinylDNS
**What else is here**
- Provided an implementation of a backend provider for DNS via `Backend`
- Updated all of VinylDNS to use `Backends` instead of hard coded to DNS
- Provided an implementation of a backend provider for AWS Route 53 as an example to follow for other providers
**Example configuration**
```
vinyldns {
backend {
default-backend-id = "r53"
backend-providers = [
{
class-name = "vinyldns.route53.backend.Route53BackendProviderLoader"
settings = {
backends = [
{
id = "test"
access-key = "vinyldnsTest"
secret-key = "notNeededForSnsLocal"
service-endpoint = "http://127.0.0.1:19009"
signing-region = "us-east-1"
}
]
}
}
]
}
}
```
2020-09-30 09:17:32 -04:00
|
|
|
lazy val r53Dependencies = Seq(
|
|
|
|
"com.amazonaws" % "aws-java-sdk-core" % awsV withSources(),
|
|
|
|
"com.amazonaws" % "aws-java-sdk-route53" % awsV withSources()
|
|
|
|
)
|
|
|
|
|
2018-09-07 12:02:25 -04:00
|
|
|
lazy val commonTestDependencies = Seq(
|
2018-07-27 10:18:29 -04:00
|
|
|
"org.scalatest" %% "scalatest" % scalaTestV,
|
2020-04-28 10:08:03 -04:00
|
|
|
"org.scalacheck" %% "scalacheck" % "1.14.3",
|
|
|
|
"com.ironcorelabs" %% "cats-scalatest" % "3.0.5",
|
|
|
|
"org.mockito" % "mockito-core" % "1.10.19",
|
|
|
|
"org.scalatestplus" %% "scalatestplus-mockito" % "1.0.0-M2",
|
2021-12-23 23:50:25 +05:30
|
|
|
"org.scalatestplus" %% "scalatestplus-scalacheck" % "3.1.0.0-RC2",
|
|
|
|
"commons-codec" % "commons-codec" % "1.15"
|
2018-09-05 09:48:31 -04:00
|
|
|
)
|
|
|
|
|
2018-09-07 12:02:25 -04:00
|
|
|
lazy val apiTestDependencies = commonTestDependencies ++ Seq(
|
2018-09-05 09:48:31 -04:00
|
|
|
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpV,
|
2019-08-07 09:13:05 -04:00
|
|
|
"com.typesafe.akka" %% "akka-stream-testkit" % akkaV,
|
2021-12-23 23:50:25 +05:30
|
|
|
"junit" % "junit" % "4.12",
|
|
|
|
"commons-codec" % "commons-codec" % "1.15"
|
2018-09-05 09:48:31 -04:00
|
|
|
)
|
2018-07-27 10:18:29 -04:00
|
|
|
|
|
|
|
lazy val portalDependencies = Seq(
|
2019-08-07 09:13:05 -04:00
|
|
|
"com.typesafe.play" %% "play-json" % "2.7.4",
|
2018-07-27 10:18:29 -04:00
|
|
|
"com.amazonaws" % "aws-java-sdk-core" % awsV withSources(),
|
|
|
|
"com.typesafe.play" %% "play-jdbc" % playV,
|
|
|
|
"com.typesafe.play" %% "play-guice" % playV,
|
|
|
|
"com.typesafe.play" %% "play-ahc-ws" % playV,
|
2019-02-19 11:34:45 -05:00
|
|
|
"com.typesafe.play" %% "play-specs2" % playV % "test",
|
2019-08-07 09:13:05 -04:00
|
|
|
// Netty is to get past a ClassNotFoundError for UnixChannelOption
|
|
|
|
// https://discuss.lightbend.com/t/integration-tests-using-play-2-7-2-are-using-the-nettyserver/4458/3
|
|
|
|
"io.netty" % "netty-transport-native-unix-common" % "4.1.37.Final" % "test",
|
2019-02-19 11:34:45 -05:00
|
|
|
"com.nimbusds" % "oauth2-oidc-sdk" % "6.5",
|
2019-07-01 19:30:45 -04:00
|
|
|
"com.nimbusds" % "nimbus-jose-jwt" % "7.0",
|
2019-10-21 12:02:27 -04:00
|
|
|
"co.fs2" %% "fs2-core" % fs2V,
|
2021-10-08 15:52:09 -04:00
|
|
|
"de.leanovate.play-mockws" %% "play-mockws" % "2.7.1" % "test",
|
2022-04-05 01:36:05 +05:30
|
|
|
"com.iheart" %% "ficus" % ficusV,
|
|
|
|
"co.elastic.logging" % "logback-ecs-encoder" % "1.3.2"
|
2018-07-27 10:18:29 -04:00
|
|
|
)
|
|
|
|
}
|