ATM fraud detection pipeline¶
ATM fraud is a demo pipeline for ATM fraud detection.
The original by Confluent is written in KSQL
and outlined in this blogpost.
The one used in this example is re-built from scratch using bakdata's
streams-bootstrap
library.
What this will demonstrate¶
- Deploying a PostgreSQL database using Helm
- Deploying a pipeline using KPOps
- Destroying a pipeline using KPOps
Prerequisites¶
Completed all steps in the setup.
Setup and deployment¶
PostgreSQL¶
Deploy PostgreSQL using the Bitnami Helm chart: Add the helm repository:
Install the PostgreSQL with helm:
PostgreSQL Example Helm chart values (postgresql.yaml
)
ATM fraud detection example pipeline setup¶
Port forwarding¶
Before we deploy the pipeline, we need to forward the ports of kafka-rest-proxy
and kafka-connect
. Run the following commands in two different terminals.
Deploying the ATM fraud detection pipeline¶
-
Clone the kpops-examples repository and
cd
into the directory. -
Install KPOps
pip install -r requirements.txt
. -
Export environment variables in your terminal:
-
Deploy the pipeline
Note
You can use the --dry-run
flag instead of the --execute
flag and check the logs if your pipeline will be
deployed correctly.
Check if the deployment is successful¶
You can use the Streams Explorer to see the deployed pipeline. To do so, port-forward the service in a separate terminal session using the command below:
After that open http://localhost:8080 in your browser. You should be able to see pipeline shown in the image below:
Attention
Kafka Connect needs some time to set up the connector. Moreover, Streams Explorer needs a while to scrape the information from Kafka connect. Therefore, it might take a bit until you see the whole graph.
Teardown resources¶
PostrgreSQL¶
PostgreSQL can be uninstalled by running the following command:
ATM fraud pipeline¶
-
Export environment variables in your terminal.
-
Remove the pipeline
Note
You can use the --dry-run
flag instead of the --execute
flag and check the logs if your pipeline will be
destroyed correctly.
Attention
If you face any issues destroying this example see Teardown for manual deletion.
Common errors¶
deploy
fails:- Read the error message.
- Try to correct the mistakes if there were any. Likely the configuration is incorrect, or the port-forwarding is not working as intended.
- Run
clean
. - Run
deploy --dry-run
to avoid havig toclean
again. If an error is dropped, start over from step 1. - If the dry-run is succesful, run
deploy
. clean
fails:- Read the error message.
- Try to correct the indicated mistakes if there were any. Likely the configuration is incorrect, or the port-forwarding is not working as intended.
- Run
clean
. - If
clean
fails, follow the steps in teardown.