mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-31 06:15:49 +00:00
add config for zone sync scheduler
This commit is contained in:
@@ -27,10 +27,16 @@ vinyldns {
|
|||||||
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
||||||
multi-record-batch-change-enabled = true
|
multi-record-batch-change-enabled = true
|
||||||
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
||||||
|
|
||||||
|
# Server settings
|
||||||
use-recordset-cache = true
|
use-recordset-cache = true
|
||||||
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
||||||
load-test-data = false
|
load-test-data = false
|
||||||
load-test-data = ${?LOAD_TEST_DATA}
|
load-test-data = ${?LOAD_TEST_DATA}
|
||||||
|
# should be true while running locally or when we have only one api server/instance, for zone sync scheduler to work
|
||||||
|
is-zone-sync-schedule-allowed = true
|
||||||
|
# should be set to true only on a single server/instance else automated sync will be performed at every server/instance
|
||||||
|
is-zone-sync-schedule-allowed = ${?IS_ZONE_SYNC_SCHEDULE_ALLOWED}
|
||||||
|
|
||||||
# configured backend providers
|
# configured backend providers
|
||||||
backend {
|
backend {
|
||||||
|
@@ -27,10 +27,16 @@ vinyldns {
|
|||||||
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
||||||
multi-record-batch-change-enabled = true
|
multi-record-batch-change-enabled = true
|
||||||
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
||||||
|
|
||||||
|
# Server settings
|
||||||
use-recordset-cache = false
|
use-recordset-cache = false
|
||||||
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
||||||
load-test-data = false
|
load-test-data = false
|
||||||
load-test-data = ${?LOAD_TEST_DATA}
|
load-test-data = ${?LOAD_TEST_DATA}
|
||||||
|
# should be true while running locally or when we have only one api server/instance, for zone sync scheduler to work
|
||||||
|
is-zone-sync-schedule-allowed = true
|
||||||
|
# should be set to true only on a single server/instance else automated sync will be performed at every server/instance
|
||||||
|
is-zone-sync-schedule-allowed = ${?IS_ZONE_SYNC_SCHEDULE_ALLOWED}
|
||||||
|
|
||||||
# configured backend providers
|
# configured backend providers
|
||||||
backend {
|
backend {
|
||||||
|
@@ -232,4 +232,9 @@ vinyldns {
|
|||||||
|
|
||||||
load-test-data = false
|
load-test-data = false
|
||||||
load-test-data = ${?LOAD_TEST_DATA}
|
load-test-data = ${?LOAD_TEST_DATA}
|
||||||
|
|
||||||
|
# should be true while running locally or when we have only one api server/instance, for zone sync scheduler to work
|
||||||
|
is-zone-sync-schedule-allowed = true
|
||||||
|
# should be set to true only on a single server/instance else automated sync will be performed at every server/instance
|
||||||
|
is-zone-sync-schedule-allowed = ${?IS_ZONE_SYNC_SCHEDULE_ALLOWED}
|
||||||
}
|
}
|
||||||
|
@@ -100,7 +100,7 @@ object Boot extends App {
|
|||||||
)
|
)
|
||||||
_ <- APIMetrics.initialize(vinyldnsConfig.apiMetricSettings)
|
_ <- APIMetrics.initialize(vinyldnsConfig.apiMetricSettings)
|
||||||
// Schedule the zone sync task to be executed every 5 seconds
|
// Schedule the zone sync task to be executed every 5 seconds
|
||||||
_ <- IO(executor.scheduleAtFixedRate(() => {
|
_ <- if (vinyldnsConfig.serverConfig.isZoneSyncScheduleAllowed){ IO(executor.scheduleAtFixedRate(() => {
|
||||||
val zoneChanges = for {
|
val zoneChanges = for {
|
||||||
zoneChanges <- ZoneSyncScheduleHandler.zoneSyncScheduler(repositories.zoneRepository)
|
zoneChanges <- ZoneSyncScheduleHandler.zoneSyncScheduler(repositories.zoneRepository)
|
||||||
_ <- if (zoneChanges.nonEmpty) messageQueue.sendBatch(NonEmptyList.fromList(zoneChanges.toList).get) else IO.unit
|
_ <- if (zoneChanges.nonEmpty) messageQueue.sendBatch(NonEmptyList.fromList(zoneChanges.toList).get) else IO.unit
|
||||||
@@ -111,7 +111,7 @@ object Boot extends App {
|
|||||||
case Left(error) =>
|
case Left(error) =>
|
||||||
logger.error(s"An error occurred while performing the scheduled zone sync. Error: $error")
|
logger.error(s"An error occurred while performing the scheduled zone sync. Error: $error")
|
||||||
}
|
}
|
||||||
}, 0, 1, TimeUnit.SECONDS))
|
}, 0, 1, TimeUnit.SECONDS)) } else IO.unit
|
||||||
_ <- CommandHandler.run(
|
_ <- CommandHandler.run(
|
||||||
messageQueue,
|
messageQueue,
|
||||||
msgsPerPoll,
|
msgsPerPoll,
|
||||||
|
@@ -34,13 +34,14 @@ final case class ServerConfig(
|
|||||||
keyName: String,
|
keyName: String,
|
||||||
processingDisabled: Boolean,
|
processingDisabled: Boolean,
|
||||||
useRecordSetCache: Boolean,
|
useRecordSetCache: Boolean,
|
||||||
loadTestData: Boolean
|
loadTestData: Boolean,
|
||||||
|
isZoneSyncScheduleAllowed: Boolean,
|
||||||
)
|
)
|
||||||
object ServerConfig {
|
object ServerConfig {
|
||||||
|
|
||||||
import ZoneRecordValidations.toCaseIgnoredRegexList
|
import ZoneRecordValidations.toCaseIgnoredRegexList
|
||||||
|
|
||||||
implicit val configReader: ConfigReader[ServerConfig] = ConfigReader.forProduct12[
|
implicit val configReader: ConfigReader[ServerConfig] = ConfigReader.forProduct13[
|
||||||
ServerConfig,
|
ServerConfig,
|
||||||
Int,
|
Int,
|
||||||
Int,
|
Int,
|
||||||
@@ -53,6 +54,7 @@ object ServerConfig {
|
|||||||
Config,
|
Config,
|
||||||
Boolean,
|
Boolean,
|
||||||
Boolean,
|
Boolean,
|
||||||
|
Boolean,
|
||||||
Boolean
|
Boolean
|
||||||
](
|
](
|
||||||
"health-check-timeout",
|
"health-check-timeout",
|
||||||
@@ -66,7 +68,8 @@ object ServerConfig {
|
|||||||
"defaultZoneConnection",
|
"defaultZoneConnection",
|
||||||
"processing-disabled",
|
"processing-disabled",
|
||||||
"use-recordset-cache",
|
"use-recordset-cache",
|
||||||
"load-test-data"
|
"load-test-data",
|
||||||
|
"is-zone-sync-schedule-allowed"
|
||||||
) {
|
) {
|
||||||
case (
|
case (
|
||||||
timeout,
|
timeout,
|
||||||
@@ -80,7 +83,8 @@ object ServerConfig {
|
|||||||
zoneConnConfig,
|
zoneConnConfig,
|
||||||
processingDisabled,
|
processingDisabled,
|
||||||
useRecordSetCache,
|
useRecordSetCache,
|
||||||
loadTestData) =>
|
loadTestData,
|
||||||
|
isZoneSyncScheduleAllowed) =>
|
||||||
ServerConfig(
|
ServerConfig(
|
||||||
timeout,
|
timeout,
|
||||||
ttl,
|
ttl,
|
||||||
@@ -93,7 +97,8 @@ object ServerConfig {
|
|||||||
zoneConnConfig.getString("keyName"),
|
zoneConnConfig.getString("keyName"),
|
||||||
processingDisabled,
|
processingDisabled,
|
||||||
useRecordSetCache,
|
useRecordSetCache,
|
||||||
loadTestData
|
loadTestData,
|
||||||
|
isZoneSyncScheduleAllowed
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,10 +27,16 @@ vinyldns {
|
|||||||
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
||||||
multi-record-batch-change-enabled = true
|
multi-record-batch-change-enabled = true
|
||||||
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
||||||
|
|
||||||
|
# Server settings
|
||||||
use-recordset-cache = false
|
use-recordset-cache = false
|
||||||
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
||||||
load-test-data = false
|
load-test-data = false
|
||||||
load-test-data = ${?LOAD_TEST_DATA}
|
load-test-data = ${?LOAD_TEST_DATA}
|
||||||
|
# should be true while running locally or when we have only one api server/instance, for zone sync scheduler to work
|
||||||
|
is-zone-sync-schedule-allowed = true
|
||||||
|
# should be set to true only on a single server/instance else automated sync will be performed at every server/instance
|
||||||
|
is-zone-sync-schedule-allowed = ${?IS_ZONE_SYNC_SCHEDULE_ALLOWED}
|
||||||
|
|
||||||
# configured backend providers
|
# configured backend providers
|
||||||
backend {
|
backend {
|
||||||
|
@@ -388,6 +388,14 @@ Version of the application that is deployed. Currently, this is a configuration
|
|||||||
**Note: You can get installation information including color, version, default key name, and processing-disabled by
|
**Note: You can get installation information including color, version, default key name, and processing-disabled by
|
||||||
hitting the _status_ endpoint GET /status**
|
hitting the _status_ endpoint GET /status**
|
||||||
|
|
||||||
|
### Is Zone Sync Schedule Allowed
|
||||||
|
|
||||||
|
Used while deploying. Should be set to `true` only on one api server/instance and `false` on every other api servers/instances.
|
||||||
|
Thus automated sync will be done only once on a single server/instance instead of every api servers/instances.
|
||||||
|
Set it to `true` while running locally or when we have only a single api server/instance.
|
||||||
|
|
||||||
|
`is-zone-sync-schedule-allowed = true`
|
||||||
|
|
||||||
### HTTP Host and Port
|
### HTTP Host and Port
|
||||||
|
|
||||||
To specify what host and port to bind to when starting up the API server, default is 9000.
|
To specify what host and port to bind to when starting up the API server, default is 9000.
|
||||||
|
@@ -262,10 +262,16 @@ vinyldns {
|
|||||||
manual-batch-review-enabled = true
|
manual-batch-review-enabled = true
|
||||||
scheduled-changes-enabled = true
|
scheduled-changes-enabled = true
|
||||||
multi-record-batch-change-enabled = true
|
multi-record-batch-change-enabled = true
|
||||||
|
|
||||||
|
#Server settings
|
||||||
use-recordset-cache = true
|
use-recordset-cache = true
|
||||||
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
||||||
load-test-data = true
|
load-test-data = true
|
||||||
load-test-data = ${?LOAD_TEST_DATA}
|
load-test-data = ${?LOAD_TEST_DATA}
|
||||||
|
# should be true while running locally or when we have only one api server/instance, for zone sync scheduler to work
|
||||||
|
is-zone-sync-schedule-allowed = true
|
||||||
|
# should be set to true only on a single server/instance else automated sync will be performed at every server/instance
|
||||||
|
is-zone-sync-schedule-allowed = ${?IS_ZONE_SYNC_SCHEDULE_ALLOWED}
|
||||||
|
|
||||||
global-acl-rules = [
|
global-acl-rules = [
|
||||||
{
|
{
|
||||||
|
@@ -31,10 +31,16 @@ vinyldns {
|
|||||||
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
|
||||||
multi-record-batch-change-enabled = true
|
multi-record-batch-change-enabled = true
|
||||||
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
|
||||||
|
|
||||||
|
# Server settings
|
||||||
use-recordset-cache = true
|
use-recordset-cache = true
|
||||||
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
use-recordset-cache = ${?USE_RECORDSET_CACHE}
|
||||||
load-test-data = true
|
load-test-data = true
|
||||||
load-test-data = ${?LOAD_TEST_DATA}
|
load-test-data = ${?LOAD_TEST_DATA}
|
||||||
|
# should be true while running locally or when we have only one api server/instance, for zone sync scheduler to work
|
||||||
|
is-zone-sync-schedule-allowed = true
|
||||||
|
# should be set to true only on a single server/instance else automated sync will be performed at every server/instance
|
||||||
|
is-zone-sync-schedule-allowed = ${?IS_ZONE_SYNC_SCHEDULE_ALLOWED}
|
||||||
|
|
||||||
# configured backend providers
|
# configured backend providers
|
||||||
backend {
|
backend {
|
||||||
|
Reference in New Issue
Block a user