Skip to content

Commit d1696aa

Browse files
author
Aldrian Harjati
committed
Merge branch 'master' into post-filing-2025
2 parents 39838c7 + 981fe63 commit d1696aa

File tree

133 files changed

+1301
-7576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1301
-7576
lines changed

.github/workflows/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Releasing Image to ECR
2+
3+
> **_NOTE:_** This document contains info on how to publish the `hmda-platform` image to ECR.
4+
> This job, located in `ecr-push.yaml`, can **only** be run locally on your machine.
5+
6+
### Prerequisites
7+
8+
- `act` - version >=0.2.71
9+
- https://nektosact.com/installation/index.html
10+
- Logged in and authenticated to AWS
11+
12+
### Copy Job
13+
At the root of the repo, run:
14+
15+
```shell
16+
act -j 'release_to_ecr' --env=IMAGE_TAG=v0.1.2 --env=AWS_URL=aws.com --env-file <(aws configure export-credentials --format env)
17+
```
18+
Make sure to set:
19+
- `IMAGE_TAG`
20+
- The tag of what image you want to copy from Dockerhub to ECR
21+
- `AWS_URL`
22+
- The URL to our AWS instance

.github/workflows/cve-scan-pr.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,4 @@ jobs:
3939
with:
4040
name: cve-report
4141
path: |
42-
grype-report.txt
43-
44-
- name: Post comment with report link
45-
uses: thollander/actions-comment-pull-request@v3
46-
with:
47-
message: CVE scan report generated by Grype are available. Check the Actions tab to download the reports.
48-
49-
- name: Remove Docker image
50-
run: |
51-
docker rmi pr-cve-scan:latest
42+
grype-report.txt

.github/workflows/dockerhub-push.yml

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ name: HMDA Docker Hub Image Push
22

33
on:
44
push:
5-
branches:
6-
- master
5+
tags:
6+
- '*' # Push events to every tag not containing /
7+
8+
env:
9+
REGISTRY: hmda/hmda-platform
710

811
jobs:
912
push_to_dockerhub:
@@ -14,39 +17,21 @@ jobs:
1417
- name: Check out the repo
1518
uses: actions/checkout@v4
1619

17-
- name: Log in to Docker Hub
18-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
19-
with:
20-
username: ${{ secrets.DOCKERHUB_USERNAME }}
21-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
20+
- name: Setup sbt launcher
21+
uses: sbt/setup-sbt@v1
2222

2323
- name: Build image of HMDA Platform only
2424
run: |
25-
sbt -batch clean hmda-platform/docker:publishLocal
26-
continue-on-error: true
25+
sbt "project hmda-platform" dockerPublishLocalSkipTests
2726
2827
- name: Tag Docker image
29-
run: docker tag $(docker images --filter=reference="hmda/hmda-platform:latest" --format "{{.ID}}") ${{ secrets.DOCKERHUB_USERNAME }}/hmda:latest
30-
31-
- name: Push image to Docker Hub
32-
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/hmda:latest
28+
run: docker tag $(docker images --filter=reference="hmda/hmda-platform:latest" --format "{{.ID}}") ${{ env.REGISTRY }}:${{ github.ref_name }}
3329

34-
- name: Run Docker Scout CVE scan
35-
if: ${{ github.event_name != 'pull_request_target' }}
36-
uses: docker/scout-action@v1
37-
with:
38-
command: cves
39-
image: ${{ secrets.DOCKERHUB_USERNAME }}/hmda:latest
40-
sarif-file: sarif.output.json
41-
summary: true
42-
43-
- name: Upload CVE scan to artifact
44-
if: ${{ github.event_name != 'pull_request_target' }}
45-
uses: github/codeql-action/upload-sarif@v2
30+
- name: Log in to Docker Hub
31+
uses: docker/login-action@v3
4632
with:
47-
sarif_file: sarif.output.json
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKERHUB_TOKEN }}
4835

49-
- name: Post comment with report link
50-
uses: thollander/actions-comment-pull-request@v3
51-
with:
52-
message: CVE scan report generated by Docker Scout are available. Check the Actions tab to download the report.
36+
- name: Push image to Docker Hub
37+
run: docker push ${{ env.REGISTRY }}:${{ github.ref_name }}

