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

aws keyspace configs for hmda-platform #4918

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ lazy val akkaPersistenceDeps =
akkaPersistenceQuery,
akkaClusterShardingTyped,
akkaPersistenceCassandra,
keyspacedriver,
cassandraLauncher
)

Expand Down Expand Up @@ -176,7 +177,7 @@ lazy val `hmda-platform` = (project in file("hmda"))
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
},
reStart / envVars ++= Map("CASSANDRA_CLUSTER_HOSTS" -> "localhost", "APP_PORT" -> "2551"),
// reStart / envVars ++= Map("CASSANDRA_CLUSTER_HOSTS" -> "localhost", "APP_PORT" -> "2551"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zencircle can you uncomment this line it will cause problems down the line if its commented out by default.

),
dockerSettings,
packageSettings
Expand Down
108 changes: 108 additions & 0 deletions common/src/main/resources/persistence-keyspace-sigv4.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
include "serialization.conf"

akka {

persistence {
journal.plugin = "akka.persistence.cassandra.journal"
snapshot-store.plugin = "akka.persistence.cassandra.snapshot"

query {
journal.id = "akka.persistence.cassandra.query"
}

cassandra {
events-by-tag {
max-message-batch-size = 30
max-message-batch-size = ${?TAG_BATCH_SIZE}
flush-interval = 150ms
flush-interval = ${?TAG_FLUSH_INTERVAL}
}
journal {
keyspace = "hmda2_journal"
keyspace = ${?CASSANDRA_JOURNAL_KEYSPACE}
table = "journal"
events-by-tag.max-message-batch-size = 30
events-by-tag.max-message-batch-size = ${?TAG_BATCH_SIZE}
events-by-tag.flush-interval = 150ms
events-by-tag.flush-interval = ${?TAG_FLUSH_INTERVAL}
}
query {
# reference: https://github.com/akka/akka-persistence-cassandra/blob/v0.101/core/src/main/resources/reference.conf
# Sequence numbers for a persistenceId is assumed to be monotonically increasing
# without gaps. That is used for detecting missing events.
# In early versions of the journal that might not be true and therefore
# this can be relaxed by setting this property to off.
gap-free-sequence-numbers = off
}
snapshot {
keyspace = "hmda2_snapshot"
keyspace = ${?CASSANDRA_SNAPSHOT_KEYSPACE}
table = "snapshot"
}
}
}


}

datastax-java-driver {
profiles {
akka-persistence-cassandra-profile {
basic {
request.consistency = LOCAL_QUORUM
}
}
}
basic {
contact-points = ["localhost:9042"]
contact-points = [${?CASSANDRA_CLUSTER_HOSTS}]
load-balancing-policy.local-datacenter = ""
load-balancing-policy.local-datacenter = ${?CASSANDRA_CLUSTER_DC}
load-balancing-policy.slow-replica-avoidance = false
request.consistency = LOCAL_QUORUM
}



advanced {

advanced.protocol {
version = V4
}
auth-provider {
class = software.aws.mcs.auth.SigV4AuthProvider
aws-region = "us-east-1"
}
request-tracker {
classes = [RequestLogger]
logs {
slow {
threshold = 1 second
enabled = true
}
}
}
ssl-engine-factory {
class = DefaultSslEngineFactory
truststore-path = ${?CASSANDRA_TRUSTSTORE_FILE}
truststore-password = ${?CASSANDRA_TRUSTSTORE_PASSWORD}
hostname-validation = false
}

}
}

kafka {
hosts = "localhost:9092"
hosts = ${?KAFKA_CLUSTER_HOSTS}
idle-timeout = 5
idle-timeout = ${?KAFKA_IDLE_TIMEOUT}
security.protocol=""
security.protocol=${?KAFKA_SECURITY}
ssl.truststore.location = ""
ssl.truststore.location = ${?TRUSTSTORE_PATH}
ssl.truststore.password = ""
ssl.truststore.password = ${?TRUSTSTORE_PASSWORD}
ssl.endpoint = ""
ssl.endpoint = ${?KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG}
}
109 changes: 109 additions & 0 deletions common/src/main/resources/persistence-keyspace.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
include "serialization.conf"

