Skip to content

Commit 4a054e4

Browse files
authored
Merge pull request #4984 from cfpb/zencircle-docs-keyspaces
create platform-msk-keyspaces.md
2 parents 598f0e9 + 1f01225 commit 4a054e4

File tree

4 files changed

+104
-121
lines changed

4 files changed

+104
-121
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,15 @@ The HMDA Platform can run locally using [`sbt`](https://www.scala-sbt.org/) with
171171
sbt:hmda-root> project hmda-platform
172172
sbt:hmda-platform> reStart
173173
```
174-
174+
### Building and running the .jar
175+
To build JVM artifacts, from the sbt prompt first choose the project you want to build and use the assembly command:
176+
```bash
177+
sbt
178+
sbt:root> project check-digit
179+
sbt:check-digit>assembly
180+
```
181+
This task will create a fat jar, which can be executed on any JDK9 compliant JVM:
182+
`java -jar target/scala-2.12/check-digit.jar`
175183
### Running with docker compose
176184

177185
The platform and it's dependency services, Kafka, Cassandra and PostgreSQL, can run locally using [Docker Compose](https://docs.docker.com/compose/).

docs/JavaInstall.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/README.md

Lines changed: 8 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,53 @@
1-
# HMDA Platform
2-
3-
## Introduction
4-
5-
For more information on HMDA, checkout the [About HMDA page](http://www.consumerfinance.gov/data-research/hmda/learn-more) on the CFPB website.
6-
7-
## The HMDA Platform
8-
9-
The new HMDA Platform (“V2”) was totally updated over the past year to utilize a more flexible and resilient approach (Kubernetes Microservices) in order to better serve our customers. This repository contains the code for the entirety of the HMDA platform backend. This platform has been designed to accommodate the needs of the HMDA filing process by financial institutions, as well as the data management and publication needs of the HMDA data asset.
10-
11-
The HMDA Platform uses sbt's multi-project builds, each project representing a specific task. The platform is an Akka Cluster application that can be deployed on a single node or as a distributed application. For more information on how Akka Cluster is used, see the documentation [here](Documents/cluster.md)
1+
# [HMDA Platform](../README.md)
122

133
The HMDA Platform is composed of the following modules:
14-
154
### Parser (JS/JVM)
165

176
Module responsible for reading incoming data and making sure that it conforms to the HMDA File Specification
187

198
### Data Validation
20-
219
Module responsible for validating incoming data by executing validation rules as per the Edit Checks documentation
2210

2311
### Persistence
24-
2512
Module responsible for persisting information into the system. It becomes the system of record for HMDA data
2613

2714
### Cluster
28-
2915
Module responsible for managing the various cluster roles, as well as starting the Hmda Platform
3016

3117
### API
32-
3318
This module contains both public APIs for HMDA data for general use by third party clients and web applications, as well as endpoints for receiving data and providing information about the filing process for Financial Institutions
3419

3520
### API Model
36-
3721
This module contains objects and JSON protocols for use by the API project
3822

3923
### Query
40-
4124
This module is responsible for interacting with the back-end database, as well as conversion between model objects and database objects.
4225

4326
### Panel
44-
4527
This module is responsible for parsing and persisting a CSV-format panel file
4628

4729
### Model (JS/JVM)
48-
4930
This module is responsible for maintaining the objects used in our platform
5031

5132
### Census
52-
5333
This module is responsible for geographic translation (e.g. state number -> state code)
5434

5535
### Publication
56-
5736
This module generates Aggregate and Disclosure reports, as required by HMDA statute.
5837

59-
## Dependencies
60-
61-
62-
## Dependencies
63-
64-
### Java 19 SDK
65-
66-
The HMDA Platform runs on the Java Virtual Machine (JVM), and requires the Java 19 JDK to build and run the project. This project is currently being built and tested on [Oracle JDK 19](https://www.oracle.com/java/technologies/javase/jdk19-archive-downloads.html). See [Oracle's JDK Install Overview](https://docs.oracle.com/en/java/javase/19/install/index.html) for install instructions.
67-
68-
The HMDA Platform should also run on JDK 8.
69-
70-
### Scala
71-
72-
The HMDA Platform is written in [Scala](http://www.scala-lang.org/). To build it, you will need to [download](http://www.scala-lang.org/download/) and [install](http://www.scala-lang.org/download/install.html) Scala 2.12.x
73-
74-
In addition, you'll need Scala's interactive build tool [sbt](https://www.scala-sbt.org/). Please refer to sbt's [installation instructions](https://www.scala-sbt.org/1.x/docs/Setup.html) to get started.
75-
76-
## Project structure
77-
78-
The HMDA Platform is divided into individual projects, each responsible for a subset of the functionality, as follows:
79-
80-
### hmda-platform
81-
82-
This is the main filing application, exposing the APIs necessary to upload, validate and store HMDA files.
83-
84-
### check-digit
85-
86-
Microservice that exposes functionality to create a check digit from a loan id, and to validate `Univeral Loan Identifiers`
87-
88-
89-
## Building and Running
90-
91-
### Running from the SBT prompt
92-
93-
* To run the project from the `SBT` prompt for development purposes, issue the following commands on a terminal:
94-
95-
```shell
96-
$ sbt
97-
sbt:root> project hmda-platform
98-
sbt:hmda-platform> reStart
99-
```
100-
101-
102-
### Building and running the .jar
103-
104-
* To build JVM artifacts, from the sbt prompt first choose the project you want to build and use the assembly command:
105-
106-
```shell
107-
$ sbt
108-
sbt:root> project check-digit
109-
sbt:check-digit>assembly
110-
```
111-
This task will create a `fat jar`, which can be executed on any `JDK9` compliant `JVM`:
112-
113-
`java -jar target/scala-2.12/check-digit.jar`
114-
115-
### Building and running the Docker image
116-
117-
* To build a `Docker` image that runs the `hmda-platform` as a single node cluster, from the sbt prompt:
118-
119-
```shell
120-
$sbt
121-
sbt:root> project hmda-platform
122-
sbt:hmda-platform> docker:publishLocal
123-
```
124-
This task will create a `Docker` image. To run a container with the `HMDA Platform` filing application as a single node cluster:
125-
126-
`docker run -e CASSANDRA_CLUSTER_HOSTS=localhost --rm -ti -p 8080:8080 -p 8081:8081 -p 8082:8082 -p 19999:19999 hmda/hmda-platform`
127-
128-
The same approach can be followed to build and run Docker containers for the other microservices that form the HMDA Platform.
129-
130-
Certain environment variables can be passed in to set the log level of the micro service
131-
132-
```
133-
ZOOKEEPER_LOG_LEVEL (Defaulted to WARN)
134-
KAFKA_LOG_LEVEL (Defaulted to INFO)
135-
CASSANDRA_LOG_LEVEL (Defaulted to INFO)
136-
PLATFORM_LOG_LEVEL (Defaulted to WARN)
137-
INSTITUTION_LOG_LEVEL (Defaulted to INFO)
138-
CHECKDIGIT_LOG_LEVEL (Defaulted to DEBUG)
139-
```
38+
### Docker run
39+
To run a container with the `HMDA Platform` filing application as a single node cluster:
40+
`docker run -e CASSANDRA_CLUSTER_HOSTS=localhost --rm -ti -p 8080:8080 -p 8081:8081 -p 8082:8082 hmda/hmda-platform`
14041

14142
## Resources
14243

14344
### API Documentation
14445

145-
* [HMDA Platform Public API Documentation](api/public-api.md)
146-
* [HMDA Platform ULI API Documentation](api/uli.md)
147-
* [HMDA Platform Filers API Documentation](api/filers-api.md)
148-
14946
### Development
150-
151-
* [Local Kubernetes CI/CD](development/kubernetes.md)
47+
* [Local development](development/local-platform.md)
48+
* [Kubernetes](development/kubernetes.md)
49+
* [Specific MSK and Keyspaces configuration](development/platform-msk-keyspaces.md)
50+
* [Postman configuration](development/postman.md)
15251

15352
### Data Specifications
15453

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
## Specific documentation related to AWS Keyspace and AWS MSK
2+
### MSK
3+
This includes the MSK configuration for hmda-platform, modified-lar, irs-publisher and email-service
4+
5+
- Required env variables for MSK
6+
```
7+
export KAFKA_SECURITY="SASL_SSL"
8+
export AWS_ACCESS_KEY_ID="acesskeyvalue1"
9+
export AWS_SECRET_ACCESS_KEY="secretkeyvalue1"
10+
```
11+
- To use plaintext KAFKA
12+
`unset KAFKA_SECURITY`
13+
14+
### Keyspaces
15+
This includes the Keyspaces configuration for hmda-platform, modified-lar, irs-publisher and hmda-analytics
16+
- For Apache Cassandra(k8ssandra) with PlainTextAuthProvider use [persistence.conf](common/src/main/resources/persistence.conf)
17+
- For AWS Keyspace with PlainTextAuthProvider use [persistence-keyspace.conf](common/src/main/resources/persistence-keyspace.conf) (do not use for cluster deployment)
18+
- For AWS Keyspace with SigV4AuthProvider [persistence-keyspace-sigv4.conf](common/src/main/resources/persistence-keyspace-sigv4.conf)
19+
- List of platform related files to updated
20+
```
21+
hmda/src/main/resources/application.conf (local deployment)
22+
hmda/src/main/resources/application-kubernetes.conf (cluster deployment)
23+
hmda-analytics/src/main/resources/application.conf
24+
modified-lar/src/main/resources/application.conf
25+
irs-publisher/src/main/resources/application.conf
26+
```
27+
28+
- Environment variables for Apache Cassandra(k8ssandra) with PlainTextAuthProvider use [persistence.conf](common/src/main/resources/persistence.conf)
29+
```
30+
export CASSANDRA_CLUSTER_HOSTS="10.x.x.x:9042"
31+
export CASSANDRA_JOURNAL_KEYSPACE=hmda2_journal
32+
export CASSANDRA_SNAPSHOT_KEYSPACE=hmda2_snapshot
33+
export CASSANDRA_CLUSTER_USERNAME=xxx
34+
export CASSANDRA_CLUSTER_DC=xxx
35+
export CASSANDRA_CLUSTER_PASSWORD=xxx
36+
```
37+
- Setup java truststore
38+
```
39+
curl https://certs.secureserver.net/repository/sf-class2-root.crt -O
40+
openssl x509 -outform der -in sf-class2-root.crt -out temp_file.der
41+
keytool -import -alias cassandra -keystore cassandra_truststore.jks -file temp_file.der
42+
...
43+
Trust this certificate? [no]: yes
44+
Certificate was added to keystore
45+
```
46+
- Environment variables for AWS Keyspace with PlainTextAuthProvider use [persistence-keyspace.conf](common/src/main/resources/persistence-keyspace.conf)
47+
```
48+
export CASSANDRA_TRUSTSTORE_FILE="/tmp/cassandra_truststore.jks"
49+
export CASSANDRA_TRUSTSTORE_PASSWORD="xxx"
50+
export CASSANDRA_JOURNAL_KEYSPACE=hmda2_journal
51+
export CASSANDRA_SNAPSHOT_KEYSPACE=hmda2_snapshot
52+
export CASSANDRA_CLUSTER_DC="us-east-1"
53+
export CASSANDRA_CLUSTER_USERNAME="xxx"
54+
export CASSANDRA_CLUSTER_PASSWORD="xxx"
55+
```
56+
57+
- Environment variables for AWS Keyspace with SigV4AuthProvider [persistence-keyspace-sigv4.conf](common/src/main/resources/persistence-keyspace-sigv4.conf)
58+
```
59+
export CASSANDRA_TRUSTSTORE_FILE="/tmp/cassandra_truststore.jks"
60+
export CASSANDRA_TRUSTSTORE_PASSWORD="xxx"
61+
export CASSANDRA_JOURNAL_KEYSPACE=hmda2_journal
62+
export CASSANDRA_SNAPSHOT_KEYSPACE=hmda2_snapshot
63+
export CASSANDRA_CLUSTER_DC="us-east-1"
64+
export CASSANDRA_CLUSTER_USERNAME="cassandrausernamevalue1"
65+
export CASSANDRA_CLUSTER_PASSWORD="xxx"
66+
export AWS_ACCESS_KEY_ID="acesskeyvalue"
67+
export AWS_SECRET_ACCESS_KEY="secretkeyvalue"
68+
```
69+
- Setup java truststore
70+
```
71+
curl https://certs.secureserver.net/repository/sf-class2-root.crt -O
72+
openssl x509 -outform der -in sf-class2-root.crt -out temp_file.der
73+
keytool -import -alias cassandra -keystore cassandra_truststore.jks -file temp_file.der
74+
...
75+
Trust this certificate? [no]: yes
76+
Certificate was added to keystore
77+
```
78+
- Backward compatibility update configmap to accommodate for k8ssandra
79+
```
80+
kubectl patch configmap/cassandra-configmap \
81+
--type merge \
82+
-p '{ "data": { "cassandra-hosts": "cluster1-main-service.k8ssandra-operator:9042" }}'
83+
84+
kubectl -n beta patch configmap/cassandra-configmap \
85+
--type merge \
86+
-p '{ "data": { "cassandra-hosts": "cluster1-main-service.k8ssandra-operator:9042" }}'
87+
```

0 commit comments

Comments
 (0)