.github/workflows/ecr-push.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: HMDA ECR Image Push
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release_to_ecr:
7+
name: Copy Docker image from Dockerhub to ECR
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Configure AWS credentials
11+
uses: aws-actions/configure-aws-credentials@v4
12+
with:
13+
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
14+
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
15+
aws-region: us-east-1
16+
17+
- name: Login to Amazon ECR
18+
id: login-ecr
19+
uses: aws-actions/amazon-ecr-login@v2
20+
21+
- name: Copy Image to ECR
22+
run: |
23+
docker pull hmda/hmda-platform:${{ env.IMAGE_TAG }}
24+
docker tag hmda/hmda-platform:${{ env.IMAGE_TAG }} ${{ env.AWS_URL }}/hmda/hmda-platform:${{ env.IMAGE_TAG }}
25+
docker push ${{ env.AWS_URL }}/hmda/hmda-platform:${{ env.IMAGE_TAG }}
26+
27+
- name: Cleanup images
28+
run: |
29+
docker rmi hmda/hmda-platform:${{ env.IMAGE_TAG }}
30+
docker rmi ${{ env.AWS_URL }}/hmda/hmda-platform:${{ env.IMAGE_TAG }}

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ src_managed/
8585
project/boot/
8686
project/plugins/project/
8787

88+
## sbt project specifics
89+
check-digit/project/
90+
data-browser/project/
91+
email-service/project/
92+
file-proxy/project/
93+
hmda-reporting/project/
94+
institutions-api/project/
95+
irs-publisher/project/
96+
modified-lar/project/
97+
rate-limit/project/
98+
ratespread-calculator/project/
99+
88100
## Lightbend
89101
.lightbend/
90102

README.md

Lines changed: 95 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -102,53 +102,116 @@ The image below shows the cloud vendor agnostic technical architecture for the H
102102