akka {

persistence {
journal.plugin = "akka.persistence.cassandra.journal"
snapshot-store.plugin = "akka.persistence.cassandra.snapshot"

query {
journal.id = "akka.persistence.cassandra.query"
}

cassandra {
events-by-tag {
max-message-batch-size = 30
max-message-batch-size = ${?TAG_BATCH_SIZE}
flush-interval = 150ms
flush-interval = ${?TAG_FLUSH_INTERVAL}
}
journal {
keyspace = "hmda2_journal"
keyspace = ${?CASSANDRA_JOURNAL_KEYSPACE}
table = "journal"
events-by-tag.max-message-batch-size = 30
events-by-tag.max-message-batch-size = ${?TAG_BATCH_SIZE}
events-by-tag.flush-interval = 150ms
events-by-tag.flush-interval = ${?TAG_FLUSH_INTERVAL}
}
query {
# reference: https://github.com/akka/akka-persistence-cassandra/blob/v0.101/core/src/main/resources/reference.conf
# Sequence numbers for a persistenceId is assumed to be monotonically increasing
# without gaps. That is used for detecting missing events.
# In early versions of the journal that might not be true and therefore
# this can be relaxed by setting this property to off.
gap-free-sequence-numbers = off
}
snapshot {
keyspace = "hmda2_snapshot"
keyspace = ${?CASSANDRA_SNAPSHOT_KEYSPACE}
table = "snapshot"
}
}
}


}

datastax-java-driver {

profiles {
akka-persistence-cassandra-profile {
basic {
request.consistency = LOCAL_QUORUM
}
}
}

basic {
contact-points = ["localhost:9042"]
contact-points = [${?CASSANDRA_CLUSTER_HOSTS}]
load-balancing-policy.local-datacenter = ""
load-balancing-policy.local-datacenter = ${?CASSANDRA_CLUSTER_DC}
load-balancing-policy.slow-replica-avoidance = false
request.consistency = LOCAL_QUORUM
}

advanced {
advanced.protocol {
version = V4
}
auth-provider {
class = PlainTextAuthProvider
username = ""
username = ${?CASSANDRA_CLUSTER_USERNAME}
password = ""
password = ${?CASSANDRA_CLUSTER_PASSWORD}
}
request-tracker {
classes = [RequestLogger]
logs {
slow {
threshold = 1 second
enabled = true
}
}
}
ssl-engine-factory {
class = DefaultSslEngineFactory
truststore-path = ${?CASSANDRA_TRUSTSTORE_FILE}
truststore-password = ${?CASSANDRA_TRUSTSTORE_PASSWORD}
hostname-validation = false
}
}
}