103103
## Installations
104104
Before running the HMDA Platform, make sure to have the following installed:
105-
1. Homebrew - https://brew.sh/
106-
2. Docker - ```bash brew install docker ```
107-
3. Docker Desktop - https://docs.docker.com/desktop/install/mac-install/
108-
4. <a href="./docs/JavaInstall.md">Java (version 13.0.2) for MacOS</a>
109-
5. Scala (version 2.12 for compatibility issues) - ```bash brew install [email protected] ```
110-
6. sdk - https://sdkman.io/install
111-
Next, use sdk to install sbt instead of brew (it won't work with brew) (Note: before install, check what version is currently being used in project/build.properties and install that version or higher):
112105

113-
```bash
114-
sdk install sbt
115-
```
116-
Clone the repo and go into the repo directory:
117-
```bash
118-
git clone https://github.com/cfpb/hmda-platform.git
119-
cd hmda-platform
120-
```
106+
### MacOS
107+
1. Install [Homebrew](https://brew.sh/):
108+
```bash
109+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
110+
```
111+
2. Install [Docker](https://www.docker.com/):
112+
```bash
113+
brew install docker
114+
```
115+
3. Install one of following docker engine implementations:
116+
* [Docker Desktop](https://docs.docker.com/desktop/install/mac-install/)
117+
* [Podman](https://podman.io/)
118+
* [Colima](https://github.com/abiosoft/colima/)
119+
* [Rancher Desktop](https://rancherdesktop.io/)
120+
4. Go to the following link for instructions to install OpenJDK:
121+
* [Java (version 13.0.2) for MacOS](/docs/JavaInstall.md)
122+
5. Install Scala (version 2.12 for compatibility issues):
123+
```bash
124+
brew install [email protected]
125+
```
126+
6. Install [sdkman](https://sdkman.io/install):
127+
```bash
128+
curl -s "https://get.sdkman.io" | bash
129+
```
130+
7. Install [sbt](https://www.scala-sbt.org/) using `sdkman` (not `brew`):
131+
```bash
132+
sdk install sbt <VERSION>
133+
```
134+
* Replace `<VERSION>` with the version used in `project/build.properties` or higher
135+
136+
8. Clone the repo and go into the repo directory:
137+
```bash
138+
git clone https://github.com/cfpb/hmda-platform.git
139+
cd hmda-platform
140+
```
141+
121142
### Apple Silicon
122143

123144
The current platform and specifically Cassandra have problems running on "Apple silicon" architecture. If your laptop **About This Mac** information shows an Apple M1 or later chip, this applies to you. This will cause test suites to abort.
124145

125146
The current solution is to install, build and run with an amd64-compatible JDK.
126147

127-
```
128-
$ brew install asdf
129-
$ arch -x86_64 asdf plugin-add java https://github.com/halcyon/asdf-java.git
130-
$ arch -x86_64 asdf install java openjdk-13.0.2
131-
$ export JAVA_HOME=$HOME/.asdf/installs/java/openjdk-13.0.2
148+
```bash
149+
brew install asdf
150+
arch -x86_64 asdf plugin-add java https://github.com/halcyon/asdf-java.git
151+
arch -x86_64 asdf install java openjdk-13.0.2
152+
export JAVA_HOME=$HOME/.asdf/installs/java/openjdk-13.0.2
132153
```
133154

134-
## Running with sbt
155+
## Running Locally
156+
157+
### Running with sbt
135158

136159
The HMDA Platform can run locally using [`sbt`](https://www.scala-sbt.org/) with an [embedded Cassandra](https://doc.akka.io/docs/alpakka-kafka/current/) and [embedded Kafka](https://doc.akka.io/docs/alpakka-kafka/current/). To get started:
137160

161+
1. Export the following environment variables:
162+
```bash
163+
export CASSANDRA_CLUSTER_HOSTS=localhost
164+
export APP_PORT=2551
165+
```
166+
2. Open terminal with `hmda-platform` root as the working directory
167+
3. Start sbt and run the platform with the following commands:
168+
```bash
169+
sbt
170+
[...]
171+
sbt:hmda-root> project hmda-platform
172+
sbt:hmda-platform> reStart
173+
```
174+
175+
### Running with docker compose
176+
177+
The platform and it's dependency services, Kafka, Cassandra and PostgreSQL, can run locally using [Docker Compose](https://docs.docker.com/compose/).
178+
The entire filing plaform can be spun up using a one line command. Using this locally running instance of Platform One, no authentication is needed.
179+
138180
```bash
139-
cd hmda-platform
140-
export CASSANDRA_CLUSTER_HOSTS=localhost
141-
export APP_PORT=2551
142-
sbt
143-
[...]
144-
sbt:hmda-root> project hmda-platform
145-
sbt:hmda-platform> reStart
181+
# Bring up every service (e.g., "hmda-platform", "hmda-analytics", "institutions-api")
182+
docker compose up
183+
184+
# Bring up a single service (e.g., "hmda-platform")
185+
docker compose up hmda-platform
186+
```
187+
188+
Additionally, there are several environment varialbes that can be configured/changed. The platform uses sensible defaults for each one. However, if required they can be overridden:
146189
190+
```bash
191+
CASSANDRA_CLUSTER_HOSTS
192+
CASSANDRA_CLUSTER_DC
193+
CASSANDRA_CLUSTER_USERNAME
194+
CASSANDRA_CLUSTER_PASSWORD
195+
CASSANDRA_JOURNAL_KEYSPACE
196+
CASSANDRA_SNAPSHOT_KEYSPACE
197+
KAFKA_CLUSTER_HOSTS
198+
APP_PORT
199+
HMDA_HTTP_PORT
200+
HMDA_HTTP_ADMIN_PORT
201+
HMDA_HTTP_PUBLIC_PORT
202+
MANAGEMENT_PORT
203+
HMDA_CASSANDRA_LOCAL_PORT
204+
HMDA_LOCAL_KAFKA_PORT
205+
HMDA_LOCAL_ZK_PORT
206+
WS_PORT
147207
```
148-
## Access locally build platform
149-
[hmda-admin-api](http://localhost:8081)
150-
[hmda-filing-api](http://localhost:8080)
151-
[hmda-public-api](http://localhost:8082)
208+
209+
### Access locally built platform APIs
210+
The following API endpoints are accessible when running the platform locally using either [Running with sbt](#running-with-sbt) or [Running with docker compose](#running-with-docker-compose).
211+
* [hmda-admin-api](http://localhost:8081)
212+
* [hmda-filing-api](http://localhost:8080)
213+
* [hmda-public-api](http://localhost:8082)
214+
152215
## Build hmda-platform Docker image
153216
154217
Docker Image is build via Docker plugin utilizing [sbt-native-packager](https://sbt-native-packager.readthedocs.io/en/stable/formats/docker.html#docker-plugin)
@@ -182,43 +245,6 @@ kubernetes/hmda-platform
182245
183246
All of the containers built by the HMDA Platform are released publicly via Docker Hub: https://hub.docker.com/u/hmda
184247
185-
## One-line Local Development Environment (No Auth)
186-
187-
The platform and it's dependency services, Kafka, Cassandra and PostgreSQL, can run locally using [Docker Compose](https://docs.docker.com/compose/).
188-
189-
```shell
190-
# Bring up hmda-platform, hmda-analytics, institutions-api
191-
docker-compose up
192-
```
193-
194-
The entire filing plaform can be spun up using a one line command. Using this locally running instance of Platform One, no authentication is needed.
195-
196-
```shell
197-
# Bring up the hmda-platform
198-
docker-compose up hmda-platform
199-
```
200-
201-
Additionally, there are several environment varialbes that can be configured/changed. The platform uses sensible defaults for each one. However, if required they can be overridden:
202-
203-
```
204-
CASSANDRA_CLUSTER_HOSTS
205-
CASSANDRA_CLUSTER_DC
206-
CASSANDRA_CLUSTER_USERNAME
207-
CASSANDRA_CLUSTER_PASSWORD
208-
CASSANDRA_JOURNAL_KEYSPACE
209-
CASSANDRA_SNAPSHOT_KEYSPACE
210-
KAFKA_CLUSTER_HOSTS
211-
APP_PORT
212-
HMDA_HTTP_PORT
213-
HMDA_HTTP_ADMIN_PORT
214-
HMDA_HTTP_PUBLIC_PORT
215-
MANAGEMENT_PORT
216-
HMDA_CASSANDRA_LOCAL_PORT
217-
HMDA_LOCAL_KAFKA_PORT
218-
HMDA_LOCAL_ZK_PORT
219-
WS_PORT
220-
```
221-
222248
## Automated Testing
223249
224250
The HMDA Platform takes a rigorous automated testing approach. In addtion to Travis and CodeCov, we've prepared a suite of [Newman](https://github.com/cfpb/hmda-platform/tree/master/newman) test scripts that perform end-to-end testing of the APIs on a recurring basis. The testing process for Newman is containerized and runs as a Kubernetes CronJob to act as a monitoring and alerting system. The platform and microservices are also testing for load by using [Locust](https://locust.io/).

build.sbt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ lazy val akkaDeps = Seq(
3131
akkaTestkitTyped,
3232
akkaStreamsTestKit,
3333
akkaCors,
34+
mskdriver,
3435
akkaKafkaStreams,
3536
embeddedKafka,
3637
alpakkaS3,
@@ -46,6 +47,7 @@ lazy val akkaPersistenceDeps =
4647
akkaPersistenceQuery,
4748
akkaClusterShardingTyped,
4849
akkaPersistenceCassandra,
50+
keyspacedriver,
4951
cassandraLauncher
5052
)
5153

@@ -136,6 +138,9 @@ lazy val common = (project in file("common"))
136138
)
137139
),
138140
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")
141+
// addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"),
142+
// unmanagedJars in Compile ++= Seq(new java.io.File("/tmp/aws-msk-iam-auth-2.2.0-all.jar")).classpath,
143+
// unmanagedJars in Runtime ++= Seq(new java.io.File("/tmp/aws-msk-iam-auth-2.2.0-all.jar")).classpath
139144
)
140145
.enablePlugins(BuildInfoPlugin)
141146
.settings(
@@ -176,7 +181,7 @@ lazy val `hmda-platform` = (project in file("hmda"))
176181
val oldStrategy = (assembly / assemblyMergeStrategy).value
177182
oldStrategy(x)
178183
},
179-
reStart / envVars ++= Map("CASSANDRA_CLUSTER_HOSTS" -> "localhost", "APP_PORT" -> "2551"),
184+
reStart / envVars ++= Map("CASSANDRA_CLUSTER_HOSTS" -> "localhost", "APP_PORT" -> "2551"),
180185
),
181186
dockerSettings,
182187
packageSettings
@@ -816,4 +821,4 @@ lazy val `hmda-quarterly-data-service` = (project in file ("hmda-quarterly-data-
816821
packageSettings
817822
)
818823
.dependsOn(common % "compile->compile;test->test")
819-
.dependsOn(`hmda-protocol` % "compile->compile;test->test")
824+
.dependsOn(`hmda-protocol` % "compile->compile;test->test")

0 commit comments

Comments
 (0)