kafka {
hosts = "localhost:9092"
hosts = ${?KAFKA_CLUSTER_HOSTS}
idle-timeout = 5
idle-timeout = ${?KAFKA_IDLE_TIMEOUT}
security.protocol=""
security.protocol=${?KAFKA_SECURITY}
ssl.truststore.location = ""
ssl.truststore.location = ${?TRUSTSTORE_PATH}
ssl.truststore.password = ""
ssl.truststore.password = ${?TRUSTSTORE_PASSWORD}
ssl.endpoint = ""
ssl.endpoint = ${?KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG}
}
22 changes: 19 additions & 3 deletions common/src/main/resources/persistence.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ akka {
max-message-batch-size = ${?TAG_BATCH_SIZE}
flush-interval = 150ms
flush-interval = ${?TAG_FLUSH_INTERVAL}
// read-profile = "akka-persistence-cassandra-profile-keyspaces"
// write-profile = "akka-persistence-cassandra-profile-keyspaces"
read-profile1 = ${?CASSANDRA_PROFILE}
write-profile = ${?CASSANDRA_PROFILE}
}
journal {
keyspace = "hmda2_journal"
Expand Down Expand Up @@ -46,12 +50,24 @@ akka {
}

datastax-java-driver {

profiles {
akka-persistence-cassandra-profile {
// akka-persistence-cassandra-profile-keyspaces {
basic {
request.consistency = LOCAL_QUORUM
}
}
}

basic {
contact-points = ["localhost:9042"]
contact-points = [${?CASSANDRA_CLUSTER_HOSTS}":9042"]
contact-points = [${?CASSANDRA_CLUSTER_HOSTS}]
load-balancing-policy.local-datacenter = "datacenter1"
load-balancing-policy.local-datacenter = ${?CASSANDRA_CLUSTER_DC}
load-balancing-policy.slow-replica-avoidance = false
}

advanced {
advanced.protocol {
version = V4
Expand All @@ -64,7 +80,7 @@ datastax-java-driver {
password = ${?CASSANDRA_CLUSTER_PASSWORD}
}
request-tracker {
class = RequestLogger
classes = [RequestLogger]
logs {
slow {
threshold = 1 second
Expand All @@ -88,4 +104,4 @@ kafka {
ssl.truststore.password = ${?TRUSTSTORE_PASSWORD}
ssl.endpoint = ""
ssl.endpoint = ${?KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG}
}
}
21 changes: 6 additions & 15 deletions hmda-analytics/src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
include "persistence.conf"
// Apache Cassandra with PlainTextAuthProvider
//include "persistence.conf"
// AWS Keyspace with PlainTextAuthProvider
//include "persistence-keyspace.conf"
// AWS Keyspace with SigV4AuthProvider
include "persistence-keyspace-sigv4.conf"

akka {
loglevel = info
Expand Down Expand Up @@ -38,20 +43,6 @@ cassandra-snapshot-store {
authentication.password = ${?CASSANDRA_CLUSTER_PASSWORD}
}

kafka {
hosts = "localhost:9092"
hosts = ${?KAFKA_CLUSTER_HOSTS}
idle-timeout = 5
idle-timeout = ${?KAFKA_IDLE_TIMEOUT}
ssl {
truststore.location=""
truststore.location = ${?KAFKA_SSL_LOCATION}
truststore.password=""
truststore.password = ${?KAFKA_SSL_PASSWORD}
endpoint=""
endpoint = ${?KAFKA_SSL_ENDPOINT}
}
}

hmda {
analytics {
Expand Down
7 changes: 6 additions & 1 deletion hmda/src/main/resources/application-kubernetes.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
include "persistence.conf"
// Apache Cassandra with PlainTextAuthProvider
//include "persistence.conf"
// AWS Keyspace with PlainTextAuthProvider
//include "persistence-keyspace.conf"
// AWS Keyspace with SigV4AuthProvider
include "persistence-keyspace-sigv4.conf"
include "hmda.conf"
include "cors.conf"

Expand Down
8 changes: 7 additions & 1 deletion hmda/src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
include "persistence.conf"
// Apache Cassandra with PlainTextAuthProvider
//include "persistence.conf"
// AWS Keyspace with PlainTextAuthProvider
//include "persistence-keyspace.conf"
// AWS Keyspace with SigV4AuthProvider
include "persistence-keyspace-sigv4.conf"

include "hmda.conf"
include "cors.conf"
include "edits.conf"
Expand Down
7 changes: 6 additions & 1 deletion irs-publisher/src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
include "persistence.conf"
// Apache Cassandra with PlainTextAuthProvider
//include "persistence.conf"
// AWS Keyspace with PlainTextAuthProvider
//include "persistence-keyspace.conf"
// AWS Keyspace with SigV4AuthProvider
include "persistence-keyspace-sigv4.conf"

akka {
loglevel = info
Expand Down
Loading
Loading